2018-05-18 00:42:54 +08:00
|
|
|
@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
|
|
|
|
|
2018-07-30 22:52:29 +08:00
|
|
|
set LOCAL_PATH=%~dp0
|
|
|
|
set "FILE_N= -[%~n0]:"
|
|
|
|
|
2018-05-22 22:50:32 +08:00
|
|
|
:arg-parse
|
|
|
|
if not "%1"=="" (
|
|
|
|
if "%1"=="-j" (
|
2018-07-27 22:16:58 +08:00
|
|
|
set NUMBER_OF_ASYNC_JOBS=%~2
|
2018-05-22 22:50:32 +08:00
|
|
|
shift
|
|
|
|
)
|
|
|
|
if "%1"=="--build-dir" (
|
2018-07-27 22:16:58 +08:00
|
|
|
set BUILD_DIR=%~2
|
2018-05-22 22:50:32 +08:00
|
|
|
shift
|
|
|
|
)
|
|
|
|
if "%1"=="--toolset" (
|
2018-07-27 22:16:58 +08:00
|
|
|
set B_TOOLSET=%~2
|
2018-05-22 22:50:32 +08:00
|
|
|
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
|
|
|
|
|
2018-07-26 18:17:04 +08:00
|
|
|
set B_VERSION=boost-1.67.0
|
2018-05-18 00:42:54 +08:00
|
|
|
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%
|
2018-05-22 22:50:32 +08:00
|
|
|
set B_LIB_DIR=%B_INSTALL_DIR%\lib
|
2018-05-18 00:42:54 +08:00
|
|
|
|
2018-05-22 22:50:32 +08:00
|
|
|
if exist "%B_INSTALL_DIR%" (
|
2018-07-26 15:37:11 +08:00
|
|
|
goto already_build
|
2018-05-22 22:50:32 +08:00
|
|
|
)
|
2018-05-18 00:42:54 +08:00
|
|
|
|
|
|
|
if not exist "%B_SRC_DIR%" (
|
2018-07-26 15:37:11 +08:00
|
|
|
echo %FILE_N% Cloning Boost - version "%B_VERSION%"...
|
|
|
|
echo.
|
|
|
|
|
2018-07-30 22:52:29 +08:00
|
|
|
rem call git clone --depth=1 -b %B_VERSION% --recurse-submodules -j8 https://github.com/boostorg/boost.git %B_SRC_DIR%
|
|
|
|
rem clone master as there is bug in 1.67 related to python boost (https://github.com/boostorg/python/issues/193)
|
|
|
|
|
|
|
|
call git clone --depth=1 --recurse-submodules -j8 https://github.com/boostorg/boost.git %B_SRC_DIR%
|
2018-07-26 15:37:11 +08:00
|
|
|
if errorlevel 1 goto error_git
|
2018-05-18 00:42:54 +08:00
|
|
|
) else (
|
2018-07-26 15:37:11 +08:00
|
|
|
echo %FILE_N% Not cloning boost because already exists a folder called "%B_SRC%".
|
2018-05-18 00:42:54 +08:00
|
|
|
)
|
|
|
|
|
2018-07-27 22:16:58 +08:00
|
|
|
cd "%B_SRC_DIR%"
|
2018-05-22 22:50:32 +08:00
|
|
|
if not exist "b2.exe" (
|
2018-07-26 15:37:11 +08:00
|
|
|
echo %FILE_N% Generating build...
|
|
|
|
call bootstrap.bat
|
2018-05-18 00:42:54 +08:00
|
|
|
)
|
|
|
|
|
2018-05-22 22:50:32 +08:00
|
|
|
if errorlevel 1 goto error_bootstrap
|
|
|
|
|
|
|
|
echo %FILE_N% Packing headers...
|
2018-07-30 22:52:29 +08:00
|
|
|
b2 headers link=static
|
2018-05-18 00:42:54 +08:00
|
|
|
|
|
|
|
echo %FILE_N% Building...
|
2018-05-24 01:59:42 +08:00
|
|
|
b2 -j8^
|
2018-07-26 15:37:11 +08:00
|
|
|
headers^
|
|
|
|
--layout=versioned^
|
|
|
|
--build-dir=./build^
|
|
|
|
architecture=x86^
|
|
|
|
address-model=64^
|
|
|
|
toolset=%B_TOOLSET%^
|
|
|
|
variant=release^
|
|
|
|
link=static^
|
2018-07-30 22:52:29 +08:00
|
|
|
runtime-link=static^
|
2018-07-26 15:37:11 +08:00
|
|
|
threading=multi^
|
2018-07-27 22:16:58 +08:00
|
|
|
--prefix="%B_INSTALL_DIR%"^
|
|
|
|
--libdir="%B_LIB_DIR%"^
|
|
|
|
--includedir="%B_INSTALL_DIR%"^
|
2018-07-26 15:37:11 +08:00
|
|
|
install
|
2018-05-18 00:42:54 +08:00
|
|
|
|
2018-05-22 22:50:32 +08:00
|
|
|
if errorlevel 1 goto error_install
|
|
|
|
|
2018-07-27 22:16:58 +08:00
|
|
|
for /d %%i in ("%B_INSTALL_DIR%\boost-*") do rename "%%i" include
|
|
|
|
cd "%BUILD_DIR%"
|
2018-05-18 00:42:54 +08:00
|
|
|
|
|
|
|
rem Remove the downloaded protobuf source because is no more needed
|
|
|
|
rem if you want to keep the source just delete the following command.
|
2018-05-23 22:01:17 +08:00
|
|
|
rem @rd /s /q %B_SRC_DIR%
|
2018-05-18 00:42:54 +08:00
|
|
|
|
2018-05-22 22:50:32 +08:00
|
|
|
goto success
|
|
|
|
|
2018-05-18 00:42:54 +08:00
|
|
|
:success
|
2018-07-26 15:37:11 +08:00
|
|
|
echo.
|
2018-07-27 22:16:58 +08:00
|
|
|
echo %FILE_N% Boost has been successfully installed in "%B_INSTALL_DIR%"!
|
2018-07-26 15:37:11 +08:00
|
|
|
goto good_exit
|
2018-05-18 00:42:54 +08:00
|
|
|
|
|
|
|
:already_build
|
2018-07-26 15:37:11 +08:00
|
|
|
echo %FILE_N% A Boost installation already exists.
|
|
|
|
echo %FILE_N% Delete "%B_INSTALL_DIR%" if you want to force a rebuild.
|
|
|
|
goto good_exit
|
2018-05-18 00:42:54 +08:00
|
|
|
|
2018-05-23 22:01:17 +08:00
|
|
|
:error_git
|
2018-07-26 15:37:11 +08:00
|
|
|
echo.
|
|
|
|
echo %FILE_N% [GIT ERROR] An error ocurred while executing the git.
|
|
|
|
echo %FILE_N% [GIT ERROR] Possible causes:
|
|
|
|
echo %FILE_N% - Make sure "git" is installed.
|
|
|
|
echo %FILE_N% - Make sure it is available on your Windows "path".
|
|
|
|
goto bad_exit
|
2018-05-23 22:01:17 +08:00
|
|
|
|
2018-05-22 22:50:32 +08:00
|
|
|
:error_bootstrap
|
2018-07-26 15:37:11 +08:00
|
|
|
echo.
|
|
|
|
echo %FILE_N% [BOOTSTRAP ERROR] An error ocurred while executing "bootstrap.bat".
|
|
|
|
goto bad_exit
|
2018-05-22 22:50:32 +08:00
|
|
|
|
|
|
|
:error_install
|
2018-07-26 15:37:11 +08:00
|
|
|
echo.
|
|
|
|
echo %FILE_N% [B2 ERROR] An error ocurred while installing using "b2.exe".
|
|
|
|
goto bad_exit
|
2018-05-22 22:50:32 +08:00
|
|
|
|
|
|
|
:good_exit
|
2018-07-26 15:37:11 +08:00
|
|
|
echo %FILE_N% Exiting...
|
|
|
|
endlocal
|
|
|
|
set install_boost=done
|
|
|
|
goto:EOF
|
2018-05-22 22:50:32 +08:00
|
|
|
|
|
|
|
:bad_exit
|
2018-07-27 22:16:58 +08:00
|
|
|
if exist "%B_INSTALL_DIR%" rd /s /q "%B_INSTALL_DIR%"
|
2018-07-26 15:37:11 +08:00
|
|
|
echo %FILE_N% Exiting with error...
|
|
|
|
endlocal
|
|
|
|
goto:EOF
|