Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
workflow_dispatch:

env:
# Bumped to 0.0.77: carries L1 platform-conditional deps/flags + [xlings] env,
# Bumped to 0.0.78: carries L3 build.mcpp native build program (build-mcpp member),
# compat.openblas Windows recipe (bin/libopenblas.dll staged beside the .exe).
MCPP_VERSION: "0.0.77"
MCPP_VERSION: "0.0.78"

jobs:
lint:
Expand Down Expand Up @@ -326,14 +326,14 @@ jobs:
include:
- platform: macos
os: macos-15
archive: mcpp-0.0.77-macosx-arm64.tar.gz
root: mcpp-0.0.77-macosx-arm64
archive: mcpp-0.0.78-macosx-arm64.tar.gz
root: mcpp-0.0.78-macosx-arm64
mcpp: bin/mcpp
xlings: registry/bin/xlings
- platform: windows
os: windows-latest
archive: mcpp-0.0.77-windows-x86_64.zip
root: mcpp-0.0.77-windows-x86_64
archive: mcpp-0.0.78-windows-x86_64.zip
root: mcpp-0.0.78-windows-x86_64
mcpp: bin/mcpp.exe
xlings: registry/bin/xlings.exe
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ tests/examples/*/target/
tests/examples/*/.mcpp/
tests/examples/*/compile_commands.json
tests/examples/*/mcpp.lock
# build.mcpp-generated source (regenerated each build by the build program)
tests/examples/build-mcpp/src/generated.cpp
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# .agents/docs/2026-06-29-mcpp-native-workspace-ci-design.md.
[workspace]
members = [
"tests/examples/build-mcpp",
"tests/examples/cjson",
"tests/examples/eigen",
"tests/examples/nlohmann.json",
Expand Down
15 changes: 15 additions & 0 deletions tests/examples/build-mcpp/build.mcpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Native build program. mcpp compiles this with the host toolchain and runs it
// before the main build; its stdout `mcpp:` directives augment the build. Here we
// generate a source file and define a macro that main.cpp asserts on.
#include <cstdio>
#include <fstream>

int main() {
std::ofstream("src/generated.cpp")
<< "int answer() { return 42; }\n";

std::puts("mcpp:generated=src/generated.cpp");
std::puts("mcpp:cxxflag=-DBUILT_BY_BUILD_MCPP=1");
std::puts("mcpp:rerun-if-changed=build.mcpp");
return 0;
}
11 changes: 11 additions & 0 deletions tests/examples/build-mcpp/mcpp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# L3 build.mcpp consumer: a project-local native build program (mcpp >= 0.0.78)
# generates a source and emits a compile define, both consumed by main.cpp. No
# registry dependency — this member exercises the build.mcpp pipeline itself
# (Zig build.zig / Cargo build.rs analog, in C++).
[package]
name = "build-mcpp-example"
version = "0.1.0"

[targets.build-mcpp-example]
kind = "bin"
main = "src/main.cpp"
9 changes: 9 additions & 0 deletions tests/examples/build-mcpp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Consumes both outputs of build.mcpp: the -DBUILT_BY_BUILD_MCPP define and the
// generated answer() function. Returns 0 only if both took effect.
#ifndef BUILT_BY_BUILD_MCPP
#error "build.mcpp cxxflag did not reach this translation unit"
#endif

int answer(); // defined in the generated src/generated.cpp

int main() { return answer() == 42 ? 0 : 1; }
Loading