Add a CMake preset for maintainer flags

This commit is contained in:
ISSOtm
2026-03-14 15:59:57 -04:00
committed by Rangi
parent d524884799
commit e63ce24e48
4 changed files with 29 additions and 9 deletions

View File

@@ -31,7 +31,7 @@ jobs:
- name: Build & install using CMake
if: matrix.buildsys == 'cmake'
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DSANITIZERS=ON -DMORE_WARNINGS=ON -DTESTS_OS_NAME=${{ matrix.os }}
cmake -S . -B build --preset develop -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DTESTS_OS_NAME=${{ matrix.os }}
cmake --build build -j --verbose
sudo cmake --install build --verbose
- name: Package binaries
@@ -159,8 +159,8 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: | # BUILD_SHARED_LIBS causes the output DLL to be called `z.dll` as of zlib 1.3.2 (formerly `zlib1.dll`)
cmake -S zlib -B zbuild -A ${{ matrix.platform }} -Wno-dev -DCMAKE_INSTALL_PREFIX=install_dir -DBUILD_SHARED_LIBS=ON
cmake --build zbuild --config Release -j
cmake -S zlib -B zbuild -A ${{ matrix.platform }} -Wno-dev -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON
cmake --build zbuild --config Debug -j
- name: Install zlib
run: |
cmake --install zbuild
@@ -168,16 +168,16 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
cmake -S libpng -B pngbuild -A ${{ matrix.platform }} -Wno-dev -DCMAKE_INSTALL_PREFIX=install_dir -DPNG_SHARED=ON -DPNG_STATIC=OFF -DPNG_TESTS=OFF
cmake --build pngbuild --config Release -j
cmake -S libpng -B pngbuild -A ${{ matrix.platform }} -Wno-dev -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Debug -DPNG_SHARED=ON -DPNG_STATIC=OFF -DPNG_TESTS=OFF
cmake --build pngbuild --config Debug -j
- name: Install libpng
run: |
cmake --install pngbuild
- name: Build Windows binaries
shell: bash
run: |
cmake -S . -B build -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j --verbose
cmake -S . -B build -A ${{ matrix.platform }} --preset develop -DCMAKE_INSTALL_PREFIX=install_dir
cmake --build build --config Debug -j --verbose
cmake --install build --verbose --prefix install_dir
- name: Package binaries
shell: bash

View File

@@ -58,6 +58,7 @@ rgbds/
├── .clang-format
├── .clang-tidy
├── CMakeLists.txt
├── CMakePresets.json
├── compile_flags.txt
├── Dockerfile
└── Makefile
@@ -107,6 +108,8 @@ rgbds/
Configuration for C++ static analysis with [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) (for which we define the shortcut `make tidy`).
- **`CMakeLists.txt`:**
Defines how to build RGBDS with CMake.
- **`CMakePresets.json`:**
Defines some [presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) useful for working with our CMake.
- **`compile_flags.txt`:**
Compiler flags for `clang-tidy`.
- **`Dockerfile`:**

17
CMakePresets.json Normal file
View File

@@ -0,0 +1,17 @@
{
"version": 3,
"configurePresets": [
{
"name": "develop",
"description": "Debugging config for maintainers",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"MORE_WARNINGS": true,
"SANITIZERS": true
},
"warnings": { "uninitialized": true },
"errors": { "dev": true }
}
]
}

View File

@@ -61,7 +61,7 @@ years). If you are adding new files, you need to use the
4. Compile your changes with `make develop` instead of just `make`. This
target checks for additional warnings. Your patches shouldn't introduce any
new warning (but it may be possible to remove some warning checks if it makes
the code much easier).
the code much easier). You can also use `cmake --preset develop` if you prefer.
5. Test your changes by running `./run-tests.sh` in the `test` directory.
(You must run `./fetch-test-deps.sh` first; if you forget to, the test suite
will fail and remind you mid-way.)