From ef8029d46fa01a41470cad2135bd9543eea0530a Mon Sep 17 00:00:00 2001 From: jadebenn Date: Fri, 5 Apr 2024 23:30:26 -0500 Subject: [PATCH] update cmake configs --- CMakeLists.txt | 2 +- CMakePresets.json | 82 ++++++++++++++++++-------------- build.sh | 2 +- cmake/toolchains/linux-gcc.cmake | 2 +- 4 files changed, 48 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6734db71..538b44b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ if(UNIX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -fPIC") elseif(MSVC) # Skip warning for invalid conversion from size_t to uint32_t for all targets below for now - add_compile_options("/wd4267" "/utf-8") + add_compile_options("/wd4267" "/utf-8" "/volatile:iso") elseif(WIN32) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() diff --git a/CMakePresets.json b/CMakePresets.json index 8def3284..e7850520 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -14,32 +14,32 @@ "generator": "Unix Makefiles" }, { - "name": "debug-base", + "name": "debug-config", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, { - "name": "release-base", + "name": "release-config", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "clang-base", + "name": "clang-config", "hidden": true, "toolchainFile": "${sourceDir}/cmake/toolchains/linux-clang.cmake" }, { - "name": "gcc-base", + "name": "gcc-config", "hidden": true, "toolchainFile": "${sourceDir}/cmake/toolchains/linux-gcc.cmake" }, { - "name": "ci-windows-2022", - "displayName": "CI configure step for Windows", + "name": "windows-msvc", + "displayName": "[Multi] Windows (MSVC)", "description": "Set architecture to 64-bit (b/c RakNet)", "inherits": "default", "generator": "Visual Studio 17 2022", @@ -57,7 +57,7 @@ }, { "name": "windows-default", - "inherits": "ci-windows-2022", + "inherits": "windows-msvc", "displayName": "Windows only Configure Settings", "description": "Sets build and install directories", "generator": "Ninja", @@ -72,7 +72,7 @@ } }, { - "name": "linux-base", + "name": "linux-config", "inherits": "default", "hidden": true, "condition": { @@ -82,7 +82,7 @@ } }, { - "name": "macos-base", + "name": "macos-config", "inherits": "default", "hidden": true, "condition": { @@ -94,9 +94,9 @@ { "name": "linux-clang-debug", "inherits": [ - "linux-base", - "clang-base", - "debug-base" + "linux-config", + "clang-config", + "debug-config" ], "displayName": "[Debug] Linux (Clang)", "description": "Create a debug build using the Clang toolchain for Linux" @@ -104,9 +104,9 @@ { "name": "linux-clang-release", "inherits": [ - "linux-base", - "clang-base", - "release-base" + "linux-config", + "clang-config", + "release-config" ], "displayName": "[Release] Linux (Clang)", "description": "Create a release build using the Clang toolchain for Linux" @@ -114,9 +114,9 @@ { "name": "linux-gcc-debug", "inherits": [ - "linux-base", - "gcc-base", - "debug-base" + "linux-config", + "gcc-config", + "debug-config" ], "displayName": "[Debug] Linux (GCC)", "description": "Create a debug build using the GNU toolchain for Linux" @@ -124,9 +124,9 @@ { "name": "linux-gcc-release", "inherits": [ - "linux-base", - "gcc-base", - "release-base" + "linux-config", + "gcc-config", + "release-config" ], "displayName": "[Release] Linux (GCC)", "description": "Create a release build using the GNU toolchain for Linux" @@ -134,8 +134,8 @@ { "name": "macos-debug", "inherits": [ - "macos-base", - "release-base" + "macos-config", + "release-config" ], "displayName": "[Debug] MacOS", "description": "Create a debug build using MacOS" @@ -143,8 +143,8 @@ { "name": "macos-release", "inherits": [ - "macos-base", - "release-base" + "macos-config", + "release-config" ], "displayName": "[Release] MacOS", "description": "Create a release build using MacOS" @@ -159,13 +159,21 @@ "jobs": 2 }, { - "name": "ci-windows-2022", - "configurePreset": "ci-windows-2022", - "displayName": "Windows CI Build", - "description": "This preset is used by the CI build on windows", - "configuration": "Release", + "name": "windows-msvc-debug", + "configurePreset": "windows-msvc", + "displayName": "[Debug] Windows (MSVC)", + "description": "This preset is used to build in debug mode using the MSVC toolchain on Windows", + "configuration": "Debug", "jobs": 2 }, + { + "name": "windows-msvc-release", + "configurePreset": "windows-msvc", + "displayName": "[Release] Windows (MSVC)", + "description": "This preset is used to build in release mode using the MSVC toolchain on Windows", + "configuration": "Release", + "jobs": 2 + }, { "name": "linux-clang-debug", "configurePreset": "linux-clang-debug", @@ -227,11 +235,11 @@ } }, { - "name": "ci-windows-2022", + "name": "windows-msvc", "inherits": "default", - "configurePreset": "ci-windows-2022", - "displayName": "CI Tests on windows", - "description": "Runs all tests on a windows configuration", + "configurePreset": "windows-msvc", + "displayName": "[Multi] Windows (MSVC)", + "description": "Runs all tests on a Windows configuration", "configuration": "Release", "filter": { "exclude": { @@ -313,15 +321,15 @@ "steps": [ { "type": "configure", - "name": "ci-windows-2022" + "name": "windows-msvc" }, { "type": "build", - "name": "ci-windows-2022" + "name": "windows-msvc-release" }, { "type": "test", - "name": "ci-windows-2022" + "name": "windows-msvc" } ] }, diff --git a/build.sh b/build.sh index 4b1e7df1..3f36e8a3 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,7 @@ mkdir -p build cd build # Run cmake to generate make files -cmake .. -DCMAKE_BUILD_TYPE="Release" +cmake -DCMAKE_BUILD_TYPE="Release" .. # To build utilizing multiple cores, append `-j` and the amount of cores to utilize, for example `cmake --build . --config Release -j8' cmake --build . --config Release $1 diff --git a/cmake/toolchains/linux-gcc.cmake b/cmake/toolchains/linux-gcc.cmake index c4e0891b..d55af82f 100644 --- a/cmake/toolchains/linux-gcc.cmake +++ b/cmake/toolchains/linux-gcc.cmake @@ -1,4 +1,4 @@ -# Try and find a gcc/g++ install, falling back to a generic clang install otherwise +# Try and find a gcc/g++ install find_program(GNU_C_COMPILER gcc REQUIRED) find_program(GNU_CXX_COMPILER g++ REQUIRED)