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
|
2020-06-16 21:26:43 +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-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
|
2020-12-04 23:33:41 +08:00
|
|
|
set USE_CARSIM=false
|
2021-01-29 23:57:40 +08:00
|
|
|
set USE_CHRONO=false
|
2023-03-20 19:09:39 +08:00
|
|
|
set USE_UNITY=true
|
2021-01-29 23:57:40 +08:00
|
|
|
set CARSIM_STATE="CarSim OFF"
|
|
|
|
set CHRONO_STATE="Chrono OFF"
|
2023-03-20 19:09:39 +08:00
|
|
|
set UNITY_STATE="Unity ON"
|
|
|
|
set AT_LEAST_WRITE_OPTIONALMODULES=false
|
2022-06-09 05:22:30 +08:00
|
|
|
set EDITOR_FLAGS=""
|
2023-11-06 19:34:07 +08:00
|
|
|
set USE_ROS2=false
|
|
|
|
set ROS2_STATE="Ros2 OFF"
|
2018-07-27 22:16:58 +08:00
|
|
|
|
|
|
|
:arg-parse
|
2020-03-05 20:16:18 +08:00
|
|
|
echo %1
|
2018-07-27 22:16:58 +08:00
|
|
|
if not "%1"=="" (
|
2022-06-09 05:22:30 +08:00
|
|
|
if "%1"=="--editor-flags" (
|
|
|
|
set EDITOR_FLAGS=%2
|
|
|
|
shift
|
|
|
|
)
|
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
|
|
|
|
)
|
2020-12-04 23:33:41 +08:00
|
|
|
if "%1"=="--carsim" (
|
|
|
|
set USE_CARSIM=true
|
|
|
|
)
|
2021-01-29 23:57:40 +08:00
|
|
|
if "%1"=="--chrono" (
|
|
|
|
set USE_CHRONO=true
|
|
|
|
)
|
2023-11-06 19:34:07 +08:00
|
|
|
if "%1"=="--ros2" (
|
|
|
|
set USE_ROS2=true
|
|
|
|
)
|
2023-03-20 19:09:39 +08:00
|
|
|
if "%1"=="--no-unity" (
|
|
|
|
set USE_UNITY=false
|
|
|
|
)
|
|
|
|
if "%1"=="--at-least-write-optionalmodules" (
|
|
|
|
set AT_LEAST_WRITE_OPTIONALMODULES=true
|
|
|
|
)
|
2018-07-27 22:16:58 +08:00
|
|
|
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
|
|
|
)
|
2022-06-09 05:22:30 +08:00
|
|
|
rem remove quotes from arguments
|
|
|
|
set EDITOR_FLAGS=%EDITOR_FLAGS:"=%
|
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 (
|
2023-03-20 19:09:39 +08:00
|
|
|
if %AT_LEAST_WRITE_OPTIONALMODULES% == false (
|
|
|
|
goto help
|
|
|
|
)
|
2020-03-05 20:16:18 +08:00
|
|
|
)
|
2018-07-27 22:16:58 +08:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2020-04-29 17:17:54 +08:00
|
|
|
rem Get Unreal Engine root path
|
2020-04-24 18:21:15 +08:00
|
|
|
if not defined UE4_ROOT (
|
2020-04-29 17:17:54 +08:00
|
|
|
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\EpicGames\Unreal Engine"
|
2020-04-24 18:21:15 +08:00
|
|
|
set VALUE_NAME=InstalledDirectory
|
2020-04-29 17:17:54 +08:00
|
|
|
for /f "usebackq tokens=1,2,*" %%A in (`reg query !KEY_NAME! /s /reg:64`) do (
|
|
|
|
if "%%A" == "!VALUE_NAME!" (
|
2020-06-17 16:28:45 +08:00
|
|
|
set UE4_ROOT=%%C
|
2020-04-29 17:17:54 +08:00
|
|
|
)
|
|
|
|
)
|
2020-04-24 18:21:15 +08:00
|
|
|
if not defined UE4_ROOT goto error_unreal_no_found
|
|
|
|
)
|
2020-06-17 16:28:45 +08:00
|
|
|
if not "%UE4_ROOT:~-1%"=="\" set UE4_ROOT=%UE4_ROOT%\
|
2020-04-24 18:21:15 +08:00
|
|
|
|
2018-08-24 20:58:46 +08:00
|
|
|
rem Set the visual studio solution directory
|
|
|
|
rem
|
2020-06-16 21:26:43 +08:00
|
|
|
set UE4_PROJECT_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\
|
2019-02-06 00:33:09 +08:00
|
|
|
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 (
|
2020-06-16 21:26:43 +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 (
|
2020-06-16 21:26:43 +08:00
|
|
|
"%UE4_PROJECT_FOLDER%CarlaUE4.sln"
|
2019-02-08 21:38:12 +08:00
|
|
|
) do (
|
|
|
|
if exist %%G (
|
|
|
|
echo %FILE_N% Cleaning %%G
|
|
|
|
del %%G
|
|
|
|
)
|
|
|
|
)
|
2018-08-24 16:43:22 +08:00
|
|
|
)
|
|
|
|
|
2023-03-04 00:26:48 +08:00
|
|
|
rem Download Houdini Plugin
|
|
|
|
|
|
|
|
set HOUDINI_PLUGIN_REPO=https://github.com/sideeffects/HoudiniEngineForUnreal.git
|
|
|
|
set HOUDINI_PLUGIN_PATH=Plugins/HoudiniEngine
|
2023-07-03 19:55:50 +08:00
|
|
|
set HOUDINI_PLUGIN_COMMIT=55b6a16cdf274389687fce3019b33e3b6e92a914
|
2023-03-04 00:26:48 +08:00
|
|
|
set HOUDINI_PATCH=${CARLA_UTIL_FOLDER}/Patches/houdini_patch.txt
|
|
|
|
if not exist "%HOUDINI_PLUGIN_PATH%" (
|
2023-07-03 19:55:50 +08:00
|
|
|
call git clone %HOUDINI_PLUGIN_REPO% %HOUDINI_PLUGIN_PATH%
|
|
|
|
cd %HOUDINI_PLUGIN_PATH%
|
|
|
|
call git checkout %HOUDINI_PLUGIN_COMMIT%
|
|
|
|
cd ../..
|
2023-03-04 00:26:48 +08:00
|
|
|
)
|
|
|
|
|
2020-03-05 20:16:18 +08:00
|
|
|
rem Build Carla Editor
|
|
|
|
rem
|
2023-03-09 23:01:53 +08:00
|
|
|
set OMNIVERSE_PATCH_FOLDER=%ROOT_PATH%Util\Patches\omniverse_4.26\
|
|
|
|
set OMNIVERSE_PLUGIN_FOLDER=%UE4_ROOT%Engine\Plugins\Marketplace\NVIDIA\Omniverse\
|
|
|
|
if exist %OMNIVERSE_PLUGIN_FOLDER% (
|
|
|
|
set OMNIVERSE_PLUGIN_INSTALLED="Omniverse ON"
|
|
|
|
xcopy /Y /S /I "%OMNIVERSE_PATCH_FOLDER%USDCARLAInterface.h" "%OMNIVERSE_PLUGIN_FOLDER%Source\OmniverseUSD\Public\" > NUL
|
|
|
|
xcopy /Y /S /I "%OMNIVERSE_PATCH_FOLDER%USDCARLAInterface.cpp" "%OMNIVERSE_PLUGIN_FOLDER%Source\OmniverseUSD\Private\" > NUL
|
|
|
|
) else (
|
|
|
|
set OMNIVERSE_PLUGIN_INSTALLED="Omniverse OFF"
|
|
|
|
)
|
2021-01-29 23:57:40 +08:00
|
|
|
|
|
|
|
if %USE_CARSIM% == true (
|
2024-02-19 17:55:48 +08:00
|
|
|
python %ROOT_PATH%Util/BuildTools/enable_carsim_to_uproject.py -f="%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject" -e
|
2021-01-29 23:57:40 +08:00
|
|
|
set CARSIM_STATE="CarSim ON"
|
|
|
|
) else (
|
2024-02-19 17:55:48 +08:00
|
|
|
python %ROOT_PATH%Util/BuildTools/enable_carsim_to_uproject.py -f="%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
2021-01-29 23:57:40 +08:00
|
|
|
set CARSIM_STATE="CarSim OFF"
|
|
|
|
)
|
|
|
|
if %USE_CHRONO% == true (
|
|
|
|
set CHRONO_STATE="Chrono ON"
|
|
|
|
) else (
|
|
|
|
set CHRONO_STATE="Chrono OFF"
|
|
|
|
)
|
2023-11-06 19:34:07 +08:00
|
|
|
if %USE_ROS2% == true (
|
|
|
|
set ROS2_STATE="Ros2 ON"
|
|
|
|
) else (
|
|
|
|
set ROS2_STATE="Ros2 OFF"
|
|
|
|
)
|
2023-03-20 19:09:39 +08:00
|
|
|
if %USE_UNITY% == true (
|
|
|
|
set UNITY_STATE="Unity ON"
|
|
|
|
) else (
|
|
|
|
set UNITY_STATE="Unity OFF"
|
|
|
|
)
|
2023-11-06 19:34:07 +08:00
|
|
|
set OPTIONAL_MODULES_TEXT=%CARSIM_STATE% %CHRONO_STATE% %ROS2_STATE% %OMNIVERSE_PLUGIN_INSTALLED% %UNITY_STATE%
|
2023-03-09 23:01:53 +08:00
|
|
|
echo %OPTIONAL_MODULES_TEXT% > "%ROOT_PATH%Unreal/CarlaUE4/Config/OptionalModules.ini"
|
2023-03-09 21:17:41 +08:00
|
|
|
|
|
|
|
|
2020-03-05 20:16:18 +08:00
|
|
|
if %BUILD_UE4_EDITOR% == true (
|
|
|
|
echo %FILE_N% Building Unreal Editor...
|
|
|
|
|
2020-06-16 21:26:43 +08:00
|
|
|
call "%UE4_ROOT%Engine\Build\BatchFiles\Build.bat"^
|
2020-03-05 20:16:18 +08:00
|
|
|
CarlaUE4Editor^
|
|
|
|
Win64^
|
|
|
|
Development^
|
|
|
|
-WaitMutex^
|
|
|
|
-FromMsBuild^
|
|
|
|
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
|
|
|
if errorlevel 1 goto bad_exit
|
|
|
|
|
2020-06-16 21:26:43 +08:00
|
|
|
call "%UE4_ROOT%Engine\Build\BatchFiles\Build.bat"^
|
2020-03-05 20:16:18 +08:00
|
|
|
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...
|
2020-11-24 22:02:22 +08:00
|
|
|
call "%UE4_ROOT%\Engine\Binaries\Win64\UE4Editor.exe"^
|
2022-06-09 05:22:30 +08:00
|
|
|
"%UE4_PROJECT_FOLDER%CarlaUE4.uproject" %EDITOR_FLAGS%
|
2019-02-06 00:33:09 +08:00
|
|
|
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.
|
2020-04-29 17:17:54 +08:00
|
|
|
echo %FILE_N% [ERROR] Unreal Engine not detected
|
2020-04-24 18:21:15 +08:00
|
|
|
goto bad_exit
|