|
|
|
|
@echo off
|
|
|
|
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
|
|
|
|
REM This script expects to be run from the parent directory
|
|
|
|
|
REM ex. scripts/build.bat
|
|
|
|
|
|
|
|
|
|
REM Sets the escape char. see for info:
|
|
|
|
|
REM https://stackoverflow.com/questions/55891318/how-to-echo-with-different-colors-in-the-windows-command-line-inside-a-for-loop
|
|
|
|
|
for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
|
|
|
|
|
|
|
|
|
|
IF not exist build/ (
|
|
|
|
|
echo This script needs to be run from the directory above build/
|
|
|
|
|
goto END
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set "DELGUI="
|
|
|
|
|
set "RELEASE="
|
|
|
|
|
|
|
|
|
|
If "%~1" == "r" set "RELEASE=1"
|
|
|
|
|
If "%~2" == "r" set "RELEASE=1"
|
|
|
|
|
|
|
|
|
|
If "%~1" == "g" set "DELGUI=1"
|
|
|
|
|
If "%~2" == "g" set "DELGUI=1"
|
|
|
|
|
|
|
|
|
|
IF defined RELEASE (
|
|
|
|
|
cmake --build build/ --target ALL_BUILD --config Release
|
|
|
|
|
|
|
|
|
|
SET BUILD_ERRORLEVEL=!ERRORLEVEL!
|
|
|
|
|
IF NOT "!BUILD_ERRORLEVEL!"=="0" (
|
|
|
|
|
echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%
|
|
|
|
|
EXIT /B !BUILD_ERRORLEVEL!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
xcopy /y test_data\engine_state.xml build\Release\
|
|
|
|
|
) ELSE (
|
|
|
|
|
cmake --build build/ --target ALL_BUILD --config Debug
|
|
|
|
|
|
|
|
|
|
SET BUILD_ERRORLEVEL=!ERRORLEVEL!
|
|
|
|
|
IF NOT "!BUILD_ERRORLEVEL!"=="0" (
|
|
|
|
|
echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%
|
|
|
|
|
EXIT /B !BUILD_ERRORLEVEL!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
xcopy /y test_data\engine_state.json build\Debug\
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo %ESC%[92mBUILD SUCCEEDED!%ESC%[0m
|
|
|
|
|
|
|
|
|
|
IF defined DELGUI (
|
|
|
|
|
del /s /q build\Debug\imgui.ini
|
|
|
|
|
del /s /q build\Release\imgui.ini
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
:END
|
|
|
|
|
ENDLOCAL
|