diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9f5031b0..b5b1c9ed 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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 diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 1962408b..09326bbe 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -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`:** diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..dd7a35ee --- /dev/null +++ b/CMakePresets.json @@ -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 } + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c171ee14..b72e8240 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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.) @@ -254,4 +254,4 @@ manually running: # e.g. to build and tag as 'master' docker build . --tag ghcr.io/gbdev/rgbds:master docker push ghcr.io/gbdev/rgbds:master -``` \ No newline at end of file +```