Fixed package for windows

This commit is contained in:
Marc Garcia Puig 2019-02-11 15:29:18 +01:00
parent 5ef2148e73
commit a206e35c77
3 changed files with 57 additions and 40 deletions

View File

@ -6,10 +6,20 @@ using UnrealBuildTool;
public class Carla : ModuleRules public class Carla : ModuleRules
{ {
private bool IsWindows(ReadOnlyTargetRules Target)
{
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32);
}
public Carla(ReadOnlyTargetRules Target) : base(Target) public Carla(ReadOnlyTargetRules Target) : base(Target)
{ {
PrivatePCHHeaderFile = "Carla.h"; PrivatePCHHeaderFile = "Carla.h";
if (IsWindows(Target))
{
bEnableExceptions = true;
}
PublicIncludePaths.AddRange( PublicIncludePaths.AddRange(
new string[] { new string[] {
// ... add public include paths required here ... // ... add public include paths required here ...
@ -58,11 +68,6 @@ public class Carla : ModuleRules
AddCarlaServerDependency(Target); AddCarlaServerDependency(Target);
} }
private bool IsWindows(ReadOnlyTargetRules Target)
{
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32);
}
private bool UseDebugLibs(ReadOnlyTargetRules Target) private bool UseDebugLibs(ReadOnlyTargetRules Target)
{ {
if (IsWindows(Target)) if (IsWindows(Target))

View File

@ -85,7 +85,11 @@ cd "%LIBCARLA_VSPROJECT_PATH%"
rem Build libcarla server rem Build libcarla server
rem rem
if %BUILD_SERVER% == true ( 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 if %errorlevel% neq 0 goto error_cmake
cmake --build . --config Release --target install | findstr /V "Up-to-date:" cmake --build . --config Release --target install | findstr /V "Up-to-date:"
@ -95,7 +99,11 @@ if %BUILD_SERVER% == true (
rem Build libcarla client rem Build libcarla client
rem rem
if %BUILD_CLIENT% == true ( 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 if %errorlevel% neq 0 goto error_cmake
cmake --build . --config Release --target install | findstr /V "Up-to-date:" cmake --build . --config Release --target install | findstr /V "Up-to-date:"

View File

@ -57,6 +57,8 @@ rem ============================================================================
rem -- Basic info and setup ---------------------------------------------------- rem -- Basic info and setup ----------------------------------------------------
rem ============================================================================ rem ============================================================================
set INSTALLATION_DIR=%INSTALLATION_DIR:/=\%
echo %FILE_N% Asynchronous jobs: %NUMBER_OF_ASYNC_JOBS% echo %FILE_N% Asynchronous jobs: %NUMBER_OF_ASYNC_JOBS%
echo %FILE_N% Boost toolset: %TOOLSET% echo %FILE_N% Boost toolset: %TOOLSET%
echo %FILE_N% Install directory: "%INSTALLATION_DIR%" echo %FILE_N% Install directory: "%INSTALLATION_DIR%"
@ -177,39 +179,41 @@ set CMAKE_INSTALLATION_DIR=%INSTALLATION_DIR:\=/%
echo %FILE_N% Creating "CMakeLists.txt.in"... echo %FILE_N% Creating "CMakeLists.txt.in"...
>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Automatically generated by Setup.bat set CMAKE_CONFIG_FILE="%INSTALLATION_DIR%CMakeLists.txt.in"
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(CARLA_VERSION %carla_version%)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. >"%CMAKE_CONFIG_FILE%" echo # Automatically generated by Setup.bat
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo if (WIN32) >>"%CMAKE_CONFIG_FILE%" echo set(CARLA_VERSION %carla_version%)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-D_WIN32_WINNT=0x0501) >>"%CMAKE_CONFIG_FILE%" echo.
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo STRING (REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") >>"%CMAKE_CONFIG_FILE%" echo if (WIN32)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo endif() >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-D_WIN32_WINNT=0x0501)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. >>"%CMAKE_CONFIG_FILE%" echo STRING (REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) >>"%CMAKE_CONFIG_FILE%" echo endif()
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT) >>"%CMAKE_CONFIG_FILE%" echo.
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(BOOST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/include") >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(BOOST_LIB_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/lib") >>"%CMAKE_CONFIG_FILE%" echo.
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. >>"%CMAKE_CONFIG_FILE%" echo set(BOOST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/include")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(RPCLIB_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/include") >>"%CMAKE_CONFIG_FILE%" echo set(BOOST_LIB_PATH "%CMAKE_INSTALLATION_DIR%boost-%BOOST_VERSION%-install/lib")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(RPCLIB_LIB_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/lib") >>"%CMAKE_CONFIG_FILE%" echo.
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo. >>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/include")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo if (CMAKE_BUILD_TYPE STREQUAL "Server") >>"%CMAKE_CONFIG_FILE%" echo set(RPCLIB_LIB_PATH "%CMAKE_INSTALLATION_DIR%rpclib-install/lib")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Prevent exceptions >>"%CMAKE_CONFIG_FILE%" echo.
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DASIO_NO_EXCEPTIONS) >>"%CMAKE_CONFIG_FILE%" echo if (CMAKE_BUILD_TYPE STREQUAL "Server")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DBOOST_NO_EXCEPTIONS) >>"%CMAKE_CONFIG_FILE%" echo # Prevent exceptions
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DLIBCARLA_NO_EXCEPTIONS) >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DASIO_NO_EXCEPTIONS)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo add_definitions(-DPUGIXML_NO_EXCEPTIONS) >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_NO_EXCEPTIONS)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Specific libraries for server >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DLIBCARLA_NO_EXCEPTIONS)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(GTEST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/include") >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DPUGIXML_NO_EXCEPTIONS)
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(GTEST_LIB_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/lib") >>"%CMAKE_CONFIG_FILE%" echo # Specific libraries for server
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo elseif (CMAKE_BUILD_TYPE STREQUAL "Client") >>"%CMAKE_CONFIG_FILE%" echo set(GTEST_INCLUDE_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/include")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo # Specific libraries for client >>"%CMAKE_CONFIG_FILE%" echo set(GTEST_LIB_PATH "%CMAKE_INSTALLATION_DIR%gtest-install/lib")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(ZLIB_INCLUDE_PATH "%ZLIB_INSTALL_DIR%/include") >>"%CMAKE_CONFIG_FILE%" echo elseif (CMAKE_BUILD_TYPE STREQUAL "Client")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(ZLIB_LIB_PATH "%ZLIB_INSTALL_DIR%/lib") >>"%CMAKE_CONFIG_FILE%" echo # Specific libraries for client
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(LIBPNG_INCLUDE_PATH "%LIBPNG_INSTALL_DIR%/include") >>"%CMAKE_CONFIG_FILE%" echo set(ZLIB_INCLUDE_PATH "%ZLIB_INSTALL_DIR%/include")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo set(LIBPNG_LIB_PATH "%LIBPNG_INSTALL_DIR%/lib") >>"%CMAKE_CONFIG_FILE%" echo set(ZLIB_LIB_PATH "%ZLIB_INSTALL_DIR%/lib")
>>"%INSTALLATION_DIR%CMakeLists.txt.in" echo endif () >>"%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 goto success