Fix Windows build: Batch Files: proper handling of input, (back)slashes, spaces

This commit is contained in:
Philipp Dittmann 2020-06-16 15:26:43 +02:00 committed by bernat
parent ba63075f37
commit 20bb4c55bd
11 changed files with 150 additions and 134 deletions

View File

@ -5,7 +5,7 @@ rem BAT script that creates the binaries for Carla (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N=-[%~n0]:"
set FILE_N=-[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -43,9 +43,7 @@ if not "%1"=="" (
if %REMOVE_INTERMEDIATE% == false (
if %LAUNCH_UE4_EDITOR% == false (
if %BUILD_UE4_EDITOR% == false (
echo Nothing selected to be done.
echo %USAGE_STRING%
goto eof
goto help
)
)
)
@ -56,7 +54,7 @@ if not defined UE4_ROOT (
set VALUE_NAME=InstalledDirectory
for /f "usebackq tokens=1,2,*" %%A in (`reg query !KEY_NAME! /s /reg:64`) do (
if "%%A" == "!VALUE_NAME!" (
set UE4_ROOT=%%C
set UE4_ROOT=%%C\
)
)
if not defined UE4_ROOT goto error_unreal_no_found
@ -64,7 +62,7 @@ if not defined UE4_ROOT (
rem Set the visual studio solution directory
rem
set UE4_PROJECT_FOLDER=%ROOT_PATH%Unreal\CarlaUE4\
set UE4_PROJECT_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\
pushd "%UE4_PROJECT_FOLDER%"
rem Clear binaries and intermediates generated by the build system
@ -72,13 +70,13 @@ rem
if %REMOVE_INTERMEDIATE% == true (
rem Remove directories
for %%G in (
"%UE4_PROJECT_FOLDER:/=\%Binaries",
"%UE4_PROJECT_FOLDER:/=\%Build",
"%UE4_PROJECT_FOLDER:/=\%Saved",
"%UE4_PROJECT_FOLDER:/=\%Intermediate",
"%UE4_PROJECT_FOLDER:/=\%Plugins\Carla\Binaries",
"%UE4_PROJECT_FOLDER:/=\%Plugins\Carla\Intermediate",
"%UE4_PROJECT_FOLDER:/=\%.vs"
"%UE4_PROJECT_FOLDER%Binaries",
"%UE4_PROJECT_FOLDER%Build",
"%UE4_PROJECT_FOLDER%Saved",
"%UE4_PROJECT_FOLDER%Intermediate",
"%UE4_PROJECT_FOLDER%Plugins\Carla\Binaries",
"%UE4_PROJECT_FOLDER%Plugins\Carla\Intermediate",
"%UE4_PROJECT_FOLDER%.vs"
) do (
if exist %%G (
echo %FILE_N% Cleaning %%G
@ -88,7 +86,7 @@ if %REMOVE_INTERMEDIATE% == true (
rem Remove files
for %%G in (
"%UE4_PROJECT_FOLDER:/=\%CarlaUE4.sln"
"%UE4_PROJECT_FOLDER%CarlaUE4.sln"
) do (
if exist %%G (
echo %FILE_N% Cleaning %%G
@ -102,7 +100,7 @@ rem
if %BUILD_UE4_EDITOR% == true (
echo %FILE_N% Building Unreal Editor...
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
call "%UE4_ROOT%Engine\Build\BatchFiles\Build.bat"^
CarlaUE4Editor^
Win64^
Development^
@ -111,7 +109,7 @@ if %BUILD_UE4_EDITOR% == true (
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
if errorlevel 1 goto bad_exit
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
call "%UE4_ROOT%Engine\Build\BatchFiles\Build.bat"^
CarlaUE4^
Win64^
Development^

View File

@ -5,7 +5,7 @@ rem BAT script that creates the client and the server of LibCarla (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N=-[%~n0]:"
set FILE_N=-[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -15,7 +15,7 @@ rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
set DOC_STRING=Build LibCarla.
set "USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--server] [--client] [--clean]"
set USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--server] [--client] [--clean]
set REMOVE_INTERMEDIATE=false
set BUILD_SERVER=false
@ -66,16 +66,16 @@ rem ============================================================================
rem Set the visual studio solution directory
rem
set LIBCARLA_VSPROJECT_PATH=%INSTALLATION_DIR%libcarla-visualstudio
set LIBCARLA_VSPROJECT_PATH=%INSTALLATION_DIR:/=\%libcarla-visualstudio
set LIBCARLA_SERVER_INSTALL_PATH=%ROOT_PATH%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies
set LIBCARLA_CLIENT_INSTALL_PATH=%ROOT_PATH%PythonAPI\carla\dependencies
set LIBCARLA_SERVER_INSTALL_PATH=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies
set LIBCARLA_CLIENT_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies
if %REMOVE_INTERMEDIATE% == true (
rem Remove directories
for %%G in (
"%LIBCARLA_SERVER_INSTALL_PATH:/=\%",
"%LIBCARLA_CLIENT_INSTALL_PATH:/=\%",
"%LIBCARLA_SERVER_INSTALL_PATH%",
"%LIBCARLA_CLIENT_INSTALL_PATH%",
) do (
if exist %%G (
echo %FILE_N% Cleaning %%G
@ -103,8 +103,8 @@ 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%
-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:"
@ -117,8 +117,8 @@ 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%
-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:"

View File

@ -5,7 +5,7 @@ rem BAT script that creates the client python api of LibCarla (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N=-[%~n0]:"
set FILE_N=-[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*

View File

@ -6,7 +6,7 @@ rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
rem https://wiki.unrealengine.com/How_to_package_your_game_with_commands
set LOCAL_PATH=%~dp0
set "FILE_N=-[%~n0]:"
set FILE_N=-[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -47,6 +47,7 @@ if not "%1"=="" (
set DO_PACKAGE=false
set DO_COPY_FILES=false
set PACKAGES=%~2
shift
)
if "%1"=="-h" (

View File

@ -6,7 +6,7 @@ rem rpclib, gtest and boost libraries for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N=-[%~n0]:"
set FILE_N=-[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -25,9 +25,9 @@ rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
set BOOST_VERSION=1.72.0
set INSTALLERS_DIR=%ROOT_PATH%Util\InstallersWin\
set VERSION_FILE=%ROOT_PATH%Util\ContentVersions.txt
set CONTENT_DIR=%ROOT_PATH%Unreal\CarlaUE4\Content\Carla
set INSTALLERS_DIR=%ROOT_PATH:/=\%Util\InstallersWin\
set VERSION_FILE=%ROOT_PATH:/=\%Util\ContentVersions.txt
set CONTENT_DIR=%ROOT_PATH:/=\%Unreal\CarlaUE4\Content\Carla\
:arg-parse
if not "%1"=="" (
@ -48,10 +48,10 @@ if not "%1"=="" (
)
rem If not defined, use Visual Studio 2017 as tool set
if [%TOOLSET%] == [] set TOOLSET=msvc-14.1
if "%TOOLSET%" == "" set TOOLSET=msvc-14.1
rem If is not set, set the number of parallel jobs to the number of CPU threads
if [%NUMBER_OF_ASYNC_JOBS%] == [] set NUMBER_OF_ASYNC_JOBS=%NUMBER_OF_PROCESSORS%
if "%NUMBER_OF_ASYNC_JOBS%" == "" set NUMBER_OF_ASYNC_JOBS=%NUMBER_OF_PROCESSORS%
rem ============================================================================
rem -- Basic info and setup ----------------------------------------------------
@ -87,7 +87,7 @@ if not defined install_zlib (
echo %FILE_N% Failed while installing zlib.
goto failed
) else (
set ZLIB_INSTALL_DIR=%install_zlib:\=/%
set ZLIB_INSTALL_DIR=%install_zlib%
)
rem ============================================================================
@ -97,7 +97,7 @@ rem ============================================================================
echo %FILE_N% Installing libpng...
call "%INSTALLERS_DIR%install_libpng.bat"^
--build-dir "%INSTALLATION_DIR%"^
--zlib-install-dir "%INSTALLATION_DIR%\zlib-install"
--zlib-install-dir "%ZLIB_INSTALL_DIR%"
if %errorlevel% neq 0 goto failed
@ -105,7 +105,7 @@ if not defined install_libpng (
echo %FILE_N% Failed while installing libpng.
goto failed
) else (
set LIBPNG_INSTALL_DIR=%install_libpng:\=/%
set LIBPNG_INSTALL_DIR=%install_libpng%
)
rem ============================================================================
@ -182,15 +182,12 @@ rem ============================================================================
rem -- Assets download URL -----------------------------------------------------
rem ============================================================================
FOR /F "tokens=2" %%i in (%VERSION_FILE%) do (
set HASH=%%i
FOR /F "usebackq tokens=1,2" %%i in ("%VERSION_FILE%") do (
set ASSETS_VERSION=%%i
set HASH=%%j
)
set URL=http://carla-assets.s3.amazonaws.com/%HASH%.tar.gz
FOR /F "tokens=1 delims=:" %%i in (%VERSION_FILE%) do (
set ASSETS_VERSION=%%i
)
rem ============================================================================
rem -- Generate CMake ----------------------------------------------------------
rem ============================================================================
@ -200,7 +197,7 @@ set CMAKE_INSTALLATION_DIR=%INSTALLATION_DIR:\=/%
echo %FILE_N% Creating "CMakeLists.txt.in"...
set CMAKE_CONFIG_FILE="%INSTALLATION_DIR%CMakeLists.txt.in"
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%)
@ -234,12 +231,12 @@ set CMAKE_CONFIG_FILE="%INSTALLATION_DIR%CMakeLists.txt.in"
>>"%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 set(RECAST_INCLUDE_PATH "%RECAST_INSTALL_DIR%/include")
>>"%CMAKE_CONFIG_FILE%" echo set(RECAST_LIB_PATH "%RECAST_INSTALL_DIR%/lib")
>>"%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 set(RECAST_INCLUDE_PATH "%RECAST_INSTALL_DIR:\=/%/include")
>>"%CMAKE_CONFIG_FILE%" echo set(RECAST_LIB_PATH "%RECAST_INSTALL_DIR:\=/%/lib")
>>"%CMAKE_CONFIG_FILE%" echo endif ()
goto success

View File

@ -5,7 +5,7 @@ rem BAT script that downloads and installs a ready to use
rem boost build for CARLA (carla.org).
set LOCAL_PATH=%~dp0
set "FILE_N= -[%~n0]:"
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -18,18 +18,23 @@ rem ============================================================================
if not "%1"=="" (
if "%1"=="-j" (
set NUMBER_OF_ASYNC_JOBS=%~2
shift
)
if "%1"=="--build-dir" (
set BUILD_DIR=%~2
set BUILD_DIR=%~dpn2
shift
)
if "%1"=="--toolset" (
set TOOLSET=%~2
shift
)
if "%1"=="--version" (
set BOOST_VERSION=%~2
shift
)
if "%1"=="-v" (
set BOOST_VERSION=%~2
shift
)
if "%1"=="-h" (
goto help
@ -41,19 +46,20 @@ if not "%1"=="" (
goto :arg-parse
)
if [%BOOST_VERSION%] == [] (
if "%BOOST_VERSION%" == "" (
echo %FILE_N% You must specify a boost version using [-v^|--version]
goto bad_exit
)
rem If not set set the build dir to the current dir
if [%BUILD_DIR%] == [] set BUILD_DIR=%~dp0
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
rem If not defined, use Visual Studio 2017 as tool set
if [%TOOLSET%] == [] set TOOLSET=msvc-14.1
if "%TOOLSET%" == "" set TOOLSET=msvc-14.1
rem If is not set, set the number of parallel jobs to the number of CPU threads
if [%NUMBER_OF_ASYNC_JOBS%] == [] set NUMBER_OF_ASYNC_JOBS=%NUMBER_OF_PROCESSORS%
if "%NUMBER_OF_ASYNC_JOBS%" == "" set NUMBER_OF_ASYNC_JOBS=%NUMBER_OF_PROCESSORS%
rem ============================================================================
rem -- Local Variables ---------------------------------------------------------
@ -66,9 +72,9 @@ set BOOST_TEMP_FILE=%BOOST_TEMP_FOLDER%.zip
set BOOST_TEMP_FILE_DIR=%BUILD_DIR%%BOOST_TEMP_FILE%
set BOOST_REPO=https://dl.bintray.com/boostorg/release/%BOOST_VERSION%/source/%BOOST_TEMP_FILE%
set BOOST_SRC_DIR=%BUILD_DIR%%BOOST_BASENAME%-source
set BOOST_INSTALL_DIR=%BUILD_DIR%%BOOST_BASENAME%-install
set BOOST_LIB_DIR=%BOOST_INSTALL_DIR%\lib
set BOOST_SRC_DIR=%BUILD_DIR%%BOOST_BASENAME%-source\
set BOOST_INSTALL_DIR=%BUILD_DIR%%BOOST_BASENAME%-install\
set BOOST_LIB_DIR=%BOOST_INSTALL_DIR%lib
rem ============================================================================
rem -- Get Boost ---------------------------------------------------------------
@ -95,7 +101,7 @@ if not exist "%BOOST_SRC_DIR%" (
powershell -Command "Expand-Archive '%BOOST_TEMP_FILE_DIR%' -DestinationPath '%BUILD_DIR%' -Force"
)
echo %FILE_N% Removing "%BOOST_TEMP_FILE%"
del "%BOOST_TEMP_FILE_DIR:/=\%"
del "%BOOST_TEMP_FILE_DIR%"
rename "%BUILD_DIR%%BOOST_TEMP_FOLDER%" "%BOOST_BASENAME%-source"
) else (
echo %FILE_N% Not downloading boost because already exists the folder "%BOOST_SRC_DIR%".
@ -129,13 +135,13 @@ b2 -j%NUMBER_OF_ASYNC_JOBS%^
link=static^
runtime-link=shared^
threading=multi^
--prefix="%BOOST_INSTALL_DIR%"^
--libdir="%BOOST_LIB_DIR%"^
--includedir="%BOOST_INSTALL_DIR%"^
--prefix="%BOOST_INSTALL_DIR:~0,-1%"^
--libdir="%BOOST_LIB_DIR:~0,-1%"^
--includedir="%BOOST_INSTALL_DIR:~0,-1%"^
install
if %errorlevel% neq 0 goto error_install
for /d %%i in ("%BOOST_INSTALL_DIR%\boost*") do rename "%%i" include
for /d %%i in ("%BOOST_INSTALL_DIR%boost*") do rename "%%i" include
goto success
rem ============================================================================

View File

@ -6,7 +6,7 @@ rem Google Test build for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N= -[%~n0]:"
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -15,13 +15,12 @@ rem ============================================================================
rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
set BUILD_DIR=.
set DEL_SRC=false
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~2
set BUILD_DIR=%~dpn2
shift
)
@ -33,12 +32,16 @@ if not "%1"=="" (
goto :arg-parse
)
rem If not set set the build dir to the current dir
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
set GT_VERSION=release-1.8.1
set GT_SRC=gtest-src
set GT_SRC_DIR=%BUILD_DIR%%GT_SRC%\
set GT_INSTALL=gtest-install
set GT_INSTALL_DIR=%BUILD_DIR%%GT_INSTALL%\
set GT_BUILD_DIR=%GT_SRC_DIR%build
set GT_BUILD_DIR=%GT_SRC_DIR%build\
if exist "%GT_INSTALL_DIR%" (
goto already_build
@ -47,7 +50,7 @@ if exist "%GT_INSTALL_DIR%" (
if not exist "%GT_SRC_DIR%" (
echo %FILE_N% Cloning Google Test - version "%GT_VERSION%"...
call git clone --depth=1 -b %GT_VERSION% https://github.com/google/googletest.git %GT_SRC_DIR%
call git clone --depth=1 -b "%GT_VERSION%" https://github.com/google/googletest.git "%GT_SRC_DIR:~0,-1%"
if %errorlevel% neq 0 goto error_git
) else (
echo %FILE_N% Not cloning Google Test because already exists a folder called "%GT_SRC%".
@ -64,9 +67,9 @@ echo %FILE_N% Generating build...
cmake .. -G "Visual Studio 15 2017 Win64"^
-DCMAKE_BUILD_TYPE=Release^
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
-DCMAKE_INSTALL_PREFIX=%GT_INSTALL_DIR%^
-DCMAKE_INSTALL_PREFIX="%GT_INSTALL_DIR:\=/%"^
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING^
%GT_SRC_DIR%
"%GT_SRC_DIR%"
if %errorlevel% neq 0 goto error_cmake
echo %FILE_N% Building...

View File

@ -6,7 +6,7 @@ rem x64 libpng build for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N= -[%~n0]:"
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -18,10 +18,12 @@ rem ============================================================================
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~2
set BUILD_DIR=%~dpn2
shift
)
if "%1"=="--zlib-install-dir" (
set ZLIB_INST_DIR=%~2
set ZLIB_INST_DIR=%~dpn2
shift
)
if "%1"=="-h" (
goto help
@ -33,15 +35,15 @@ if not "%1"=="" (
goto :arg-parse
)
if [%ZLIB_INST_DIR%] == [] (
if "%ZLIB_INST_DIR%" == "" (
echo %FILE_N% You must specify a zlib install directory using [--zlib-install-dir]
goto bad_exit
)
set ZLIB_INST_DIR=%ZLIB_INST_DIR:/=\%
if not "%ZLIB_INST_DIR:~-1%"=="\" set ZLIB_INST_DIR=%ZLIB_INST_DIR%\
rem If not set set the build dir to the current dir
if [%BUILD_DIR%] == [] set BUILD_DIR=%~dp0
set BUILD_DIR=%BUILD_DIR:/=\%
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
rem ============================================================================
rem -- Local Variables ---------------------------------------------------------
@ -60,9 +62,9 @@ set LIBPNG_TEMP_FILE_DIR=%BUILD_DIR%%LIBPNG_TEMP_FILE%
set LIBPNG_REPO=http://downloads.sourceforge.net/gnuwin32/libpng-%LIBPNG_VERSION%-src.zip
rem ../libpng-x.x.x-source/
set LIBPNG_SRC_DIR=%BUILD_DIR%%LIBPNG_BASENAME%-%LIBPNG_VERSION%-source
set LIBPNG_SRC_DIR=%BUILD_DIR%%LIBPNG_BASENAME%-%LIBPNG_VERSION%-source\
rem ../libpng-x.x.x-install/
set LIBPNG_INSTALL_DIR=%BUILD_DIR%%LIBPNG_BASENAME%-%LIBPNG_VERSION%-install
set LIBPNG_INSTALL_DIR=%BUILD_DIR%%LIBPNG_BASENAME%-%LIBPNG_VERSION%-install\
rem ============================================================================
rem -- Get libpng --------------------------------------------------------------
@ -89,11 +91,11 @@ if not exist "%LIBPNG_SRC_DIR%" (
rem Remove unnecessary files and folders
echo %FILE_N% Removing "%LIBPNG_TEMP_FILE%"
del "%LIBPNG_TEMP_FILE_DIR:/=\%"
echo %FILE_N% Removing dir "%BUILD_DIR:/=\%manifest"
rmdir /s/q "%BUILD_DIR:/=\%manifest"
del "%LIBPNG_TEMP_FILE_DIR%"
echo %FILE_N% Removing dir "%BUILD_DIR%manifest"
rmdir /s/q "%BUILD_DIR%manifest"
rename "%BUILD_DIR:/=\%src" "%LIBPNG_BASENAME%-%LIBPNG_VERSION%-source"
rename "%BUILD_DIR%src" "%LIBPNG_BASENAME%-%LIBPNG_VERSION%-source"
) else (
echo %FILE_N% Not downloading libpng because already exists the folder "%LIBPNG_SRC_DIR%".
)
@ -102,35 +104,35 @@ rem ============================================================================
rem -- Compile libpng ----------------------------------------------------------
rem ============================================================================
set LIBPNG_SOURCE_DIR=%LIBPNG_SRC_DIR%\libpng\%LIBPNG_VERSION%\libpng-%LIBPNG_VERSION%-src\
set LIBPNG_SOURCE_DIR=%LIBPNG_SRC_DIR%libpng\%LIBPNG_VERSION%\libpng-%LIBPNG_VERSION%-src\
if not exist "%LIBPNG_SRC_DIR%\build" (
echo %FILE_N% Creating "%LIBPNG_SRC_DIR%\build"
mkdir "%LIBPNG_SRC_DIR%\build"
if not exist "%LIBPNG_SRC_DIR%build" (
echo %FILE_N% Creating "%LIBPNG_SRC_DIR%build"
mkdir "%LIBPNG_SRC_DIR%build"
)
cd "%LIBPNG_SRC_DIR%\build"
cd "%LIBPNG_SRC_DIR%build"
cl /nologo /c /O2 /MD /Z7 /EHsc /MP /W2 /TP /GR /Gm-^
-DWIN32 -DNDEBUG -D_CRT_SECURE_NO_WARNINGS -DPNG_NO_MMX_CODE^
/I"%ZLIB_INST_DIR%\include"^
"%LIBPNG_SOURCE_DIR:/=\%\*.c"
/I"%ZLIB_INST_DIR%include"^
"%LIBPNG_SOURCE_DIR%*.c"
if not exist "%LIBPNG_INSTALL_DIR%\lib" (
echo %FILE_N% Creating "%LIBPNG_INSTALL_DIR%\lib"
mkdir "%LIBPNG_INSTALL_DIR%\lib"
if not exist "%LIBPNG_INSTALL_DIR%lib" (
echo %FILE_N% Creating "%LIBPNG_INSTALL_DIR%lib"
mkdir "%LIBPNG_INSTALL_DIR%lib"
)
if not exist "%LIBPNG_INSTALL_DIR%\include" (
echo %FILE_N% Creating "%LIBPNG_INSTALL_DIR%\include"
mkdir "%LIBPNG_INSTALL_DIR%\include"
if not exist "%LIBPNG_INSTALL_DIR%include" (
echo %FILE_N% Creating "%LIBPNG_INSTALL_DIR%include"
mkdir "%LIBPNG_INSTALL_DIR%include"
)
lib /nologo /MACHINE:X64 /LTCG /OUT:"%LIBPNG_INSTALL_DIR%\lib\libpng.lib"^
/LIBPATH:"%ZLIB_INST_DIR%\lib" "*.obj" "zlibstatic.lib"
lib /nologo /MACHINE:X64 /LTCG /OUT:"%LIBPNG_INSTALL_DIR%lib\libpng.lib"^
/LIBPATH:"%ZLIB_INST_DIR%lib" "*.obj" "zlibstatic.lib"
copy "%LIBPNG_SOURCE_DIR%\png.h" "%LIBPNG_INSTALL_DIR%\include\png.h"
copy "%LIBPNG_SOURCE_DIR%\pngconf.h" "%LIBPNG_INSTALL_DIR%\include\pngconf.h"
copy "%LIBPNG_SOURCE_DIR%png.h" "%LIBPNG_INSTALL_DIR%include\png.h"
copy "%LIBPNG_SOURCE_DIR%pngconf.h" "%LIBPNG_INSTALL_DIR%include\pngconf.h"
goto success

View File

@ -5,7 +5,7 @@ rem BAT script that downloads and installs Recast & Detour library
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N= -[%~n0]:"
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -14,13 +14,12 @@ rem ============================================================================
rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
set BUILD_DIR=.
set DEL_SRC=false
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~2
set BUILD_DIR=%~dpn2
shift
)
@ -32,13 +31,17 @@ if not "%1"=="" (
goto :arg-parse
)
rem If not set set the build dir to the current dir
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
set RECAST_HASH=cdce4e
set RECAST_COMMIT=cdce4e1a270fdf1f3942d4485954cc5e136df1df
set RECAST_SRC=recast-%RECAST_HASH%-src
set RECAST_SRC_DIR=%BUILD_DIR%%RECAST_SRC%\
set RECAST_INSTALL=recast-%RECAST_HASH%-install
set RECAST_INSTALL_DIR=%BUILD_DIR%%RECAST_INSTALL%\
set RECAST_BUILD_DIR=%RECAST_SRC_DIR%build
set RECAST_BUILD_DIR=%RECAST_SRC_DIR%build\
set RECAST_BASENAME=%RECAST_SRC%
if exist "%RECAST_INSTALL_DIR%" (
@ -48,8 +51,8 @@ if exist "%RECAST_INSTALL_DIR%" (
if not exist "%RECAST_SRC_DIR%" (
echo %FILE_N% Cloning "Recast & Detour"
call git clone https://github.com/carla-simulator/recastnavigation.git %RECAST_SRC_DIR%
cd %RECAST_SRC_DIR%
call git clone https://github.com/carla-simulator/recastnavigation.git "%RECAST_SRC_DIR:~0,-1%"
cd "%RECAST_SRC_DIR%"
call git reset --hard %RECAST_COMMIT%
cd ..
if %errorlevel% neq 0 goto error_git
@ -68,9 +71,9 @@ echo %FILE_N% Generating build...
cmake .. -G "Visual Studio 15 2017 Win64"^
-DCMAKE_BUILD_TYPE=Release^
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
-DCMAKE_INSTALL_PREFIX=%RECAST_INSTALL_DIR%^
-DCMAKE_INSTALL_PREFIX="%RECAST_INSTALL_DIR:\=/%"^
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING^
%RECAST_SRC_DIR%
"%RECAST_SRC_DIR%"
if %errorlevel% neq 0 goto error_cmake
echo %FILE_N% Building...
@ -83,8 +86,8 @@ if %DEL_SRC% == true (
rd /s /q "%RECAST_SRC_DIR%"
)
md "%RECAST_INSTALL_DIR%include\\recast"
move "%RECAST_INSTALL_DIR%include\\*.h" "%RECAST_INSTALL_DIR%include\\recast"
md "%RECAST_INSTALL_DIR%include\recast"
move "%RECAST_INSTALL_DIR%include\*.h" "%RECAST_INSTALL_DIR%include\recast"
goto success

View File

@ -6,7 +6,7 @@ rem rpclib build for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N= -[%~n0]:"
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -15,13 +15,12 @@ rem ============================================================================
rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
set BUILD_DIR=.
set DEL_SRC=false
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~2
set BUILD_DIR=%~dpn2
shift
)
@ -33,14 +32,18 @@ if not "%1"=="" (
goto :arg-parse
)
rem If not set set the build dir to the current dir
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
set RPC_VERSION=v2.2.1_c2
set RPC_SRC=rpclib-src
set RPC_SRC_DIR=%BUILD_DIR%%RPC_SRC%\
set RPC_INSTALL=rpclib-install
set RPC_INSTALL_DIR=%BUILD_DIR%%RPC_INSTALL%\
set RPC_BUILD_DIR=%RPC_SRC_DIR%build
set RPC_BUILD_DIR=%RPC_SRC_DIR%build\
set PUSHD_RPC=%RPC_SRC_DIR:\=/%
set PUSHD_RPC=%RPC_SRC_DIR%
if exist "%RPC_INSTALL_DIR%" (
goto already_build
@ -49,7 +52,8 @@ if exist "%RPC_INSTALL_DIR%" (
if not exist "%RPC_SRC_DIR%" (
echo %FILE_N% Cloning rpclib - version "%RPC_VERSION%"...
call git clone -b %RPC_VERSION% https://github.com/carla-simulator/rpclib.git %RPC_SRC_DIR%
echo git clone -b "%RPC_VERSION%" https://github.com/carla-simulator/rpclib.git "%RPC_SRC_DIR:~0,-1%"
call git clone -b "%RPC_VERSION%" https://github.com/carla-simulator/rpclib.git "%RPC_SRC_DIR:~0,-1%"
if %errorlevel% neq 0 goto error_git
) else (
echo %FILE_N% Not cloning rpclib because already exists a folder called "%RPC_SRC%".
@ -67,8 +71,8 @@ cmake .. -G "Visual Studio 15 2017 Win64"^
-DCMAKE_BUILD_TYPE=Release^
-DRPCLIB_BUILD_EXAMPLES=OFF^
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
-DCMAKE_INSTALL_PREFIX=%RPC_INSTALL_DIR%^
%RPC_SRC_DIR%
-DCMAKE_INSTALL_PREFIX="%RPC_INSTALL_DIR:\=/%"^
"%RPC_SRC_DIR%"
if %errorlevel% neq 0 goto error_cmake
echo %FILE_N% Building...
@ -126,8 +130,7 @@ rem ============================================================================
:good_exit
echo %FILE_N% Exiting...
endlocal
set install_rpclib=done
endlocal & set install_rpclib=done
exit /b 0
:bad_exit

View File

@ -6,7 +6,7 @@ rem x64 zlib build for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set "FILE_N= -[%~n0]:"
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
@ -18,10 +18,12 @@ rem ============================================================================
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~2
set BUILD_DIR=%~dpn2
shift
)
if "%1"=="--toolset" (
set TOOLSET=%~2
shift
)
if "%1"=="-h" (
goto help
@ -34,10 +36,11 @@ if not "%1"=="" (
)
rem If not set set the build dir to the current dir
if [%BUILD_DIR%] == [] set BUILD_DIR=%~dp0
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
rem If not defined, use Visual Studio 2017 as tool set
if [%TOOLSET%] == [] set TOOLSET=""
if "%TOOLSET%" == "" set TOOLSET=""
rem ============================================================================
rem -- Local Variables ---------------------------------------------------------
@ -52,8 +55,8 @@ set ZLIB_TEMP_FILE_DIR=%BUILD_DIR%%ZLIB_TEMP_FILE%
set ZLIB_REPO=http://www.zlib.net/zlib%ZLIB_VERSION:.=%.zip
set ZLIB_SRC_DIR=%BUILD_DIR%%ZLIB_BASENAME%-source
set ZLIB_INSTALL_DIR=%BUILD_DIR%%ZLIB_BASENAME%-install
set ZLIB_SRC_DIR=%BUILD_DIR%%ZLIB_BASENAME%-source\
set ZLIB_INSTALL_DIR=%BUILD_DIR%%ZLIB_BASENAME%-install\
rem ============================================================================
rem -- Get zlib ---------------------------------------------------------------
@ -76,23 +79,23 @@ if not exist "%ZLIB_SRC_DIR%" (
rem Remove the no longer needed downloaded file
echo %FILE_N% Removing "%ZLIB_TEMP_FILE%"
del "%ZLIB_TEMP_FILE_DIR:/=\%"
del "%ZLIB_TEMP_FILE_DIR%"
rename "%BUILD_DIR%%ZLIB_TEMP_FOLDER%" "%ZLIB_BASENAME%-source"
) else (
echo %FILE_N% Not downloading zlib because already exists the folder "%ZLIB_SRC_DIR%".
)
if not exist "%ZLIB_SRC_DIR%\build" (
echo %FILE_N% Creating "%ZLIB_SRC_DIR%\build"
mkdir "%ZLIB_SRC_DIR%\build"
if not exist "%ZLIB_SRC_DIR%build" (
echo %FILE_N% Creating "%ZLIB_SRC_DIR%build"
mkdir "%ZLIB_SRC_DIR%build"
)
cd "%ZLIB_SRC_DIR%\build"
cd "%ZLIB_SRC_DIR%build"
rem -DCMAKE_BUILD_TYPE=Release^
rem -DCMAKE_CONFIGURATION_TYPES=Release^
cmake -G "NMake Makefiles"^
-DCMAKE_INSTALL_PREFIX="%ZLIB_INSTALL_DIR%"^
-DCMAKE_INSTALL_PREFIX="%ZLIB_INSTALL_DIR:\=/%"^
-DCMAKE_BUILD_TYPE=Release^
"%ZLIB_SRC_DIR%"
if %errorlevel% neq 0 goto error_cmake