From c983966c2a4f6b2aa97c380a32ec8faf83ad8847 Mon Sep 17 00:00:00 2001 From: iFuSiiOnzZ Date: Mon, 30 Jul 2018 18:59:42 +0200 Subject: [PATCH] Link runtime libraries dynamically Unreal Engine doesn't allow static runtime linking https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System --- PythonAPI/setup.py | 4 ++-- Util/BuildTools/BuildLibCarla.bat | 4 ++-- Util/InstallersWin/install_boost.bat | 2 +- Util/InstallersWin/install_gtest.bat | 2 +- Util/InstallersWin/install_rpclib.bat | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PythonAPI/setup.py b/PythonAPI/setup.py index 2d6cba6de..53ff7f136 100644 --- a/PythonAPI/setup.py +++ b/PythonAPI/setup.py @@ -36,7 +36,7 @@ def get_libcarla_extensions(): libraries += ["boost_python"] elif os.name == "nt": pwd = os.path.dirname(os.path.realpath(__file__)) - pylib = "libboost_python%d%d-vc141-mt-s-x64-1_68.lib" % (sys.version_info.major, sys.version_info.minor) + pylib = "libboost_python%d%d-vc141-mt-x64-1_68.lib" % (sys.version_info.major, sys.version_info.minor) extra_link_args = [ 'shlwapi.lib', @@ -44,7 +44,7 @@ def get_libcarla_extensions(): os.path.join(pwd, 'dependencies/lib', pylib)] # https://docs.microsoft.com/es-es/cpp/porting/modifying-winver-and-win32-winnt - extra_compile_args = ['/DPYTHON3X', '/MT', '/DBOOST_PYTHON_STATIC_LIB','/DBOOST_ERROR_CODE_HEADER_ONLY', '/D_WIN32_WINNT=0x0501' ] + extra_compile_args = ['/DPYTHON3X', '/DBOOST_PYTHON_STATIC_LIB','/DBOOST_ERROR_CODE_HEADER_ONLY', '/D_WIN32_WINNT=0x0501' ] extra_link_args += [] else: raise NotImplementedError diff --git a/Util/BuildTools/BuildLibCarla.bat b/Util/BuildTools/BuildLibCarla.bat index a8e4424f1..0f7d26168 100644 --- a/Util/BuildTools/BuildLibCarla.bat +++ b/Util/BuildTools/BuildLibCarla.bat @@ -80,13 +80,13 @@ cd "%LIBCARLA_VSPROJECT_PATH%" rem Build libcarla server rem if %BUILD_SERVER% == true if not exist "%LIBCARLA_SERVER_INSTALL_PATH%" ( - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Server -DCMAKE_CXX_FLAGS_RELEASE=/MT -DCMAKE_INSTALL_PREFIX=%LIBCARLA_SERVER_INSTALL_PATH% %ROOT_PATH% + cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Server -DCMAKE_CXX_FLAGS_RELEASE=/MD -DCMAKE_INSTALL_PREFIX=%LIBCARLA_SERVER_INSTALL_PATH% %ROOT_PATH% cmake --build . --config Release --target install ) rem Build libcarla client rem if %BUILD_CLIENT% == true if not exist "%LIBCARLA_CLIENT_INSTALL_PATH%" ( - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Client -DCMAKE_CXX_FLAGS_RELEASE=/MT -DCMAKE_INSTALL_PREFIX=%LIBCARLA_CLIENT_INSTALL_PATH% %ROOT_PATH% + cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Client -DCMAKE_CXX_FLAGS_RELEASE=/MD -DCMAKE_INSTALL_PREFIX=%LIBCARLA_CLIENT_INSTALL_PATH% %ROOT_PATH% cmake --build . --config Release --target install ) diff --git a/Util/InstallersWin/install_boost.bat b/Util/InstallersWin/install_boost.bat index 43f6d3f3c..73b7661ec 100644 --- a/Util/InstallersWin/install_boost.bat +++ b/Util/InstallersWin/install_boost.bat @@ -76,7 +76,7 @@ b2 -j8^ toolset=%B_TOOLSET%^ variant=release^ link=static^ - runtime-link=static^ + runtime-link=shared^ threading=multi^ --prefix="%B_INSTALL_DIR%"^ --libdir="%B_LIB_DIR%"^ diff --git a/Util/InstallersWin/install_gtest.bat b/Util/InstallersWin/install_gtest.bat index 002f6cb23..0ebfaac4d 100644 --- a/Util/InstallersWin/install_gtest.bat +++ b/Util/InstallersWin/install_gtest.bat @@ -59,7 +59,7 @@ cd "%GT_BUILD_DIR%" echo %FILE_N% Generating build... cmake .. -G "Visual Studio 15 2017 Win64"^ -DCMAKE_BUILD_TYPE=Release^ - -DCMAKE_CXX_FLAGS_RELEASE=/MT^ + -DCMAKE_CXX_FLAGS_RELEASE=/MD^ -DCMAKE_INSTALL_PREFIX=%GT_INSTALL_DIR%^ -DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING^ %GT_SRC_DIR% diff --git a/Util/InstallersWin/install_rpclib.bat b/Util/InstallersWin/install_rpclib.bat index 14e8b23fb..a8e1c2cbc 100644 --- a/Util/InstallersWin/install_rpclib.bat +++ b/Util/InstallersWin/install_rpclib.bat @@ -60,7 +60,7 @@ echo %FILE_N% Generating build... cmake .. -G "Visual Studio 15 2017 Win64"^ -DCMAKE_BUILD_TYPE=Release^ -RPCLIB_BUILD_EXAMPLES=OFF^ - -DCMAKE_CXX_FLAGS_RELEASE=/MT^ + -DCMAKE_CXX_FLAGS_RELEASE=/MD^ -DCMAKE_INSTALL_PREFIX=%RPC_INSTALL_DIR%^ %RPC_SRC_DIR% if errorlevel 1 goto error_cmake