From 80dc6d3c6e91bbadaaa518ae14de8d277bf65ba8 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Tue, 8 Mar 2022 14:25:59 +0200 Subject: [PATCH 1/5] Initial implementation of "Ninja Multi-config" support in CMakePresets.json --- CMakePresets.json | 217 ++++++++++++++++++++++++---------------------- 1 file changed, 112 insertions(+), 105 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 114b5895..049b0eaf 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,18 +7,18 @@ }, "configurePresets": [ { - "name": "conf-common", + "name": "config-common", "description": "General settings that apply to all configurations", "hidden": true, - "generator": "Ninja", + "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/out/build/${presetName}", "installDir": "${sourceDir}/out/install/${presetName}" }, { - "name": "conf-windows-common", + "name": "config-windows-common", "description": "Windows settings for MSBuild toolchain that apply to msvc and clang", "hidden": true, - "inherits": "conf-common", + "inherits": "config-common", "condition": { "type": "equals", "lhs": "${hostSystemName}", @@ -34,10 +34,10 @@ } }, { - "name": "conf-linux-common", + "name": "config-linux-common", "description": "Linux settings for gcc and clang toolchains", "hidden": true, - "inherits": "conf-common", + "inherits": "config-common", "condition": { "type": "equals", "lhs": "${hostSystemName}", @@ -50,10 +50,10 @@ } }, { - "name": "windows-msvc-debug", - "displayName": "msvc Debug", + "name": "windows-msvc", + "displayName": "msvc", "description": "Target Windows with the msvc compiler, debug build type", - "inherits": "conf-windows-common", + "inherits": "config-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "cl", "CMAKE_CXX_COMPILER": "cl", @@ -61,21 +61,10 @@ } }, { - "name": "windows-msvc-release", - "displayName": "msvc Release", - "description": "Target Windows with the msvc compiler, release build type", - "inherits": "conf-windows-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - } - }, - { - "name": "windows-clang-debug", - "displayName": "clang Debug", + "name": "windows-clang", + "displayName": "clang", "description": "Target Windows with the clang compiler, debug build type", - "inherits": "conf-windows-common", + "inherits": "config-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang-cl", "CMAKE_CXX_COMPILER": "clang-cl", @@ -88,26 +77,10 @@ } }, { - "name": "windows-clang-release", - "displayName": "clang Release", - "description": "Target Windows with the clang compiler, release build type", - "inherits": "conf-windows-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "clang-cl", - "CMAKE_CXX_COMPILER": "clang-cl", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - }, - "vendor": { - "microsoft.com/VisualStudioSettings/CMake/1.0": { - "intelliSenseMode": "windows-clang-x64" - } - } - }, - { - "name": "linux-gcc-debug", - "displayName": "gcc Debug", + "name": "linux-gcc", + "displayName": "gcc", "description": "Target Linux with the gcc compiler, debug build type", - "inherits": "conf-linux-common", + "inherits": "config-linux-common", "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", @@ -115,37 +88,71 @@ } }, { - "name": "linux-gcc-release", - "displayName": "gcc Release", - "description": "Target Linux with the gcc compiler, release build type", - "inherits": "conf-linux-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "gcc", - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - } - }, - { - "name": "linux-clang-debug", - "displayName": "clang Debug", + "name": "linux-clang", + "displayName": "clang", "description": "Target Linux with the clang compiler, debug build type", - "inherits": "conf-linux-common", + "inherits": "config-linux-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", "CMAKE_BUILD_TYPE": "Debug" } + } + ], + "buildPresets": [ + { + "name": "build-common-debug", + "description": "Set build type to Debug", + "hidden": true, + "configuration": "Debug" }, { - "name": "linux-clang-release", - "displayName": "clang Release", - "description": "Target Linux with the clang compiler, release build type", - "inherits": "conf-linux-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - } + "name": "build-common-release", + "description": "Set build type to Release", + "hidden": true, + "configuration": "Release" + }, + { + "name": "build-windows-msvc-debug", + "displayName": "Debug", + "description": "Build msvc debug on windows", + "inherits": "build-common-debug", + "configurePreset": "windows-msvc" + }, + { + "name": "build-windows-msvc-release", + "displayName": "Release", + "description": "Build msvc release on windows", + "inherits": "build-common-release", + "configurePreset": "windows-msvc" + }, + { + "name": "build-linux-gcc-debug", + "displayName": "Debug", + "description": "Build gcc debug on linux", + "inherits": "build-common-debug", + "configurePreset": "linux-gcc" + }, + { + "name": "build-linux-gcc-release", + "displayName": "Release", + "description": "Build gcc release on linux", + "inherits": "build-common-release", + "configurePreset": "linux-gcc" + }, + { + "name": "build-linux-clang-debug", + "displayName": "Debug", + "description": "Build clang debug on linux", + "inherits": "build-common-debug", + "configurePreset": "linux-clang" + }, + { + "name": "build-linux-clang-release", + "displayName": "Release", + "description": "Build clang release on linux", + "inherits": "build-common-release", + "configurePreset": "linux-clang" } ], "testPresets": [ @@ -162,60 +169,60 @@ } }, { - "name": "test-windows-msvc-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-msvc-debug" + "name": "test-common-debug", + "description": "Test CMake settings that apply to debug configurations", + "hidden": true, + "inherits": "test-common", + "configuration": "Debug" }, { - "name": "test-windows-msvc-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-msvc-release" + "name": "test-common-release", + "description": "Test CMake settings that apply to release configurations", + "hidden": true, + "inherits": "test-common", + "configuration": "Release" }, { - "name": "test-windows-clang-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-clang-debug" + "name": "test-windows-msvc-debug", + "displayName": "Debug", + "description": "Set Strict rules for windows msvc debug tests", + "inherits": "test-common-debug", + "configurePreset": "windows-msvc" }, { - "name": "test-windows-clang-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-clang-release" + "name": "test-windows-msvc-release", + "displayName": "Release", + "description": "Set Strict rules for windows msvc release tests", + "inherits": "test-common-release", + "configurePreset": "windows-msvc" }, { - "name": "test-linux-gcc-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "linux-gcc-debug" + "name": "test-linux-gcc-debug", + "displayName": "Debug", + "description": "Set Strict rules for linux gcc debug tests", + "inherits": "test-common-debug", + "configurePreset": "linux-gcc" }, { - "name": "test-linux-gcc-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "linux-gcc-release" + "name": "test-linux-gcc-release", + "displayName": "Release", + "description": "Set Strict rules for linux gcc release tests", + "inherits": "test-common-release", + "configurePreset": "linux-gcc" }, { - "name": "test-linux-clang-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "linux-clang-debug" + "name": "test-linux-clang-debug", + "displayName": "Debug", + "description": "Set Strict rules for linux clang debug tests", + "inherits": "test-common-debug", + "configurePreset": "linux-clang" }, { - "name": "test-linux-clang-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "linux-clang-release" + "name": "test-linux-clang-release", + "displayName": "Release", + "description": "Set Strict rules for linux clang release tests", + "inherits": "test-common-release", + "configurePreset": "linux-clang" } ] } \ No newline at end of file From f54922d0d62275ec11aedf6df58cf7c6968d45e0 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Tue, 8 Mar 2022 14:30:25 +0200 Subject: [PATCH 2/5] Add vendor options for CLion --- CMakePresets.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index 049b0eaf..c5153fe4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -58,6 +58,11 @@ "CMAKE_C_COMPILER": "cl", "CMAKE_CXX_COMPILER": "cl", "CMAKE_BUILD_TYPE": "Debug" + }, + "vendor": { + "jetbrains.com/clion": { + "toolchain": "Visual Studio" + } } }, { @@ -73,6 +78,9 @@ "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "intelliSenseMode": "windows-clang-x64" + }, + "jetbrains.com/clion": { + "toolchain": "Visual Studio" } } }, From 9ca084696256e986ca6b7868e49cc2164db50d84 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Fri, 11 Mar 2022 00:01:26 +0200 Subject: [PATCH 3/5] Format changes --- CMakePresets.json | 132 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index c5153fe4..be579b78 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -135,32 +135,32 @@ "configurePreset": "windows-msvc" }, { - "name": "build-linux-gcc-debug", - "displayName": "Debug", - "description": "Build gcc debug on linux", - "inherits": "build-common-debug", - "configurePreset": "linux-gcc" - }, - { - "name": "build-linux-gcc-release", - "displayName": "Release", - "description": "Build gcc release on linux", - "inherits": "build-common-release", - "configurePreset": "linux-gcc" - }, - { - "name": "build-linux-clang-debug", - "displayName": "Debug", - "description": "Build clang debug on linux", - "inherits": "build-common-debug", - "configurePreset": "linux-clang" - }, - { - "name": "build-linux-clang-release", - "displayName": "Release", - "description": "Build clang release on linux", - "inherits": "build-common-release", - "configurePreset": "linux-clang" + "name": "build-linux-gcc-debug", + "displayName": "Debug", + "description": "Build gcc debug on linux", + "inherits": "build-common-debug", + "configurePreset": "linux-gcc" + }, + { + "name": "build-linux-gcc-release", + "displayName": "Release", + "description": "Build gcc release on linux", + "inherits": "build-common-release", + "configurePreset": "linux-gcc" + }, + { + "name": "build-linux-clang-debug", + "displayName": "Debug", + "description": "Build clang debug on linux", + "inherits": "build-common-debug", + "configurePreset": "linux-clang" + }, + { + "name": "build-linux-clang-release", + "displayName": "Release", + "description": "Build clang release on linux", + "inherits": "build-common-release", + "configurePreset": "linux-clang" } ], "testPresets": [ @@ -177,60 +177,60 @@ } }, { - "name": "test-common-debug", - "description": "Test CMake settings that apply to debug configurations", - "hidden": true, - "inherits": "test-common", - "configuration": "Debug" + "name": "test-common-debug", + "description": "Test CMake settings that apply to debug configurations", + "hidden": true, + "inherits": "test-common", + "configuration": "Debug" }, { - "name": "test-common-release", - "description": "Test CMake settings that apply to release configurations", - "hidden": true, - "inherits": "test-common", - "configuration": "Release" + "name": "test-common-release", + "description": "Test CMake settings that apply to release configurations", + "hidden": true, + "inherits": "test-common", + "configuration": "Release" }, { - "name": "test-windows-msvc-debug", - "displayName": "Debug", - "description": "Set Strict rules for windows msvc debug tests", - "inherits": "test-common-debug", - "configurePreset": "windows-msvc" + "name": "test-windows-msvc-debug", + "displayName": "Debug", + "description": "Set Strict rules for windows msvc debug tests", + "inherits": "test-common-debug", + "configurePreset": "windows-msvc" }, { - "name": "test-windows-msvc-release", - "displayName": "Release", - "description": "Set Strict rules for windows msvc release tests", - "inherits": "test-common-release", - "configurePreset": "windows-msvc" + "name": "test-windows-msvc-release", + "displayName": "Release", + "description": "Set Strict rules for windows msvc release tests", + "inherits": "test-common-release", + "configurePreset": "windows-msvc" }, { - "name": "test-linux-gcc-debug", - "displayName": "Debug", - "description": "Set Strict rules for linux gcc debug tests", - "inherits": "test-common-debug", - "configurePreset": "linux-gcc" + "name": "test-linux-gcc-debug", + "displayName": "Debug", + "description": "Set Strict rules for linux gcc debug tests", + "inherits": "test-common-debug", + "configurePreset": "linux-gcc" }, { - "name": "test-linux-gcc-release", - "displayName": "Release", - "description": "Set Strict rules for linux gcc release tests", - "inherits": "test-common-release", - "configurePreset": "linux-gcc" + "name": "test-linux-gcc-release", + "displayName": "Release", + "description": "Set Strict rules for linux gcc release tests", + "inherits": "test-common-release", + "configurePreset": "linux-gcc" }, { - "name": "test-linux-clang-debug", - "displayName": "Debug", - "description": "Set Strict rules for linux clang debug tests", - "inherits": "test-common-debug", - "configurePreset": "linux-clang" + "name": "test-linux-clang-debug", + "displayName": "Debug", + "description": "Set Strict rules for linux clang debug tests", + "inherits": "test-common-debug", + "configurePreset": "linux-clang" }, { - "name": "test-linux-clang-release", - "displayName": "Release", - "description": "Set Strict rules for linux clang release tests", - "inherits": "test-common-release", - "configurePreset": "linux-clang" + "name": "test-linux-clang-release", + "displayName": "Release", + "description": "Set Strict rules for linux clang release tests", + "inherits": "test-common-release", + "configurePreset": "linux-clang" } ] } \ No newline at end of file From 2bff08fe5cd3a8ffe2885bbbf8662111ac571842 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Sat, 26 Mar 2022 19:12:58 +0200 Subject: [PATCH 4/5] Remove unecessary description --- CMakePresets.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index be579b78..9a04145c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -52,7 +52,7 @@ { "name": "windows-msvc", "displayName": "msvc", - "description": "Target Windows with the msvc compiler, debug build type", + "description": "Target Windows with the msvc compiler", "inherits": "config-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "cl", @@ -68,7 +68,7 @@ { "name": "windows-clang", "displayName": "clang", - "description": "Target Windows with the clang compiler, debug build type", + "description": "Target Windows with the clang compiler", "inherits": "config-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang-cl", @@ -87,7 +87,7 @@ { "name": "linux-gcc", "displayName": "gcc", - "description": "Target Linux with the gcc compiler, debug build type", + "description": "Target Linux with the gcc compiler", "inherits": "config-linux-common", "cacheVariables": { "CMAKE_C_COMPILER": "gcc", @@ -98,7 +98,7 @@ { "name": "linux-clang", "displayName": "clang", - "description": "Target Linux with the clang compiler, debug build type", + "description": "Target Linux with the clang compiler", "inherits": "config-linux-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang", From a729747941943c54b6970d61b9a0aedb8eb71507 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Sat, 26 Mar 2022 19:29:39 +0200 Subject: [PATCH 5/5] Let each IDE to set its own default binary and instal directory --- CMakePresets.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 9a04145c..a33a8802 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,9 +10,7 @@ "name": "config-common", "description": "General settings that apply to all configurations", "hidden": true, - "generator": "Ninja Multi-Config", - "binaryDir": "${sourceDir}/out/build/${presetName}", - "installDir": "${sourceDir}/out/install/${presetName}" + "generator": "Ninja Multi-Config" }, { "name": "config-windows-common",