From 3785affe4107c66958786522eaede676f168fb4e Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Sun, 1 Dec 2024 22:17:00 -0500 Subject: [PATCH] dev(cmake): make ninja primary build folder --- .github/workflows/cmake-ninja.yml | 6 ++--- .gitignore | 6 ++++- CMakeLists.txt | 2 +- CMakePresets.json | 44 +++++++++++++++---------------- docs/CONTRIBUTING.md | 15 ++++++++--- 5 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.github/workflows/cmake-ninja.yml b/.github/workflows/cmake-ninja.yml index e54179d0..0a79e3b4 100644 --- a/.github/workflows/cmake-ninja.yml +++ b/.github/workflows/cmake-ninja.yml @@ -37,13 +37,13 @@ jobs: run: md www - name: Copy Binaries (x64) - run: copy build.ninja\Release\*.addon64 www\ + run: copy build\Release\*.addon64 www\ - name: Copy Binaries (x32) - run: copy build32.ninja\Release\*.addon32 www\ + run: copy build32\Release\*.addon32 www\ - name: Copy Binaries (Tools) - run: copy build.ninja\Release\*.exe www\ + run: copy build\Release\*.exe www\ - name: Upload artifact uses: actions/upload-pages-artifact@v1 diff --git a/.gitignore b/.gitignore index 9828d11f..89b94d3a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,8 +32,12 @@ *.app build/** -build.ninja/** build32/** +build.ninja/** +build32.ninja/** +build.vs/** +build32.vs/** + **/.vshistory/ .cache/** diff --git a/CMakeLists.txt b/CMakeLists.txt index a20fe142..c0f999f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.17.2) +cmake_minimum_required(VERSION 3.27) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/CMakePresets.json b/CMakePresets.json index 4735c253..8883d47e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -53,13 +53,13 @@ "CMAKE_C_COMPILER": "cl.exe", "CMAKE_CXX_COMPILER": "cl.exe" }, - "binaryDir": "build.ninja" + "binaryDir": "build" }, { "name": "ninja-x32", "inherits": "ninja-x64", "displayName": "Ninja x32", - "binaryDir": "build32.ninja" + "binaryDir": "build32" }, { "name": "vs-x64", @@ -67,7 +67,7 @@ "description": "Generates Visual Studio solution and project files. Slower build than ninja.", "inherits": "x64", "generator": "Visual Studio 17 2022", - "binaryDir": "build", + "binaryDir": "build.vs", "cacheVariables": { "CMAKE_SYSTEM_VERSION": "10.0.26100.0" } @@ -76,7 +76,7 @@ "name": "vs-x32", "inherits": "vs-x64", "displayName": "Visual Studio x32", - "binaryDir": "build32" + "binaryDir": "build32.vs" } ], "buildPresets": [ @@ -98,24 +98,6 @@ "configurePreset": "ninja-x64", "configuration": "RelWithDebInfo" }, - { - "name": "vs-x64-debug", - "displayName": "Visual Studio x64 Debug", - "configurePreset": "vs-x64", - "configuration": "Debug" - }, - { - "name": "vs-x64-release", - "displayName": "Visual Studio x64 Release", - "configurePreset": "vs-x64", - "configuration": "Release" - }, - { - "name": "vs-x64-RelWithDebInfo", - "displayName": "Visual Studio x64 RelWithDebInfo", - "configurePreset": "vs-x64", - "configuration": "RelWithDebInfo" - }, { "name": "ninja-x32-debug", "displayName": "Ninja x32 Debug", @@ -134,6 +116,24 @@ "configurePreset": "ninja-x32", "configuration": "RelWithDebInfo" }, + { + "name": "vs-x64-debug", + "displayName": "Visual Studio x64 Debug", + "configurePreset": "vs-x64", + "configuration": "Debug" + }, + { + "name": "vs-x64-release", + "displayName": "Visual Studio x64 Release", + "configurePreset": "vs-x64", + "configuration": "Release" + }, + { + "name": "vs-x64-RelWithDebInfo", + "displayName": "Visual Studio x64 RelWithDebInfo", + "configurePreset": "vs-x64", + "configuration": "RelWithDebInfo" + }, { "name": "vs-x32-debug", "displayName": "Visual Studio x32 Debug", diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 265db776..c73a327e 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -27,18 +27,25 @@ Update the submodules Configure the project -* `cmake --preset vs-x64` +* `cmake --preset ninja-x64` Build the project -* `cmake --build --preset vs-x64-release` +* `cmake --build --preset ninja-x64-release` ---------------- *Note: for 32bit binaries use:* -* `cmake --preset vs-x32` -* `cmake --build --preset vs-x32-release` +* `cmake --preset ninja-x32` +* `cmake --build --preset ninja-x32-release` + +---------------- + +*Note: for Visual Studio use:* + +* `cmake --preset vs-x64` +* `cmake --build --preset vs-x64-release` ### Automated configuration