Skip to content

build: CMakePresets.json, with CI configured through it - #395

Merged
markaren merged 2 commits into
devfrom
cmake-presets
Jul 30, 2026
Merged

build: CMakePresets.json, with CI configured through it#395
markaren merged 2 commits into
devfrom
cmake-presets

Conversation

@markaren

Copy link
Copy Markdown
Owner

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.

markaren and others added 2 commits July 30, 2026 17:05
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>
@markaren
markaren marked this pull request as ready for review July 30, 2026 16:04
@markaren
markaren merged commit 096eb37 into dev Jul 30, 2026
9 checks passed
@markaren
markaren deleted the cmake-presets branch July 30, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant