diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs index 8c626eb78..60294f266 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Carla.Build.cs @@ -6,10 +6,20 @@ using UnrealBuildTool; public class Carla : ModuleRules { + private bool IsWindows(ReadOnlyTargetRules Target) + { + return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32); + } + public Carla(ReadOnlyTargetRules Target) : base(Target) { PrivatePCHHeaderFile = "Carla.h"; + if (IsWindows(Target)) + { + bEnableExceptions = true; + } + PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... @@ -58,11 +68,6 @@ public class Carla : ModuleRules AddCarlaServerDependency(Target); } - private bool IsWindows(ReadOnlyTargetRules Target) - { - return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32); - } - private bool UseDebugLibs(ReadOnlyTargetRules Target) { if (IsWindows(Target)) diff --git a/Util/BuildTools/BuildLibCarla.bat b/Util/BuildTools/BuildLibCarla.bat index c1e039b75..fc7c8552f 100644 --- a/Util/BuildTools/BuildLibCarla.bat +++ b/Util/BuildTools/BuildLibCarla.bat @@ -85,7 +85,11 @@ cd "%LIBCARLA_VSPROJECT_PATH%" rem Build libcarla server rem if %BUILD_SERVER% == true ( - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Server -DCMAKE_CXX_FLAGS_RELEASE="/MD /MP" -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 /MP"^ + -DCMAKE_INSTALL_PREFIX=%LIBCARLA_SERVER_INSTALL_PATH%^ + %ROOT_PATH% if %errorlevel% neq 0 goto error_cmake cmake --build . --config Release --target install | findstr /V "Up-to-date:" @@ -95,7 +99,11 @@ if %BUILD_SERVER% == true ( rem Build libcarla client rem if %BUILD_CLIENT% == true ( - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Client -DCMAKE_CXX_FLAGS_RELEASE="/MD /MP" -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 /MP"^ + -DCMAKE_INSTALL_PREFIX=%LIBCARLA_CLIENT_INSTALL_PATH%^ + %ROOT_PATH% if %errorlevel% neq 0 goto error_cmake cmake --build . --config Release --target install | findstr /V "Up-to-date:" diff --git a/Util/BuildTools/Setup.bat b/Util/BuildTools/Setup.bat index e38dc3f0c..73c5a1fef 100644 --- a/Util/BuildTools/Setup.bat +++ b/Util/BuildTools/Setup.bat @@ -57,6 +57,8 @@ rem ============================================================================ rem -- Basic info and setup ---------------------------------------------------- rem ============================================================================ +set INSTALLATION_DIR=%INSTALLATION_DIR:/=\% + echo %FILE_N% Asynchronous jobs: %NUMBER_OF_ASYNC_JOBS% echo %FILE_N% Boost toolset: %TOOLSET% echo %FILE_N% Install directory: "%INSTALLATION_DIR%" @@ -177,39 +179,41 @@ set CMAKE_INSTALLATION_DIR=%INSTALLATION_DIR:\=/% echo %FILE_N% Creating "CMakeLists.txt.in"... - >"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Automatically generated by Setup.bat ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(CARLA_VERSION %carla_version%) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo if (WIN32) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-D_WIN32_WINNT=0x0501) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo STRING (REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo endif() ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(BOOST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/include") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(BOOST_LIB_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/lib") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(RPCLIB_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/include") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(RPCLIB_LIB_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/lib") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo if (CMAKE_BUILD_TYPE STREQUAL "Server") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Prevent exceptions ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DASIO_NO_EXCEPTIONS) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DBOOST_NO_EXCEPTIONS) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DLIBCARLA_NO_EXCEPTIONS) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DPUGIXML_NO_EXCEPTIONS) ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Specific libraries for server ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(GTEST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/include") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(GTEST_LIB_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/lib") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo elseif (CMAKE_BUILD_TYPE STREQUAL "Client") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Specific libraries for client ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(ZLIB_INCLUDE_PATH "%ZLIB_INSTALL_DIR%/include") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(ZLIB_LIB_PATH "%ZLIB_INSTALL_DIR%/lib") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(LIBPNG_INCLUDE_PATH "%LIBPNG_INSTALL_DIR%/include") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(LIBPNG_LIB_PATH "%LIBPNG_INSTALL_DIR%/lib") ->>"%INSTALLATION_DIR%CMakeLists.txt.in" echo endif () +set CMAKE_CONFIG_FILE="%INSTALLATION_DIR%CMakeLists.txt.in" + + >"%CMAKE_CONFIG_FILE%" echo # Automatically generated by Setup.bat +>>"%CMAKE_CONFIG_FILE%" echo set(CARLA_VERSION %carla_version%) +>>"%CMAKE_CONFIG_FILE%" echo. +>>"%CMAKE_CONFIG_FILE%" echo if (WIN32) +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-D_WIN32_WINNT=0x0501) +>>"%CMAKE_CONFIG_FILE%" echo STRING (REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +>>"%CMAKE_CONFIG_FILE%" echo endif() +>>"%CMAKE_CONFIG_FILE%" echo. +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT) +>>"%CMAKE_CONFIG_FILE%" echo. +>>"%CMAKE_CONFIG_FILE%" echo set(BOOST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/include") +>>"%CMAKE_CONFIG_FILE%" echo set(BOOST_LIB_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/lib") +>>"%CMAKE_CONFIG_FILE%" echo. +>>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/include") +>>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_LIB_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/lib") +>>"%CMAKE_CONFIG_FILE%" echo. +>>"%CMAKE_CONFIG_FILE%" echo if (CMAKE_BUILD_TYPE STREQUAL "Server") +>>"%CMAKE_CONFIG_FILE%" echo # Prevent exceptions +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DASIO_NO_EXCEPTIONS) +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_NO_EXCEPTIONS) +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DLIBCARLA_NO_EXCEPTIONS) +>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DPUGIXML_NO_EXCEPTIONS) +>>"%CMAKE_CONFIG_FILE%" echo # Specific libraries for server +>>"%CMAKE_CONFIG_FILE%" echo set(GTEST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/include") +>>"%CMAKE_CONFIG_FILE%" echo set(GTEST_LIB_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/lib") +>>"%CMAKE_CONFIG_FILE%" echo elseif (CMAKE_BUILD_TYPE STREQUAL "Client") +>>"%CMAKE_CONFIG_FILE%" echo # Specific libraries for client +>>"%CMAKE_CONFIG_FILE%" echo set(ZLIB_INCLUDE_PATH "%ZLIB_INSTALL_DIR%/include") +>>"%CMAKE_CONFIG_FILE%" echo set(ZLIB_LIB_PATH "%ZLIB_INSTALL_DIR%/lib") +>>"%CMAKE_CONFIG_FILE%" echo set(LIBPNG_INCLUDE_PATH "%LIBPNG_INSTALL_DIR%/include") +>>"%CMAKE_CONFIG_FILE%" echo set(LIBPNG_LIB_PATH "%LIBPNG_INSTALL_DIR%/lib") +>>"%CMAKE_CONFIG_FILE%" echo endif () goto success