File tree Expand file tree Collapse file tree
tests/examples/build-mcpp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 workflow_dispatch :
1212
1313env :
14- # Bumped to 0.0.77 : carries L1 platform-conditional deps/flags + [xlings] env ,
14+ # Bumped to 0.0.78 : carries L3 build.mcpp native build program (build-mcpp member) ,
1515 # compat.openblas Windows recipe (bin/libopenblas.dll staged beside the .exe).
16- MCPP_VERSION : " 0.0.77 "
16+ MCPP_VERSION : " 0.0.78 "
1717
1818jobs :
1919 lint :
@@ -326,14 +326,14 @@ jobs:
326326 include :
327327 - platform : macos
328328 os : macos-15
329- archive : mcpp-0.0.77 -macosx-arm64.tar.gz
330- root : mcpp-0.0.77 -macosx-arm64
329+ archive : mcpp-0.0.78 -macosx-arm64.tar.gz
330+ root : mcpp-0.0.78 -macosx-arm64
331331 mcpp : bin/mcpp
332332 xlings : registry/bin/xlings
333333 - platform : windows
334334 os : windows-latest
335- archive : mcpp-0.0.77 -windows-x86_64.zip
336- root : mcpp-0.0.77 -windows-x86_64
335+ archive : mcpp-0.0.78 -windows-x86_64.zip
336+ root : mcpp-0.0.78 -windows-x86_64
337337 mcpp : bin/mcpp.exe
338338 xlings : registry/bin/xlings.exe
339339 steps :
Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ tests/examples/*/target/
44tests /examples /* /.mcpp /
55tests /examples /* /compile_commands.json
66tests /examples /* /mcpp.lock
7+ # build.mcpp-generated source (regenerated each build by the build program)
8+ tests /examples /build-mcpp /src /generated.cpp
Original file line number Diff line number Diff line change 55# .agents/docs/2026-06-29-mcpp-native-workspace-ci-design.md.
66[workspace ]
77members = [
8+ " tests/examples/build-mcpp" ,
89 " tests/examples/cjson" ,
910 " tests/examples/eigen" ,
1011 " tests/examples/nlohmann.json" ,
Original file line number Diff line number Diff line change 1+ // Native build program. mcpp compiles this with the host toolchain and runs it
2+ // before the main build; its stdout `mcpp:` directives augment the build. Here we
3+ // generate a source file and define a macro that main.cpp asserts on.
4+ #include <cstdio>
5+ #include <fstream>
6+
7+ int main() {
8+ std::ofstream("src/generated.cpp")
9+ << "int answer() { return 42; }\n";
10+
11+ std::puts("mcpp:generated=src/generated.cpp");
12+ std::puts("mcpp:cxxflag=-DBUILT_BY_BUILD_MCPP=1");
13+ std::puts("mcpp:rerun-if-changed=build.mcpp");
14+ return 0;
15+ }
Original file line number Diff line number Diff line change 1+ # L3 build.mcpp consumer: a project-local native build program (mcpp >= 0.0.78)
2+ # generates a source and emits a compile define, both consumed by main.cpp. No
3+ # registry dependency — this member exercises the build.mcpp pipeline itself
4+ # (Zig build.zig / Cargo build.rs analog, in C++).
5+ [package ]
6+ name = " build-mcpp-example"
7+ version = " 0.1.0"
8+
9+ [targets .build-mcpp-example ]
10+ kind = " bin"
11+ main = " src/main.cpp"
Original file line number Diff line number Diff line change 1+ // Consumes both outputs of build.mcpp: the -DBUILT_BY_BUILD_MCPP define and the
2+ // generated answer() function. Returns 0 only if both took effect.
3+ #ifndef BUILT_BY_BUILD_MCPP
4+ #error "build.mcpp cxxflag did not reach this translation unit"
5+ #endif
6+
7+ int answer (); // defined in the generated src/generated.cpp
8+
9+ int main () { return answer () == 42 ? 0 : 1 ; }
You can’t perform that action at this time.
0 commit comments