Skip to content

Commit 8277a76

Browse files
committed
Merge origin/main (0.7.1) into the #622 branch; the collection becomes 0.8.0
2 parents 570d654 + 9bca826 commit 8277a76

14 files changed

Lines changed: 449 additions & 45 deletions

File tree

.github/workflows/ci.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,16 @@ jobs:
894894
run: |
895895
"$MCPP" build
896896
"$MCPP" run | tee run.log
897-
grep -q '^scale.slang: magic=07230203' run.log
897+
# TWO SHADERS, AND THE ENTRY POINT'S NAME IS THE MEASUREMENT.
898+
#
899+
# `-fvk-use-entrypoint-name` reaches slangc through
900+
# `options::extra_args` and makes the module carry the function's
901+
# name instead of `main`; `-DOFFSET_ENTRY` reaches ONE shader through
902+
# `options::per_file` and switches its name again. The consumer reads
903+
# both names out of the SPIR-V bytes, and `scale.slang` would report
904+
# `wrongMain` if the per-file macro had leaked to it.
905+
grep -q '^scale.slang: magic=07230203 .* entry=computeMain ok' run.log
906+
grep -q '^offset.slang: magic=07230203 .* entry=offsetMainDefined ok' run.log
898907
grep -q '^all ok' run.log
899908
if grep -rn 'scale\.h\|\.inc"' src/; then
900909
echo "FAIL: a consumer source names a generated file"
@@ -904,6 +913,51 @@ jobs:
904913
target/.build-mcpp/out/slang/slang_consumer.shaders.cppm
905914
echo "ok: a Slang shader reached through the same surface as a GLSL one"
906915
916+
# THE NEGATIVE LEG. A `per_file` key that names no shader must refuse the
917+
# build and list what it could have named; a rule that applied nothing
918+
# and built anyway would hand the project a module it believes carries
919+
# the option. Without this half the table could silently become a no-op
920+
# and every positive assertion above would still pass.
921+
- name: rules-slang refuses a per_file key that names no shader
922+
working-directory: tests/slang-consumer
923+
run: |
924+
cp build.mcpp /tmp/build.mcpp.bak
925+
sed -i 's|shaders/offset.slang|shaders/offest.slang|' build.mcpp
926+
if "$MCPP" build > refused.log 2>&1; then
927+
cp /tmp/build.mcpp.bak build.mcpp
928+
echo "FAIL: a mistyped per_file key built anyway"; cat refused.log; exit 1
929+
fi
930+
cp /tmp/build.mcpp.bak build.mcpp
931+
grep -q 'per_file. names .shaders/offest.slang., and no shader' refused.log
932+
grep -q '^ shaders/offset.slang' refused.log
933+
echo "ok: refused by name, and the shaders it could have named were listed"
934+
935+
# THE THIRD STORAGE, FOR SLANG. `options::storage` is new in 0.7.0; before
936+
# it the rule embedded unconditionally. The consumer's source is the one
937+
# `slang-consumer` has minus the per-file assertions, and the reverse leg
938+
# is the point of the storage, as `spirv-sidecar` records.
939+
- name: rules-slang with sidecar storage
940+
working-directory: tests/slang-sidecar
941+
run: |
942+
"$MCPP" build
943+
"$MCPP" run | tee run.log
944+
grep -q '^magic=07230203' run.log
945+
grep -q '^all ok' run.log
946+
test -f target/.build-mcpp/out/slang/scale.spv
947+
if grep -q 'source-embed' target/*/*/build.ninja; then
948+
echo "FAIL: sidecar storage still asked slangc to embed"; exit 1
949+
fi
950+
bin=$(ls target/*/*/bin/slang-sidecar)
951+
bin=$(cd "$(dirname "$bin")" && pwd)/$(basename "$bin")
952+
if (cd /tmp && "$bin" > away.log 2>&1); then
953+
echo "FAIL: the sidecar program succeeded from the wrong directory"
954+
cat /tmp/away.log
955+
exit 1
956+
fi
957+
grep -q 'sidecar payload was not found' /tmp/away.log \
958+
|| { echo "FAIL: it failed for some other reason"; cat /tmp/away.log; exit 1; }
959+
echo "ok: a Slang payload found from the package root, reported missing from elsewhere"
960+
907961
# A tool, not a rule: the header is written while the build program runs,
908962
# so there is no action to schedule. The second build is the measurement
909963
# that matters -- editing the data file must reach the binary, which is

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ imports each one from `build.mcpp` under the module name the member declares.
66

77
```toml
88
[build-dependencies.mcpp]
9-
plugins = { version = "0.7.0", features = ["rules-spirv"], host-module = true }
9+
plugins = { version = "0.8.0", features = ["rules-spirv"], host-module = true }
1010
```
1111

1212
`[build-dependencies]`, not `[dependencies]`. The two keys answer separate
@@ -66,7 +66,7 @@ engine's own module family and is not used here.
6666
| `rules-ascendc` | `mcpp.rules.ascendc` | 2026.9.6.6 | `[build] accel = "ascend8.5+{dav-c220}"`, a constrained glob for `*.asc`. Compiles with BiSheng in MIXED mode, so the object carries the device binary and a host-callable launcher and joins the ordinary link -- no registration file and no device-link step. Its own engine needs are `.asc` in the device-source table and `mcpp::link_flag` for the `-rpath-link` the toolkit's shared libraries require, both 2026.9.6.5 |
6767
| `rules-cuda` | `mcpp.rules.cuda` | 2026.9.6.6 | `[build] accel = "cuda…"`, a constrained glob for `*.cu`; the clang route with an LLVM toolchain, the nvcc route with a GCC one |
6868
| `rules-hip` | `mcpp.rules.hip` | 2026.9.6.6 | `[build] accel = "hip, cuda12.9+{sm_89}"`, a constrained glob for `*.hip`. On the NVIDIA platform HIP is a header layer over the CUDA runtime, so the compiler is the project's own clang and there is no ROCm on the machine |
69-
| `rules-slang` | `mcpp.rules.slang` | 2026.9.7.1 | `[build] accel = "vulkan1.2"`, a constrained glob for `*.slang`. Slang is a different language from GLSL rather than a second driver for it -- its own module system, generics, and targets beyond SPIR-V -- so it is a rule of its own. `.slang` is **not** in the engine's device-source table: this feature declares `device_extensions = [".slang"]` and `rule_module = "mcpp.rules.slang"`, and the engine routes it from there. That is the criterion for the whole arrangement -- a new device language costs no engine release |
69+
| `rules-slang` | `mcpp.rules.slang` | 2026.9.7.1 | `[build] accel = "vulkan1.2"`, a constrained glob for `*.slang`. Slang is a different language from GLSL rather than a second driver for it -- its own module system, generics, and targets beyond SPIR-V -- so it is a rule of its own. `.slang` is **not** in the engine's device-source table: this feature declares `device_extensions = [".slang"]` and `rule_module = "mcpp.rules.slang"`, and the engine routes it from there. That is the criterion for the whole arrangement -- a new device language costs no engine release. Since 0.7.0 it has the same `options::storage` axis as `rules-spirv` (header / object / sidecar), `options::extra_args` for the arguments the rule has no field for, and `options::per_file` for what one shader gets that the others do not -- a project with a `-fvk-use-gl-layout` and one shader needing `-emit-spirv-via-glsl` writes both without leaving one `compile()` call |
7070
| `rules-spirv` | `mcpp.rules.spirv` | 2026.9.6.6 | `[build] accel = "vulkan1.2"`, a constrained glob for the shader stages; compiles each shader through a `role = "source"` action and states which of the two compilers produced it |
7171
| `rules-sycl` | `mcpp.rules.sycl` | 2026.9.6.6 | `[build] accel = "sycl"` or `"sycl, cuda12.9+{sm_89}"`, a constrained glob for `*.sycl`, and `compat:sycl-runtime` so the artifact can reach `libsycl.so.9` at run time. Its own engine need is `.sycl` in the device-source table, 2026.9.6.1 |
7272
| `tools-embed` | `mcpp.tools.embed` | 2026.9.5.4 | nothing beyond mcpp: it reads a file and writes a header while the build program runs. The floor is the release whose fast path compares a declared file input, without which an edit to the data does not reach the binary |
@@ -83,7 +83,7 @@ A project names the rule and nothing else:
8383

8484
```toml
8585
[build-dependencies.mcpp]
86-
plugins = { version = "0.7.0", features = ["rules-cuda"], host-module = true }
86+
plugins = { version = "0.8.0", features = ["rules-cuda"], host-module = true }
8787
```
8888

8989
The payloads each rule drives are declared **here**, under the feature that
@@ -167,6 +167,15 @@ looks harmless.
167167
0.5.0, 0.5.1 and 0.5.2 do not move it. Naming an island's entry points is a
168168
change to what this package generates, not to what it asks the engine for.
169169

170+
0.7.1 does not move it either, and records a compiler rather than an engine:
171+
under MSVC 14.52 (36629 and 36725, measured on xrgui's CI) a module that has
172+
instantiated `std::filesystem::path`'s iterator poisons every importer that
173+
touches `path` again -- `filesystem(1572): error C2801: '_Path_iterator<...>::operator =='
174+
must be a non-static member`. Nothing in this package instantiates that
175+
iterator now: the lib root reads paths apart as strings
176+
(`mcpp::plugins::names::components`), and the members' relative-path
177+
arithmetic is `mcpp::plugins::names::relative_to`.
178+
170179
The previous shared floor was 2026.9.7.1, the release that reads
171180
`device_extensions` and `rule_module`, reports `[language] modules` and the
172181
package's own name to a build program, writes the build program a declared rule
@@ -324,8 +333,8 @@ consumer compiled either way is the same source.
324333
relative to the working directory, so the program finds its payloads when run
325334
from the package root and does not when run from elsewhere -- which is why it is
326335
not the default, and why `mcpp pack` of such a program has something further to
327-
collect. `tests/spirv-sidecar` asserts both halves: found from the root, and
328-
reported missing from `/tmp`.
336+
collect. `tests/spirv-sidecar` and `tests/slang-sidecar` assert both halves: found
337+
from the root, and reported missing from `/tmp`.
329338
330339
**The default follows the project.** `[language] modules = true` gives the
331340
module surface, `false` gives a header with the same declarations. mcpp reports

dist/appimage.cppm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ inline plan plan_for(options opt = {}) {
361361
p.reason = "no launcher in the staged tree";
362362
return p;
363363
}
364-
const auto launcher_rel =
365-
std::filesystem::path(launcher).lexically_relative(stage).generic_string();
364+
// Strings, not `lexically_relative`: see `mcpp::plugins::names::relative_to`.
365+
const auto launcher_rel = mcpp::plugins::names::relative_to(launcher, stage);
366366

367367
// ── The three files AppImage requires, written into the staged tree ────
368368
const std::string name = app_name_for(opt);

mcpp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "plugins"
33
namespace = "mcpp"
4-
version = "0.7.0"
4+
version = "0.8.0"
55
description = "Official mcpp build plugins: rule packages under mcpp.rules.*, build-time utilities under mcpp.tools.*, each member selected by a feature"
66
license = "Apache-2.0"
77
authors = ["mcpp-community"]

0 commit comments

Comments
 (0)