2018-07-27 22:16:58 +08:00
|
|
|
@echo off
|
2020-04-24 18:21:15 +08:00
|
|
|
setlocal enabledelayedexpansion
|
2018-07-27 22:16:58 +08:00
|
|
|
|
2018-08-24 20:58:46 +08:00
|
|
|
rem BAT script that creates the binaries for Carla (carla.org).
|
|
|
|
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
|
|
|
|
|
2018-07-27 22:16:58 +08:00
|
|
|
set LOCAL_PATH=%~dp0
|
2018-07-31 22:35:02 +08:00
|
|
|
set "FILE_N=-[%~n0]:"
|
2018-07-27 22:16:58 +08:00
|
|
|
|
2018-08-29 18:24:30 +08:00
|
|
|
rem Print batch params (debug purpose)
|
|
|
|
echo %FILE_N% [Batch params]: %*
|
|
|
|
|
2018-07-27 22:16:58 +08:00
|
|
|
rem ============================================================================
|
|
|
|
rem -- Parse arguments ---------------------------------------------------------
|
|
|
|
rem ============================================================================
|
|
|
|
|
2020-04-24 18:21:15 +08:00
|
|
|
set UE_VERSION=4.24
|
2020-03-05 20:16:18 +08:00
|
|
|
set BUILD_UE4_EDITOR=false
|
2018-07-27 22:16:58 +08:00
|
|
|
set LAUNCH_UE4_EDITOR=false
|
|
|
|
set REMOVE_INTERMEDIATE=false
|
|
|
|
|
|
|
|
:arg-parse
|
2020-03-05 20:16:18 +08:00
|
|
|
echo %1
|
2018-07-27 22:16:58 +08:00
|
|
|
if not "%1"=="" (
|
2020-03-05 20:16:18 +08:00
|
|
|
if "%1"=="--build" (
|
|
|
|
set BUILD_UE4_EDITOR=true
|
|
|
|
)
|
2019-02-06 00:33:09 +08:00
|
|
|
if "%1"=="--launch" (
|
2018-07-27 22:16:58 +08:00
|
|
|
set LAUNCH_UE4_EDITOR=true
|
|
|
|
)
|
|
|
|
if "%1"=="--clean" (
|
|
|
|
set REMOVE_INTERMEDIATE=true
|
|
|
|
)
|
|
|
|
if "%1"=="-h" (
|
2019-02-06 00:33:09 +08:00
|
|
|
goto help
|
2018-07-27 22:16:58 +08:00
|
|
|
)
|
|
|
|
if "%1"=="--help" (
|
2019-02-06 00:33:09 +08:00
|
|
|
goto help
|
2018-07-27 22:16:58 +08:00
|
|
|
)
|
|
|
|
shift
|
2019-02-06 00:33:09 +08:00
|
|
|
goto arg-parse
|
2018-07-27 22:16:58 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if %REMOVE_INTERMEDIATE% == false (
|
|
|
|
if %LAUNCH_UE4_EDITOR% == false (
|
2020-03-05 20:16:18 +08:00
|
|
|
if %BUILD_UE4_EDITOR% == false (
|
|
|
|
echo Nothing selected to be done.
|
|
|
|
echo %USAGE_STRING%
|
|
|
|
goto eof
|
|
|
|
)
|
2018-07-27 22:16:58 +08:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2020-04-24 18:21:15 +08:00
|
|
|
rem Extract Unreal Engine root path
|
|
|
|
if not defined UE4_ROOT (
|
|
|
|
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\EpicGames\Unreal Engine\%UE_VERSION%"
|
|
|
|
set VALUE_NAME=InstalledDirectory
|
|
|
|
for /f "usebackq tokens=2*" %%A in (`reg query !KEY_NAME! /v !VALUE_NAME! /reg:64`) do set UE4_ROOT=%%B
|
|
|
|
if not defined UE4_ROOT goto error_unreal_no_found
|
|
|
|
)
|
|
|
|
|
2018-08-24 20:58:46 +08:00
|
|
|
rem Set the visual studio solution directory
|
|
|
|
rem
|
2019-02-06 00:33:09 +08:00
|
|
|
set UE4_PROJECT_FOLDER=%ROOT_PATH%Unreal\CarlaUE4\
|
|
|
|
pushd "%UE4_PROJECT_FOLDER%"
|
2018-07-27 22:16:58 +08:00
|
|
|
|
2018-08-24 20:58:46 +08:00
|
|
|
rem Clear binaries and intermediates generated by the build system
|
|
|
|
rem
|
2018-07-27 22:16:58 +08:00
|
|
|
if %REMOVE_INTERMEDIATE% == true (
|
2019-02-08 21:38:12 +08:00
|
|
|
rem Remove directories
|
2019-02-06 00:33:09 +08:00
|
|
|
for %%G in (
|
2019-02-08 21:38:12 +08:00
|
|
|
"%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"
|
2019-02-06 00:33:09 +08:00
|
|
|
) do (
|
|
|
|
if exist %%G (
|
2019-02-08 21:38:12 +08:00
|
|
|
echo %FILE_N% Cleaning %%G
|
2019-02-06 00:33:09 +08:00
|
|
|
rmdir /s/q %%G
|
|
|
|
)
|
|
|
|
)
|
2019-02-08 21:38:12 +08:00
|
|
|
|
|
|
|
rem Remove files
|
|
|
|
for %%G in (
|
|
|
|
"%UE4_PROJECT_FOLDER:/=\%CarlaUE4.sln"
|
|
|
|
) do (
|
|
|
|
if exist %%G (
|
|
|
|
echo %FILE_N% Cleaning %%G
|
|
|
|
del %%G
|
|
|
|
)
|
|
|
|
)
|
2018-08-24 16:43:22 +08:00
|
|
|
)
|
|
|
|
|
2020-03-05 20:16:18 +08:00
|
|
|
rem Build Carla Editor
|
|
|
|
rem
|
|
|
|
if %BUILD_UE4_EDITOR% == true (
|
|
|
|
echo %FILE_N% Building Unreal Editor...
|
|
|
|
|
|
|
|
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
|
|
|
|
CarlaUE4Editor^
|
|
|
|
Win64^
|
|
|
|
Development^
|
|
|
|
-WaitMutex^
|
|
|
|
-FromMsBuild^
|
|
|
|
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
|
|
|
if errorlevel 1 goto bad_exit
|
|
|
|
|
|
|
|
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
|
|
|
|
CarlaUE4^
|
|
|
|
Win64^
|
|
|
|
Development^
|
|
|
|
-WaitMutex^
|
|
|
|
-FromMsBuild^
|
|
|
|
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
|
|
|
if errorlevel 1 goto bad_exit
|
|
|
|
)
|
|
|
|
|
2018-08-24 20:58:46 +08:00
|
|
|
rem Launch Carla Editor
|
|
|
|
rem
|
2018-07-27 22:16:58 +08:00
|
|
|
if %LAUNCH_UE4_EDITOR% == true (
|
|
|
|
echo %FILE_N% Launching Unreal Editor...
|
2019-02-06 00:33:09 +08:00
|
|
|
call "%UE4_PROJECT_FOLDER%CarlaUE4.uproject"
|
|
|
|
if %errorlevel% neq 0 goto error_build
|
2018-07-27 22:16:58 +08:00
|
|
|
)
|
|
|
|
|
2018-08-24 00:08:06 +08:00
|
|
|
goto good_exit
|
|
|
|
|
2018-07-31 22:35:02 +08:00
|
|
|
rem ============================================================================
|
|
|
|
rem -- Messages and Errors -----------------------------------------------------
|
|
|
|
rem ============================================================================
|
2018-08-24 00:08:06 +08:00
|
|
|
|
2019-02-06 00:33:09 +08:00
|
|
|
:help
|
|
|
|
echo Build LibCarla.
|
2020-03-05 20:16:18 +08:00
|
|
|
echo "Usage: %FILE_N% [-h^|--help] [--build] [--launch] [--clean]"
|
2019-02-06 00:33:09 +08:00
|
|
|
goto good_exit
|
2018-08-24 00:08:06 +08:00
|
|
|
|
2019-02-06 00:33:09 +08:00
|
|
|
:error_build
|
2018-08-24 20:58:46 +08:00
|
|
|
echo.
|
2019-02-06 00:33:09 +08:00
|
|
|
echo %FILE_N% [ERROR] There was a problem building CarlaUE4.
|
|
|
|
echo %FILE_N% Please go to "Carla\Unreal\CarlaUE4", right click on
|
|
|
|
echo %FILE_N% "CarlaUE4.uproject" and select:
|
|
|
|
echo %FILE_N% "Generate Visual Studio project files"
|
|
|
|
echo %FILE_N% Open de generated "CarlaUE4.sln" and try to manually compile it
|
|
|
|
echo %FILE_N% and check what is causing the error.
|
2018-08-24 20:58:46 +08:00
|
|
|
goto bad_exit
|
|
|
|
|
2018-08-24 00:08:06 +08:00
|
|
|
:good_exit
|
|
|
|
endlocal
|
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
:bad_exit
|
|
|
|
endlocal
|
2018-08-24 20:58:46 +08:00
|
|
|
exit /b %errorlevel%
|
2020-04-24 18:21:15 +08:00
|
|
|
|
|
|
|
:error_unreal_no_found
|
|
|
|
echo.
|
|
|
|
echo %FILE_N% [ERROR] Unreal Engine %UE_VERSION% not detected
|
|
|
|
goto bad_exit
|