build: CMakePresets.json, with CI configured through it - #395
Merged
Conversation
Every CI job hand-assembled its own -D list, in eight places across two workflows, so the build that gates a PR and the build a contributor runs locally could differ without anything saying so. The presets are now the one definition of each configuration: ci-linux-asan inherits ci-linux rather than restating it, the ci-* presets inherit the user-facing ones, and every job configures with `cmake --preset`. Job bodies drop to two lines. Ninja everywhere, which is a bigger change than it sounds. Only the Windows job used it; `cmake --build` passes no -j, so Make ran the Linux and macOS compiles ONE AT A TIME. ninja-build is added to every apt list rather than assumed from the runner image; macOS takes it from the image, noted in the job, because a missing generator fails at configure time and is unmissable. ci-python keeps its old -j 2 - that looked like a memory guard for pybind11 TUs rather than a speed choice, so Ninja's default is not let loose there. ASan+UBSan returns to its own job. Sharing a runner meant a plain regression and a sanitizer regression could not be reported independently. Each preset builds into build/<preset-name> so configurations stop clobbering each other, which moves the Pages artifact to build/ci-wasm/bin. ctest runs at the build root through a test preset instead of `cd build/tests`; both see the same 67 tests, checked with ctest -N each way, so the FetchContent'd Catch2 is not quietly contributing its own suite. CMakePresets.json is tracked and CMakeUserPresets.json is now ignored. That is the split CMake intends, and the second half is what makes the first safe to live with. CMAKE_BUILD_TYPE gains a single-config default. WORTH KNOWING, because it is not what it looks like: the visible effect is that multi-config generators stop warning that the presets' CMAKE_BUILD_TYPE went unused, and that comes from READING the variable in the if() condition, not from the assignment. On Windows the assignment never fires at all - MSVC's platform module has already set Debug by the time project() returns. It does something only on Linux and macOS, where an unset build type means no optimisation flags at all. Verified on Windows only: the presets parse and list; a VS-generator configure is warning-free; a Ninja configure resolves the generator through the multi-level inherits; ctest -N agrees across the old and new scope. The CI half - Ninja on Linux, Emscripten under Ninja, the Pages artifact path - is unverified until this branch runs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The other two workflows moved to v6; this one was still pinning v4, so the three disagreed for no reason. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI hand-assembled its -D flags in eight places, so a local build and the one gating a PR could drift silently. The presets are now the single definition — ci-* presets inherit the user-facing ones, and every job configures with cmake --preset.
Ninja on every job. Only Windows used it before; cmake --build passes no -j, so Linux and macOS were compiling serially. ASan+UBSan also moves back to its own job.
Contributors get cmake --preset gl instead of a flag list. CMakeUserPresets.json is gitignored.
CI: all 9 jobs green. Critical path 64.8m → 19.3m; runner-minutes 132 → 75.