changed default MSVC version to 22

master
joeyrp 2 years ago
parent 9056c61902
commit 407d30f853

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16.3) cmake_minimum_required(VERSION 3.16.3)
# Set the project name and version # Set the project name and version
project(cgen VERSION 1.0.0) project(cgen VERSION 1.0.5)
# specify the C++ standard # specify the C++ standard
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)

@ -40,7 +40,7 @@ int main(int argc, char** argv)
argParser.AddArg(ArgDesc("-i", true, 0, "Generate a .gitignore file")); argParser.AddArg(ArgDesc("-i", true, 0, "Generate a .gitignore file"));
argParser.AddArg(ArgDesc("-m", true, 1, "Specify the CMake version to require. Default is 3.16.3")); argParser.AddArg(ArgDesc("-m", true, 1, "Specify the CMake version to require. Default is 3.16.3"));
argParser.AddArg(ArgDesc("-c", true, 1, "Specify the C++ version to require. Default is 17")); argParser.AddArg(ArgDesc("-c", true, 1, "Specify the C++ version to require. Default is 17"));
argParser.AddArg(ArgDesc("-s", true, 1, "Specify the visual studio version to use (17, 19, 22). Default is 19")); argParser.AddArg(ArgDesc("-s", true, 1, "Specify the visual studio version to use (17, 19, 22). Default is 22"));
argParser.AddArg(ArgDesc("-a", true, 1, "Add library projects, separated by ',' (ex: -a first,second,third)")); argParser.AddArg(ArgDesc("-a", true, 1, "Add library projects, separated by ',' (ex: -a first,second,third)"));
argParser.AddArg(ArgDesc("-x", true, 1, "Add executable submodule projects, separated by ',' (ex: -x first,second,third)")); argParser.AddArg(ArgDesc("-x", true, 1, "Add executable submodule projects, separated by ',' (ex: -x first,second,third)"));
argParser.AddArg(ArgDesc("-r", true, 0, "Remove the root project executable")); argParser.AddArg(ArgDesc("-r", true, 0, "Remove the root project executable"));
@ -451,12 +451,15 @@ int main(int argc, char** argv)
bool gen_windows = (!have_platform_option || (argParser.GetOptionValue("-p").values[0] == "win" || argParser.GetOptionValue("-p").values[0] == "both")); bool gen_windows = (!have_platform_option || (argParser.GetOptionValue("-p").values[0] == "win" || argParser.GetOptionValue("-p").values[0] == "both"));
bool gen_linux = (have_platform_option && (argParser.GetOptionValue("-p").values[0] == "linux" || argParser.GetOptionValue("-p").values[0] == "both")); bool gen_linux = (have_platform_option && (argParser.GetOptionValue("-p").values[0] == "linux" || argParser.GetOptionValue("-p").values[0] == "both"));
std::string vs_version = "\"Visual Studio 16 2019\""; std::string vs_version = "\"Visual Studio 17 2022\"";
if (argParser.ContainsOption("-s")) if (argParser.ContainsOption("-s"))
{ {
if (argParser.GetOptionValue("-s").values[0] == "17") if (argParser.GetOptionValue("-s").values[0] == "17")
vs_version = "\"Visual Studio 15 2017\""; vs_version = "\"Visual Studio 15 2017\"";
if (argParser.GetOptionValue("-s").values[0] == "19")
vs_version = "\"Visual Studio 16 2019\"";
if (argParser.GetOptionValue("-s").values[0] == "22") if (argParser.GetOptionValue("-s").values[0] == "22")
vs_version = "\"Visual Studio 17 2022\""; vs_version = "\"Visual Studio 17 2022\"";
} }
@ -478,9 +481,50 @@ int main(int argc, char** argv)
ofs << "@echo off"; ofs << "@echo off";
ofs << "\nREM This script expects to be run from the parent directory"; ofs << "\nREM This script expects to be run from the parent directory";
ofs << "\nREM ex. scripts/cmconfig.bat"; ofs << "\nREM ex. scripts/config.bat";
ofs << "\n@echo off"; ofs << "\n@echo off";
ofs << "\n\ncmake -Wno-dev -B build/ -S . -G " << vs_version.c_str() << " -A x64";
ofs << "\nset options=";
ofs << "\nset build_type=";
ofs << "\n";
ofs << "\nIF \"%1\"==\"\" goto command";
ofs << "\ngoto loop";
ofs << "\n:command";
ofs << "\nIF \"%build_type%\"==\"\" (";
ofs << "\n set build_type=-DCMAKE_BUILD_TYPE=Debug";
ofs << "\n echo Build mode is Debug";
ofs << "\n)";
ofs << "\necho using options %options%";
ofs << "\ncmake -Wno-dev %build_type% %options% -B build/ -S . -G " << vs_version.c_str() << " -A x64";
ofs << "\ngoto exit";
ofs << "\n";
ofs << "\n:loop";
ofs << "\n";
ofs << "\nIF \"%1\"==\"-c\" (";
ofs << "\n call scripts\\clean.bat";
ofs << "\n goto loop_condition";
ofs << "\n)";
ofs << "\n";
ofs << "\nIF \"%1\"==\"-r\" (";
ofs << "\n echo Build mode is release";
ofs << "\n set build_type=-DCMAKE_BUILD_TYPE=Release";
ofs << "\n goto loop_condition";
ofs << "\n)";
ofs << "\n";
ofs << "\nset options=%options%-D%1=ON ";
ofs << "\n";
ofs << "\n:loop_condition";
ofs << "\nshift";
ofs << "\nIF \"%1\"==\"\" goto command";
ofs << "\ngoto loop";
ofs << "\n";
ofs << "\n:exit";
//ofs << "\n\ncmake -Wno-dev -B build/ -S . -G " << vs_version.c_str() << " -A x64";
ofs.close(); ofs.close();
ofs.clear(); ofs.clear();
@ -509,31 +553,14 @@ int main(int argc, char** argv)
ofs << "\n\tgoto END"; ofs << "\n\tgoto END";
ofs << "\n)"; ofs << "\n)";
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 << "\ncmake --build build/ --target ALL_BUILD";
ofs << "\n\nSET BUILD_ERRORLEVEL=!ERRORLEVEL!"; ofs << "\n\nSET BUILD_ERRORLEVEL=!ERRORLEVEL!";
ofs << "\nIF NOT \"!BUILD_ERRORLEVEL!\"==\"0\" ("; ofs << "\nIF NOT \"!BUILD_ERRORLEVEL!\"==\"0\" (";
ofs << "\n\techo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%"; ofs << "\n\techo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%";
ofs << "\n\tEXIT /B !BUILD_ERRORLEVEL!"; ofs << "\n\tEXIT /B !BUILD_ERRORLEVEL!";
ofs << "\n)"; ofs << "\n)";
ofs << "\n\nxcopy /y test_data\\engine_state.xml build\\Release\\";
ofs << "\n) ELSE (";
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\necho %ESC%[92mBUILD SUCCEEDED!%ESC%[0m";
ofs << "\n\n:END"; ofs << "\n\n:END";

Loading…
Cancel
Save