From ac8edb04e670c31c8332f18c46281ebc9769fcae Mon Sep 17 00:00:00 2001 From: Jonathan Horner Date: Sat, 1 May 2021 23:02:53 +0100 Subject: [PATCH 1/6] Added CMakeSettings.json file. Allows easy build with Visual Studio - CMake integration. Debug and Release configurations added. installRoot set to `build/install/` --- CMakeSettings.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 CMakeSettings.json diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000000..5a4f27313a --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\build\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\build\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ] + } + ] +} \ No newline at end of file From c84f1ffdb895219bc35e719579ca31e6f638e468 Mon Sep 17 00:00:00 2001 From: Jonathan Horner Date: Sat, 1 May 2021 23:07:39 +0100 Subject: [PATCH 2/6] Added newline at the end of file. --- CMakeSettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index 5a4f27313a..cfbefc90a5 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -23,4 +23,4 @@ "inheritEnvironments": [ "msvc_x64_x64" ] } ] -} \ No newline at end of file +} From 6b01a0f70cfc1cdb94894a95e64c86c5872a1f50 Mon Sep 17 00:00:00 2001 From: Jonathan Horner Date: Sun, 2 May 2021 17:48:06 +0100 Subject: [PATCH 3/6] Added x86 and RelWithDebInfo configurations. --- CMakeSettings.json | 48 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index cfbefc90a5..563da9c74a 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -1,5 +1,39 @@ { "configurations": [ + { + "name": "x86-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\build\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x86" ] + }, + { + "name": "x86-RelWithDebInfo", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\build\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x86" ], + "variables": [] + }, + { + "name": "x86-Release", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\build\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x86" ] + }, { "name": "x64-Debug", "generator": "Ninja", @@ -11,6 +45,18 @@ "buildCommandArgs": "", "ctestCommandArgs": "" }, + { + "name": "x64-RelWithDebInfo", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\build\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] + }, { "name": "x64-Release", "generator": "Ninja", @@ -23,4 +69,4 @@ "inheritEnvironments": [ "msvc_x64_x64" ] } ] -} +} \ No newline at end of file From b5a7551b1e6e3bb0e2da19b459a1a16d0efb237e Mon Sep 17 00:00:00 2001 From: Jonathan Horner Date: Sun, 2 May 2021 17:49:01 +0100 Subject: [PATCH 4/6] Added newline at the end of file. --- CMakeSettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index 563da9c74a..bcbc52c748 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -69,4 +69,4 @@ "inheritEnvironments": [ "msvc_x64_x64" ] } ] -} \ No newline at end of file +} From a980060c2c8f73e1e0ea364dfa4027eba58b0631 Mon Sep 17 00:00:00 2001 From: Jonathan Horner Date: Sat, 15 May 2021 20:21:48 +0100 Subject: [PATCH 5/6] Replaced CMakeSettings.json with CMakePresets.json Provides equivalent functionality. Can be used directly with CMake and is not MSVC specific. --- CMakePresets.json | 44 ++++++++++++++++++++++++++++ CMakeSettings.json | 72 ---------------------------------------------- 2 files changed, 44 insertions(+), 72 deletions(-) create mode 100644 CMakePresets.json delete mode 100644 CMakeSettings.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..305f7b31c9 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,44 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "MSVC x86-Debug", + "displayName": "MSVC x86-Debug", + "description": "Using compilers for Visual Studio 16 2019 (x86 architecture - Debug mode)", + "generator": "Visual Studio 16 2019", + "toolset": "host=x86", + "architecture": "win32", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}" + } + }, + { + "name": "MSVC x86-Release", + "displayName": "MSVC x86-Release", + "description": "Using compilers for Visual Studio 16 2019 (x86 architecture - Release mode)", + "generator": "Visual Studio 16 2019", + "toolset": "host=x86", + "architecture": "win32", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}" + } + }, + { + "name": "MSVC x86-RelWithDebInfo", + "displayName": "MSVC x86-RelWithDebInfo", + "description": "Using compilers for Visual Studio 16 2019 (x86 architecture - Release mode with Debug Info)", + "generator": "Visual Studio 16 2019", + "toolset": "host=x86", + "architecture": "win32", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}" + } + } + ] +} \ No newline at end of file diff --git a/CMakeSettings.json b/CMakeSettings.json deleted file mode 100644 index bcbc52c748..0000000000 --- a/CMakeSettings.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "configurations": [ - { - "name": "x86-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "buildRoot": "${projectDir}\\build\\${name}", - "installRoot": "${projectDir}\\build\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x86" ] - }, - { - "name": "x86-RelWithDebInfo", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "buildRoot": "${projectDir}\\build\\${name}", - "installRoot": "${projectDir}\\build\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x86" ], - "variables": [] - }, - { - "name": "x86-Release", - "generator": "Ninja", - "configurationType": "Release", - "buildRoot": "${projectDir}\\build\\${name}", - "installRoot": "${projectDir}\\build\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x86" ] - }, - { - "name": "x64-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "inheritEnvironments": [ "msvc_x64_x64" ], - "buildRoot": "${projectDir}\\build\\${name}", - "installRoot": "${projectDir}\\build\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "" - }, - { - "name": "x64-RelWithDebInfo", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "buildRoot": "${projectDir}\\build\\${name}", - "installRoot": "${projectDir}\\build\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x64_x64" ], - "variables": [] - }, - { - "name": "x64-Release", - "generator": "Ninja", - "configurationType": "Release", - "buildRoot": "${projectDir}\\build\\${name}", - "installRoot": "${projectDir}\\build\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x64_x64" ] - } - ] -} From 6834bf29c4f84158bd475dd6e1a3c0e9162b3ce5 Mon Sep 17 00:00:00 2001 From: Jonathan Horner Date: Sat, 15 May 2021 21:19:09 +0100 Subject: [PATCH 6/6] Added template CMakeUserPresets.json to set `CMAKE_INSTALL_PREFIX` Removed whitespace from names and reduced verbosity. Added CMakeUserPresets.json to .gitignore Added simple CMakeUserPresets.json template for devs to copy. --- .gitignore | 3 +++ CMakePresets.json | 18 +++++++++--------- CMakeUserPresets.json.template | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 CMakeUserPresets.json.template diff --git a/.gitignore b/.gitignore index 3853e47221..9926bc85b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# CMake presets for local build configurations: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#build-preset +CMakeUserPresets.json + ################# ## Eclipse ################# diff --git a/CMakePresets.json b/CMakePresets.json index 305f7b31c9..81ec942523 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,9 +2,9 @@ "version": 2, "configurePresets": [ { - "name": "MSVC x86-Debug", - "displayName": "MSVC x86-Debug", - "description": "Using compilers for Visual Studio 16 2019 (x86 architecture - Debug mode)", + "name": "x86-Debug", + "displayName": "x86-Debug", + "description": "Visual Studio 16 2019 - x86 - Debug mode", "generator": "Visual Studio 16 2019", "toolset": "host=x86", "architecture": "win32", @@ -15,9 +15,9 @@ } }, { - "name": "MSVC x86-Release", - "displayName": "MSVC x86-Release", - "description": "Using compilers for Visual Studio 16 2019 (x86 architecture - Release mode)", + "name": "x86-Release", + "displayName": "x86-Release", + "description": "Visual Studio 16 2019 - x86 - Release mode", "generator": "Visual Studio 16 2019", "toolset": "host=x86", "architecture": "win32", @@ -28,9 +28,9 @@ } }, { - "name": "MSVC x86-RelWithDebInfo", - "displayName": "MSVC x86-RelWithDebInfo", - "description": "Using compilers for Visual Studio 16 2019 (x86 architecture - Release mode with Debug Info)", + "name": "x86-RelWithDebInfo", + "displayName": "x86-RelWithDebInfo", + "description": "Visual Studio 16 2019 - x86 - Release mode with Debug Info", "generator": "Visual Studio 16 2019", "toolset": "host=x86", "architecture": "win32", diff --git a/CMakeUserPresets.json.template b/CMakeUserPresets.json.template new file mode 100644 index 0000000000..b156ddfbfb --- /dev/null +++ b/CMakeUserPresets.json.template @@ -0,0 +1,32 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "x86-Debug-install", + "displayName": "x86-Debug-install", + "description": "Visual Studio 16 2019 - x86 - Debug mode - installs binaries to Jedi Academy install directory", + "inherits": "x86-Debug", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "/steamapps/common/Jedi Academy/GameData" + } + }, + { + "name": "x86-Release-install", + "displayName": "x86-Release-install", + "description": "Visual Studio 16 2019 - x86 - Release mode - installs binaries to Jedi Academy install directory", + "inherits": "x86-Release", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "/steamapps/common/Jedi Academy/GameData" + } + }, + { + "name": "x86-RelWithDebInfo-install", + "displayName": "x86-RelWithDebInfo-install", + "description": "Visual Studio 16 2019 - x86 - Release mode with Debug Info - installs binaries to Jedi Academy install directory", + "inherits": "x86-RelWithDebInfo", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "/steamapps/common/Jedi Academy/GameData" + } + } + ] +} \ No newline at end of file