Repository navigation
Expand file tree
/
Copy pathmcpp.toml
More file actions
86 lines (81 loc) · 4.13 KB
/
Copy pathmcpp.toml
File metadata and controls
86 lines (81 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# The fixture that compiles every rule and dist member in this collection, on
# whatever host is running the build.
#
# WHY A FIXTURE WHOSE ONLY PRODUCT IS A COMPILATION.
#
# Each of the other consumers exercises one rule end to end, and each of them
# needs that rule's payload: a shader compiler, a CUDA toolkit, a SYCL
# compiler. Those payloads are published for one, two or three platforms, so
# the consumers that need them can only run where they exist -- and the halves
# of a rule that are written for a host are exactly the halves that host never
# compiles.
#
# A rule's host-dependent code is `#if defined(_WIN32)`, a `.exe` suffix, a
# directory named `lib/x64`, a listing command. None of it is compiled by a
# Linux build, so a Windows branch can be syntactically wrong for as long as
# nobody builds on Windows -- and the first person to do so gets a compile
# error out of a package they only wanted to use. A dist member's host-
# dependent code is the same shape -- `dist-wix`'s tool discovery carries its
# own `#if defined(_WIN32)` -- so it belongs in this fixture for the same
# reason a rule does.
#
# This fixture names no accelerator and packages nothing (`mcpp build`, never
# `mcpp pack`). Every rule's `compile()` and every dist member's `plan_for()`
# returns immediately in that state, so no payload is installed and no second
# compiler is needed; what happens is that all nine modules are compiled as
# host modules for this host, which is the assertion. It is cheap enough to
# run on every platform in the matrix.
[package]
name = "all-rules-compile"
namespace = "example"
version = "0.1.0"
description = "Compiles every rule and dist module in this collection for the host running the build"
[language]
standard = "c++23"
modules = true
import_std = true
# Every feature this package publishes. A rule or dist member left out of this
# list is one whose host-dependent code is compiled on one platform only.
[build-dependencies.mcpp]
plugins = { path = "../..", features = [
"rules-ascendc", "rules-cuda", "rules-hip", "rules-metal", "rules-qt", "rules-slang",
"rules-spirv", "rules-swift", "rules-sycl",
"tools-embed", "tools-island",
"dist-appimage", "dist-wix", "dist-apple", "dist-web", "dist-apk",
"dist-apk-kotlin", "dist-apk-maven",
"deps-archive", "deps-cmake", "deps-vcpkg",
], host-module = true }
# NO `accel`, and that is the whole design: with none, every rule returns
# before it looks for a payload, so no RULE downloads anything on any host.
#
# `dist-appimage` IS THE ONE MEMBER THAT CAN DOWNLOAD HERE, and it is listed
# anyway. Its payload is gated on `cfg(linux)` and its feature rather than on an
# accelerator -- provisioning runs before the build program, so `--format`,
# which only the build program learns, cannot be a layer key. On macOS and
# Windows that predicate is closed and this fixture still downloads nothing; on
# Linux it installs 15 MB, which the `appimage-consumer` step in the same job
# installs regardless.
#
# Omitting it was the alternative and is worse: this fixture exists so that
# every member's module is COMPILED on every host, and a member left out is a
# member whose macOS and Windows compile is never attempted -- which is exactly
# the failure the two platform-specific members are here to catch.
#
# `rules-qt` declares no SDK: the rule compiles without one, and the SDK --
# hundreds of megabytes on every host -- is a project's own declaration. The CI
# step that reads this list requires every member that carries SOURCES; a
# member that only declares a payload is optional here.
#
# `deps-vcpkg` and `deps-cmake` declare their installers on the host axis, so
# this fixture installs `xim:vcpkg` (3 MB) and `xim:cmake` on every host. Their
# modules are what is compiled; neither member is asked to install anything.
#
# `dist-apk-kotlin` and `dist-apk-maven` add no source: each implies `dist-apk`
# and declares one payload on the `cfg(env = "android")` axis, which a host
# build never opens. They are listed because a consumer names them, which is
# what the CI step that reads this list counts.
[build]
sources = ["src/*.cpp"]
[targets.all-rules-compile]
kind = "bin"
main = "src/main.cpp"