|
|
|
|
@ -496,18 +496,48 @@ int main(int argc, char** argv)
|
|
|
|
|
std::cout << "\nGenerating build script file: " << build_file.string().c_str();
|
|
|
|
|
|
|
|
|
|
ofs << "@echo off";
|
|
|
|
|
ofs << "\nSETLOCAL ENABLEDELAYEDEXPANSION";
|
|
|
|
|
ofs << "\nREM This script expects to be run from the parent directory";
|
|
|
|
|
ofs << "\nREM ex. scripts/build.bat";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nREM Sets the escape char. see for info: ";
|
|
|
|
|
ofs << "\nREM https://stackoverflow.com/questions/55891318/how-to-echo-with-different-colors-in-the-windows-command-line-inside-a-for-loop";
|
|
|
|
|
ofs << "\nfor /F %%a in ('echo prompt $E ^| cmd') do set \"ESC=%%a\"";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nIF not exist build/ (";
|
|
|
|
|
ofs << "\n\techo This script needs to be run from the directory above build/";
|
|
|
|
|
ofs << "\n\tgoto END";
|
|
|
|
|
ofs << "\n)";
|
|
|
|
|
ofs << "\n\nIF \"%~1\" == \"r\" (";
|
|
|
|
|
ofs << "\n\tcmake --build build/ --target ALL_BUILD --config Release";
|
|
|
|
|
|
|
|
|
|
ofs << "\nset \"RELEASE=\"";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nIf \"%~1\" == \"r\" set \"RELEASE=1\"";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nIF defined RELEASE (";
|
|
|
|
|
ofs << "\ncmake --build build/ --target ALL_BUILD --config Release";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nSET BUILD_ERRORLEVEL=!ERRORLEVEL!";
|
|
|
|
|
ofs << "\nIF NOT \"!BUILD_ERRORLEVEL!\"==\"0\" (";
|
|
|
|
|
ofs << "\n\techo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%";
|
|
|
|
|
ofs << "\n\tEXIT /B !BUILD_ERRORLEVEL!";
|
|
|
|
|
ofs << "\n)";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nxcopy /y test_data\\engine_state.xml build\\Release\\";
|
|
|
|
|
ofs << "\n) ELSE (";
|
|
|
|
|
ofs << "\n\tcmake --build build/ --target ALL_BUILD --config Debug";
|
|
|
|
|
ofs << "\ncmake --build build/ --target ALL_BUILD --config Debug";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\nSET BUILD_ERRORLEVEL=!ERRORLEVEL!";
|
|
|
|
|
ofs << "\nIF NOT \"!BUILD_ERRORLEVEL!\"==\"0\" (";
|
|
|
|
|
ofs << "\n\techo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%";
|
|
|
|
|
ofs << "\n\tEXIT /B !BUILD_ERRORLEVEL!";
|
|
|
|
|
ofs << "\n)";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\n)";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\necho %ESC%[92mBUILD SUCCEEDED!%ESC%[0m";
|
|
|
|
|
|
|
|
|
|
ofs << "\n\n:END";
|
|
|
|
|
ofs << "\nENDLOCAL ";
|
|
|
|
|
ofs.close();
|
|
|
|
|
ofs.clear();
|
|
|
|
|
|
|
|
|
|
|