@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 ) cmake --build build/ --target all SET BUILD_ERRORLEVEL=!ERRORLEVEL! IF NOT "!BUILD_ERRORLEVEL!"=="0" ( echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% EXIT /B !BUILD_ERRORLEVEL! ) IF not exist build/bin/shaders ( mkdir build/bin/shaders ) REM TODO: Run any extra tasks here echo %ESC%[92mBUILD SUCCEEDED!%ESC%[0m :END ENDLOCAL