Now the scripts are parametrized and check for errors, + some bug fixes

This commit is contained in:
Marc Garcia Puig 2018-05-22 16:50:32 +02:00
parent ac63d2e79b
commit 080b7a1d5a
5 changed files with 183 additions and 36 deletions

View File

@ -3,16 +3,17 @@
setlocal
set LOCAL_PATH=%~dp0
set FILE_N=---%~n0%~x0:
set LIB_FOLDER=%LOCAL_PATH%Util\Build\
set CARLA_FOLDER=%LOCAL_PATH%Unreal\CarlaUE4\
if not exist "%LIB_FOLDER%" (
echo Creating %LIB_FOLDER% folder...
echo %FILE_N% Creating %LIB_FOLDER% folder...
mkdir %LIB_FOLDER%
)
echo Deleting intermediate folders...
echo %FILE_N% Deleting intermediate folders...
for %%G in (
"%CARLA_FOLDER%Binaries",
"%CARLA_FOLDER%Intermediate",
@ -20,17 +21,29 @@ for %%G in (
"%CARLA_FOLDER%Plugins\Carla\Intermediate"
) do (
if exist %%G (
echo Deleting: %%G
echo %FILE_N% Deleting: %%G
rmdir /s/q %%G
)
)
echo.
echo Building carlaserver...
echo %FILE_N% Building carlaserver...
make clean & make
if errorlevel 1 goto compiling_error
echo.
echo Launch editor...
echo %FILE_N% Launch editor...
start %CARLA_FOLDER%CarlaUE4.uproject
endlocal
:success
goto eof
:compiling_error
echo.
echo.
echo %FILE_N% Error while compiling carlaserver
goto eof
:eof
endlocal

View File

@ -9,6 +9,33 @@ set INSTALLATION_DIR=%LOCAL_PATH%Util\Build\
set VERSION_FILE=%LOCAL_PATH%Util\ContentVersions.txt
set CONTENT_DIR=%LOCAL_PATH%Unreal\CarlaUE4\Content
:arg-parse
if not "%1"=="" (
if "%1"=="-j" (
set NUMBER_OF_ASYNC_JOBS=%2
shift
)
if "%1"=="--boost-toolset" (
set TOOLSET=%2
shift
)
if "%1"=="-h" (
goto help
)
if "%1"=="--help" (
goto help
)
shift
goto :arg-parse
)
if [%TOOLSET%] == [] set TOOLSET=msvc-14.1
if [%NUMBER_OF_ASYNC_JOBS%] == [] set NUMBER_OF_ASYNC_JOBS=1
echo Asynchronous jobs: %NUMBER_OF_ASYNC_JOBS%
echo Boost toolset: %TOOLSET%
echo Install directory: %INSTALLATION_DIR%
if not exist "%CONTENT_DIR%" (
echo Creating %CONTENT_DIR% folder...
mkdir %CONTENT_DIR%
@ -16,7 +43,9 @@ if not exist "%CONTENT_DIR%" (
echo.
echo Installing Protobuf...
call %INSTALLERS_DIR%install_proto.bat %INSTALLATION_DIR%
call %INSTALLERS_DIR%install_proto.bat ^
--build-dir %INSTALLATION_DIR% ^
-j %NUMBER_OF_ASYNC_JOBS%
if not defined install_proto (
echo.
@ -26,7 +55,10 @@ if not defined install_proto (
echo.
echo Installing Boost...
call %INSTALLERS_DIR%install_boost.bat %INSTALLATION_DIR%
call %INSTALLERS_DIR%install_boost.bat ^
--build-dir %INSTALLATION_DIR% ^
--toolset %TOOLSET% ^
-j %NUMBER_OF_ASYNC_JOBS%
if not defined install_boost (
echo.
@ -43,6 +75,8 @@ FOR /F "tokens=1 delims=:" %%i in (%VERSION_FILE%) do (
set ASSETS_VERSION=%%i
)
goto success
:success
echo.
echo.
@ -51,9 +85,11 @@ FOR /F "tokens=1 delims=:" %%i in (%VERSION_FILE%) do (
echo #############################
echo.
echo All the CARLA library dependences should be installed now.
echo (You can remove all "*-src" folders in %INSTALLATION_DIR% directory)
echo.
echo You only need the ASSET PACK with all the meshes and textures.
echo.
echo This script provides the optimal assets version %ASSETS_VERSION%
echo This script provides the assets for CARLA %ASSETS_VERSION%
echo If you want another asset version, search it in %VERSION_FILE%.
echo You can download the assets from here:
echo.
@ -64,6 +100,21 @@ FOR /F "tokens=1 delims=:" %%i in (%VERSION_FILE%) do (
goto eof
:help
echo --------
echo HELP
echo --------
echo.
echo Commands:
echo -h, --help -^> Shows this dialog.
echo -j ^<N^> -^> N is the integer number of async jobs while compiling (default=1).
echo --boost-toolset [T] -^> Toolset corresponding to your compiler ^(default=^*^):
echo Visual Studio 2013 -^> msvc-12.0
echo Visual Studio 2015 -^> msvc-14.0
echo Visual Studio 2017 -^> msvc-14.1 *
goto eof
:failed
echo.
echo Ok, and error ocurred, don't panic!

View File

@ -6,8 +6,29 @@ rem Just put it in `Util/Build` and run it.
setlocal
:arg-parse
if not "%1"=="" (
if "%1"=="-j" (
set NUMBER_OF_ASYNC_JOBS=%2
shift
)
if "%1"=="--build-dir" (
set BUILD_DIR=%2
shift
)
if "%1"=="--toolset" (
set B_TOOLSET=%2
shift
)
shift
goto :arg-parse
)
if [%BUILD_DIR%] == [] set BUILD_DIR=.
if [%B_TOOLSET%] == [] set B_TOOLSET=msvc-14.1
if [%NUMBER_OF_ASYNC_JOBS%] == [] set NUMBER_OF_ASYNC_JOBS=1
set LOCAL_PATH=%~dp0
set BUILD_DIR=%1
set FILE_N=---%~n0%~x0:
set B_VERSION=boost-1.64.0
@ -15,9 +36,11 @@ set B_SRC=boost-src
set B_SRC_DIR=%BUILD_DIR%%B_SRC%
set B_INSTALL=boost-install
set B_INSTALL_DIR=%BUILD_DIR%%B_INSTALL%
set B_LIB_DIR=%B_INSTALL_DIR%\lib
set B_TOOLSET=msvc-14.1
set B_LIB_DIR=%B_INSTALL_DIR%/lib
if exist "%B_INSTALL_DIR%" (
goto already_build
)
if not exist "%B_SRC_DIR%" (
echo %FILE_N% Cloning Boost - version "%B_VERSION%"...
@ -30,17 +53,21 @@ if not exist "%B_SRC_DIR%" (
echo %FILE_N% Not cloning boost because already exists a folder called "%B_SRC%".
)
if exist "%B_INSTALL_DIR%" (
goto already_build
cd %B_SRC_DIR%
if not exist "b2.exe" (
echo %FILE_N% Generating build...
call bootstrap.bat
)
cd %B_SRC_DIR%
echo %FILE_N% Generating build...
call bootstrap.bat
if errorlevel 1 goto error_bootstrap
echo %FILE_N% Packing headers...
b2 headers
echo %FILE_N% Building...
b2 -j8 ^
headers ^
--layout=versioned ^
--with-system ^
--with-date_time ^
--build-dir=./build ^
@ -50,30 +77,47 @@ b2 -j8 ^
variant=release ^
link=static ^
threading=multi ^
install ^
--prefix=%B_INSTALL_DIR% ^
--libdir=%B_LIB_DIR% ^
--includedir=%B_INSTALL_DIR%
cd %BUILD_DIR%
--includedir=%B_INSTALL_DIR% ^
install
move "%B_INSTALL_DIR%/boost-1_64/boost" "%B_INSTALL_DIR%/"
rd /s /q "%B_INSTALL_DIR%/boost-1_64"
if errorlevel 1 goto error_install
cd %BUILD_DIR%
rem Remove the downloaded protobuf source because is no more needed
rem if you want to keep the source just delete the following command.
rem @rd /s /q %B_SRC_DIR% 2>nul
goto success
:success
echo.
echo %FILE_N% Boost has been successfully installed in %B_INSTALL_DIR%!
goto eof
goto good_exit
:already_build
echo %FILE_N% Library has already been built.
echo %FILE_N% A Boost installation already exists.
echo %FILE_N% Delete "%B_INSTALL_DIR%" if you want to force a rebuild.
goto eof
goto good_exit
:eof
:error_bootstrap
echo %FILE_N% [ERROR] An error ocurred while executing the "bootstrap.bat".
goto bad_exit
:error_install
echo %FILE_N% [ERROR] An error ocurred while installing.
goto bad_exit
:good_exit
echo %FILE_N% Exiting...
endlocal
set install_boost=done
goto:EOF
:bad_exit
if exist "%B_INSTALL_DIR%" rd /s /q "B_INSTALL_DIR"
echo %FILE_N% Exiting with error...
endlocal
goto:EOF

View File

@ -7,8 +7,24 @@ rem with the x64 Visual C++ Toolset enabled.
setlocal
:arg-parse
if not "%1"=="" (
if "%1"=="-j" (
set NUMBER_OF_ASYNC_JOBS=%2
shift
)
if "%1"=="--build-dir" (
set BUILD_DIR=%2
shift
)
shift
goto :arg-parse
)
if [%BUILD_DIR%] == [] set BUILD_DIR=.
if [%NUMBER_OF_ASYNC_JOBS%] == [] set NUMBER_OF_ASYNC_JOBS=1
set LOCAL_PATH=%~dp0
set BUILD_DIR=%1
set FILE_N=---%~n0%~x0:
set P_VERSION=v3.3.2
@ -17,6 +33,10 @@ set P_SRC_DIR=%BUILD_DIR%%P_SRC%
set P_INSTALL=protobuf-install
set P_INSTALL_DIR=%BUILD_DIR%%P_INSTALL%
if exist "%P_INSTALL_DIR%" (
goto already_build
)
if not exist "%P_SRC_DIR%" (
echo %FILE_N% Cloning Protobuf - version "%P_VERSION%"...
echo.
@ -26,10 +46,6 @@ if not exist "%P_SRC_DIR%" (
echo %FILE_N% Not cloning protobuf because already exists a folder called "%P_SRC%".
)
if exist "%P_INSTALL_DIR%" (
goto already_build
)
if not exist "%P_SRC_DIR%\cmake\build" (
echo %FILE_N% Creating "%P_SRC_DIR%\cmake\build"
mkdir %P_SRC_DIR%\cmake\build
@ -46,24 +62,45 @@ cmake -G "NMake Makefiles" ^
-DCMAKE_INSTALL_PREFIX=%P_INSTALL_DIR% ^
%P_SRC_DIR%\cmake
if errorlevel 1 goto error_cmake
echo %FILE_N% Building...
nmake & nmake install
if errorlevel 1 goto error_install
rem Remove the downloaded protobuf source because is no more needed
rem if you want to keep the source just delete the following command.
rem rd /s /q %P_SRC_DIR% 2>nul
goto success
:success
echo.
echo %FILE_N% Protobuf has been successfully installed in %P_INSTALL_DIR%!
goto eof
goto good_exit
:already_build
echo %FILE_N% Library has already been built.
echo %FILE_N% A Protobuf installation already exists.
echo %FILE_N% Delete "%P_INSTALL_DIR%" if you want to force a rebuild.
goto eof
goto good_exit
:eof
:error_cmake
echo %FILE_N% [ERROR] An error ocurred while executing the cmake.
goto bad_exit
:error_install
echo %FILE_N% [ERROR] An error ocurred while installing.
goto bad_exit
:good_exit
echo %FILE_N% Exiting...
endlocal
set install_proto=done
goto:EOF
:bad_exit
if exist "%B_INSTALL_DIR%" rd /s /q "B_INSTALL_DIR"
echo %FILE_N% Exiting with error...
endlocal
goto:EOF

View File

@ -61,7 +61,9 @@ if (UNIX)
elseif (WIN32)
# Setup boost.
include_directories("${CARLA_BOOST_INSTALL_PATH}")
# add_definitions(-DBOOST_AUTO_LINK_NOMANGLE)
# set(Boost_USE_STATIC_LIBS ON)
include_directories("${CARLA_BOOST_INSTALL_PATH}/boost-1_64")
file(GLOB Boost_System_Static_Libraries "${CARLA_BOOST_INSTALL_PATH}/lib/libboost_system*.lib")
file(GLOB Boost_DateTime_Static_Libraries "${CARLA_BOOST_INSTALL_PATH}/lib/libboost_date_time*.lib")
set(Boost_Static_Libraries