Added automatic Setup and Rebuild for Windows

This commit is contained in:
Marc Garcia Puig 2018-05-17 18:42:54 +02:00
parent 7946f8f02a
commit 7fd295c439
5 changed files with 261 additions and 13 deletions

View File

@ -1,18 +1,36 @@
@echo off
msg * "Sorry, this script is currently unavailable."
exit
setlocal
rem echo Deleting intermediate folders...
rem FOR %%G IN (Binaries,Intermediate,Plugins\Carla\Binaries,Plugins\Carla\Intermediate) DO (if exist %%G ( rmdir /s/q %%G ))
set LOCAL_PATH=%~dp0
rem echo Making CarlaServer...
rem call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
rem Visual Studio 2017 Enterprise:
rem call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
rem START /wait cmd.exe /k "cd Plugins\Carla & make clean default & pause & exit"
set LIB_FOLDER=%LOCAL_PATH%Util\Build\
set CARLA_FOLDER=%LOCAL_PATH%Unreal\CarlaUE4\
if not exist "%LIB_FOLDER%" (
echo Creating %LIB_FOLDER% folder...
mkdir %LIB_FOLDER%
)
echo Deleting intermediate folders...
for %%G in (
"%CARLA_FOLDER%Binaries",
"%CARLA_FOLDER%Intermediate",
"%CARLA_FOLDER%Plugins\Carla\Binaries",
"%CARLA_FOLDER%Plugins\Carla\Intermediate"
) do (
if exist %%G (
echo Deleting: %%G
rmdir /s/q %%G
)
)
rem echo Launch editor...
rem start CarlaUE4.uproject
echo.
echo Building carlaserver...
make clean & make
echo.
echo Launch editor...
start %CARLA_FOLDER%CarlaUE4.uproject
endlocal

82
Setup.cmd Normal file
View File

@ -0,0 +1,82 @@
@echo off
setlocal
set LOCAL_PATH=%~dp0
set INSTALLERS_DIR=%LOCAL_PATH%Util\InstallersWin\
set INSTALLATION_DIR=%LOCAL_PATH%Util\Build\
set VERSION_FILE=%LOCAL_PATH%Util\ContentVersions.txt
set CONTENT_DIR=%LOCAL_PATH%Unreal\CarlaUE4\Content
if not exist "%CONTENT_DIR%" (
echo Creating %CONTENT_DIR% folder...
mkdir %CONTENT_DIR%
)
echo.
echo Installing Protobuf...
call %INSTALLERS_DIR%install_proto.bat %INSTALLATION_DIR%
if not %install_proto%==done (
echo Failed while installing Protobuf.
goto failed
)
echo.
echo Installing Boost...
call %INSTALLERS_DIR%install_boost.bat %INSTALLATION_DIR%
if not %install_boost%==done (
echo Failed while installing Boost.
goto failed
)
FOR /F "tokens=2" %%i in (%VERSION_FILE%) do (
set HASH=%%i
)
set URL=https://drive.google.com/open?id=%HASH%
FOR /F "tokens=1 delims=:" %%i in (%VERSION_FILE%) do (
set ASSETS_VERSION=%%i
)
:success
echo.
echo.
echo #############################
echo # IMPORTANT #
echo #############################
echo.
echo All the CARLA library dependences should be installed now.
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 If you want another asset version, search it in %VERSION_FILE%.
echo You can download the assets from here:
echo.
echo %URL%
echo.
echo Unzip it in the "%CONTENT_DIR%" folder.
echo After that, please run the "Rebuild.bat".
goto eof
:failed
echo Ok, and error ocurred, don't panic!
echo We have different platforms where you can find some help :)
echo.
echo - First of all you can try to build CARLA manually:
echo http://carla.readthedocs.io/en/latest/how_to_build_on_windows/
echo.
echo - If the problem persists, you can ask on our Github's "Building on Windows" issue:
echo https://github.com/carla-simulator/carla/issues/21
echo.
echo - Or just use our Discord channel!
echo We'll be glad to help you there :)
echo https://discord.gg/vNVHXfb
goto eof
:eof
endlocal

View File

@ -0,0 +1,79 @@
@echo off
rem BAT script that downloads and installs a ready to use
rem boost build for CARLA (carla.org).
rem Just put it in `Util/Build` and run it.
setlocal
set LOCAL_PATH=%~dp0
set BUILD_DIR=%1
set FILE_N=---%~n0%~x0:
set B_VERSION=boost-1.64.0
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_TOOLSET=msvc-14.1
set B_LIB_DIR=%B_INSTALL_DIR%/lib
if not exist "%B_SRC_DIR%" (
echo %FILE_N% Cloning Boost - version "%B_VERSION%"...
echo.
call git clone --depth=1 -b %B_VERSION% ^
--recurse-submodules -j8 ^
https://github.com/boostorg/boost.git %B_SRC_DIR%
echo.
) else (
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%
echo %FILE_N% Generating build...
call bootstrap.bat
echo %FILE_N% Building...
b2 -j8 ^
headers ^
--with-system ^
--with-date_time ^
--build-dir=./build ^
architecture=x86 ^
address-model=64 ^
toolset=%B_TOOLSET% ^
variant=release ^
link=static ^
threading=multi ^
install ^
--prefix=%B_INSTALL_DIR% ^
--libdir=%B_LIB_DIR% ^
--includedir=%B_INSTALL_DIR%
cd %BUILD_DIR%
move "%B_INSTALL_DIR%/boost-1_64/boost" "%B_INSTALL_DIR%/"
rd /s /q "%B_INSTALL_DIR%/boost-1_64"
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
:success
echo.
echo %FILE_N% Boost has been successfully installed in %B_INSTALL_DIR%!
goto eof
:already_build
echo %FILE_N% Library has already been built.
echo %FILE_N% Delete "%B_INSTALL_DIR%" if you want to force a rebuild.
goto eof
:eof
echo %FILE_N% Exiting...
endlocal
set install_boost=done

View File

@ -0,0 +1,69 @@
@echo off
rem BAT script that downloads and installs a ready to use
rem protobuf build for CARLA (carla.org).
rem Just putit in `Util/Build` and run it through a cmd
rem with the x64 Visual C++ Toolset enabled.
setlocal
set LOCAL_PATH=%~dp0
set BUILD_DIR=%1
set FILE_N=---%~n0%~x0:
set P_VERSION=v3.3.2
set P_SRC=protobuf-src
set P_SRC_DIR=%BUILD_DIR%%P_SRC%
set P_INSTALL=protobuf-install
set P_INSTALL_DIR=%BUILD_DIR%%P_INSTALL%
if not exist "%P_SRC_DIR%" (
echo %FILE_N% Cloning Protobuf - version "%P_VERSION%"...
echo.
call git clone --depth=1 -b %P_VERSION% https://github.com/google/protobuf.git %P_SRC_DIR%
echo.
) else (
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
)
cd %P_SRC_DIR%\cmake\build
echo %FILE_N% Generating build...
cmake -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-Dprotobuf_BUILD_TESTS=OFF ^
-DCMAKE_CXX_FLAGS_RELEASE=/MD ^
-Dprotobuf_MSVC_STATIC_RUNTIME=OFF ^
-DCMAKE_INSTALL_PREFIX=%P_INSTALL_DIR% ^
%P_SRC_DIR%\cmake
echo %FILE_N% Building...
nmake & nmake 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
:success
echo.
echo %FILE_N% Protobuf has been successfully installed in %P_INSTALL_DIR%!
goto eof
:already_build
echo %FILE_N% Library has already been built.
echo %FILE_N% Delete "%P_INSTALL_DIR%" if you want to force a rebuild.
goto eof
:eof
echo %FILE_N% Exiting...
endlocal
set install_proto=done

View File

@ -62,8 +62,8 @@ elseif (WIN32)
# Setup boost.
include_directories("${CARLA_BOOST_INSTALL_PATH}")
file(GLOB Boost_System_Static_Libraries "${CARLA_BOOST_INSTALL_PATH}/stage/lib/libboost_system*.lib")
file(GLOB Boost_DateTime_Static_Libraries "${CARLA_BOOST_INSTALL_PATH}/stage/lib/libboost_date_time*.lib")
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
"${Boost_System_Static_Libraries}"
"${Boost_DateTime_Static_Libraries}")