[M4] cargoxx build invokes nix+cmake

This commit is contained in:
2026-05-10 00:04:18 +00:00
parent 807158b8cc
commit f6e8699a72
6 changed files with 121 additions and 29 deletions

View File

@@ -78,6 +78,20 @@ All notable changes to cargoxx will be documented in this file.
and `[build]` honoring `warnings_as_errors` and `sanitizers`. Source
paths emitted relative to `build/` (i.e. prefixed with `../`).
Output is deterministic. `tests/codegen_cmake.cpp` covers 11 cases.
- `cargoxx build` (without `--no-build`) now drives the full build:
`nix develop -c cmake -B build/<profile> -S build -G Ninja
-DCMAKE_BUILD_TYPE=<Profile>` then `nix develop -c cmake --build`
with optional `--target`, both with `inherit_stdio = true` so the
user sees compilation output live. Non-zero cmake exit returns
`BuildCmakeFailed`. End-to-end verified: `cargoxx new myapp &&
cargoxx build` produces a working `build/debug/myapp` that prints
`Hello from myapp!`.
- Generated `build/CMakeLists.txt` now opts into the experimental
`import std;` UUID + `CMAKE_CXX_MODULE_STD ON`, and sets
`CMAKE_CXX_EXTENSIONS ON` (deviation from SPEC §8 — required for
libc++'s std module to load without `module-file-config-mismatch`
on clang 21). Without these the templates from `cargoxx new` fail
to compile.
- `cargoxx.exec`: `ExecResult`, `ExecOptions`, and
`run(program, args, opts)` — argv-only subprocess wrapper around
reproc 14.2.4. Captures stdout/stderr (or inherits stdio when