Parsing and processing arguments
This commit is contained in:
parent
f5b7ab08da
commit
691fe88eec
|
@ -1,13 +1,54 @@
|
||||||
@echo off
|
@echo off
|
||||||
setlocal enableextensions
|
setlocal
|
||||||
|
|
||||||
rem
|
rem Bat script that compiles and exports the carla project (carla.org)
|
||||||
|
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
|
rem https://wiki.unrealengine.com/How_to_package_your_game_with_commands
|
||||||
rem
|
|
||||||
|
|
||||||
set LOCAL_PATH=%~dp0
|
set LOCAL_PATH=%~dp0
|
||||||
set "FILE_N=-[%~n0]:"
|
set "FILE_N=-[%~n0]:"
|
||||||
|
|
||||||
|
rem ==============================================================================
|
||||||
|
rem -- Parse arguments -----------------------------------------------------------
|
||||||
|
rem ==============================================================================
|
||||||
|
|
||||||
|
set DOC_STRING="Makes a packaged version of CARLA for distribution."
|
||||||
|
set USAGE_STRING="Usage: %FILE_N% [-h|--help] [--no-packaging] [--no-zip] [--clean-intermediate]"
|
||||||
|
|
||||||
|
set DO_PACKAGE=true
|
||||||
|
set DO_COPY_FILES=true
|
||||||
|
set DO_TARBALL=true
|
||||||
|
set DO_CLEAN_INTERMEDIATE=false
|
||||||
|
|
||||||
|
:arg-parse
|
||||||
|
if not "%1"=="" (
|
||||||
|
if "%1"=="--clean-intermediate" (
|
||||||
|
set DO_CLEAN_INTERMEDIATE=true
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="--no-zip" (
|
||||||
|
set DO_TARBALL=false
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="--no-packaging" (
|
||||||
|
set DO_PACKAGE=false
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="-h" (
|
||||||
|
echo %DOC_STRING%
|
||||||
|
echo %USAGE_STRING%
|
||||||
|
GOTO :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1"=="--help" (
|
||||||
|
echo %DOC_STRING%
|
||||||
|
echo %USAGE_STRING%
|
||||||
|
GOTO :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
shift
|
||||||
|
goto :arg-parse
|
||||||
|
)
|
||||||
|
|
||||||
rem Extract Unreal Engine root path
|
rem Extract Unreal Engine root path
|
||||||
rem
|
rem
|
||||||
|
@ -15,49 +56,82 @@ set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\EpicGames\Unreal Engine\4.19"
|
||||||
set VALUE_NAME=InstalledDirectory
|
set VALUE_NAME=InstalledDirectory
|
||||||
|
|
||||||
for /f %%i in ('git describe --tags --dirty --always') do set CARLA_VERSION=%%i
|
for /f %%i in ('git describe --tags --dirty --always') do set CARLA_VERSION=%%i
|
||||||
if not defined CARLA_VERSION goto error_CARLA_VERSION
|
if not defined CARLA_VERSION goto error_carla_version
|
||||||
|
|
||||||
for /f "usebackq tokens=3*" %%A in (`reg query %KEY_NAME% /v %VALUE_NAME%`) do set UE4_ROOT=%%A%%B
|
for /f "usebackq tokens=3*" %%A in (`reg query %KEY_NAME% /v %VALUE_NAME%`) do set UE4_ROOT=%%A%%B
|
||||||
if not defined UE4_ROOT goto error_unreal_no_found
|
if not defined UE4_ROOT goto error_unreal_no_found
|
||||||
|
|
||||||
set CARLA_OUTPUT_PATH=%INSTALLATION_DIR%UE4Carla/%CARLA_VERSION%
|
set BUILD_FOLDER=%INSTALLATION_DIR%UE4Carla/%CARLA_VERSION%/
|
||||||
if not exist "%CARLA_OUTPUT_PATH%" mkdir "%CARLA_OUTPUT_PATH%"
|
if not exist "%BUILD_FOLDER%" mkdir "%BUILD_FOLDER%"
|
||||||
|
|
||||||
|
set DESTINATION_TAR="%BUILD_FOLDER%../CARLA_%CARLA_VERSION%.tar.gz"
|
||||||
|
set SOURCE=%BUILD_FOLDER%WindowsNoEditor/
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Create Carla package ----------------------------------------------------
|
rem -- Create Carla package ----------------------------------------------------
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
|
|
||||||
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
|
if %DO_PACKAGE%==true (
|
||||||
CarlaUE4Editor^
|
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
|
||||||
Win64^
|
CarlaUE4Editor^
|
||||||
Development^
|
Win64^
|
||||||
-WaitMutex^
|
Development^
|
||||||
-FromMsBuild^
|
-WaitMutex^
|
||||||
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
-FromMsBuild^
|
||||||
|
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
||||||
|
|
||||||
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
|
call "%UE4_ROOT%\Engine\Build\BatchFiles\Build.bat"^
|
||||||
CarlaUE4^
|
CarlaUE4^
|
||||||
Win64^
|
Win64^
|
||||||
Development^
|
Development^
|
||||||
-WaitMutex^
|
-WaitMutex^
|
||||||
-FromMsBuild^
|
-FromMsBuild^
|
||||||
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
"%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"
|
||||||
|
|
||||||
call "%UE4_ROOT%\Engine\Build\BatchFiles\RunUAT.bat"^
|
call "%UE4_ROOT%\Engine\Build\BatchFiles\RunUAT.bat"^
|
||||||
BuildCookRun^
|
BuildCookRun^
|
||||||
-nocompileeditor^
|
-nocompileeditor^
|
||||||
-TargetPlatform=Win64^
|
-TargetPlatform=Win64^
|
||||||
-Platform=Win64^
|
-Platform=Win64^
|
||||||
-installed^
|
-installed^
|
||||||
-nop4^
|
-nop4^
|
||||||
-project="%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"^
|
-project="%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject"^
|
||||||
-cook^
|
-cook^
|
||||||
-stage^
|
-stage^
|
||||||
-build^
|
-build^
|
||||||
-archive^
|
-archive^
|
||||||
-archivedirectory="%CARLA_OUTPUT_PATH%"^
|
-archivedirectory="%BUILD_FOLDER%"^
|
||||||
-package^
|
-package^
|
||||||
-clientconfig=Development
|
-clientconfig=Development
|
||||||
|
)
|
||||||
|
|
||||||
|
rem ==============================================================================
|
||||||
|
rem -- Zip the project -----------------------------------------------------------
|
||||||
|
rem ==============================================================================
|
||||||
|
|
||||||
|
if %DO_TARBALL%==true (
|
||||||
|
echo "%FILE_N% Building package..."
|
||||||
|
|
||||||
|
if exist %SOURCE%Manifest_NonUFSFiles_Win64.txt del /S /Q %SOURCE%Manifest_NonUFSFiles_Win64.txt
|
||||||
|
if exist %SOURCE%Manifest_DebugFiles_Win64.txt del /S /Q %SOURCE%Manifest_DebugFiles_Win64.txt
|
||||||
|
if exist %SOURCE%Manifest_UFSFiles_Win64.txt del /S /Q %SOURCE%Manifest_UFSFiles_Win64.txt
|
||||||
|
|
||||||
|
if exist CarlaUE4/Saved rmdir /S /Q CarlaUE4/Saved
|
||||||
|
if exist Engine/Saved rmdir /S /Q Engine/Saved
|
||||||
|
|
||||||
|
pushd "%SOURCE%""
|
||||||
|
tar -czvf "%DESTINATION_TAR%" "*"
|
||||||
|
popd
|
||||||
|
)
|
||||||
|
|
||||||
|
rem ==============================================================================
|
||||||
|
rem -- Remove intermediate files -------------------------------------------------
|
||||||
|
rem ==============================================================================
|
||||||
|
|
||||||
|
if %DO_CLEAN_INTERMEDIATE%==true (
|
||||||
|
echo "%FILE_N% Removing intermediate build."
|
||||||
|
rmdir /S /Q "%BUILD_FOLDER%"
|
||||||
|
)
|
||||||
|
|
||||||
rem ============================================================================
|
rem ============================================================================
|
||||||
rem -- Messages and Errors -----------------------------------------------------
|
rem -- Messages and Errors -----------------------------------------------------
|
||||||
|
@ -65,7 +139,8 @@ rem ============================================================================
|
||||||
|
|
||||||
:success
|
:success
|
||||||
echo.
|
echo.
|
||||||
echo %FILE_N% Carla project successful exported to "%CARLA_OUTPUT_PATH%"!
|
if %DO_PACKAGE%==true echo %FILE_N% Carla project successful exported to "%CARLA_OUTPUT_PATH%"!
|
||||||
|
if %DO_TARBALL%==true echo %FILE_N% Compress carla project exported to "%DESTINATION_TAR%"!
|
||||||
goto good_exit
|
goto good_exit
|
||||||
|
|
||||||
:error_carla_version
|
:error_carla_version
|
||||||
|
|
Loading…
Reference in New Issue