You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 551d747
Browse filesBrowse the repository at this point in the historyBrowse files
2026.9.27.1: a build.mcpp can declare a runtime library search directory, joining [runtime] library_dirs
`mcpp::runtime_library_dir(dir)` (`mcpp:runtime-library-dir=`, protocol 12)
is the build-program form of `[runtime] library_dirs`: a launch-time search
directory for a dependency a build.mcpp discovers (a vcpkg prefix's `bin/`,
a Qt SDK's `bin/`) rather than one an author can write into a fixed TOML
array.
It joins the SAME field the manifest key populates
(`RuntimeConfig::libraryDirs`), so every existing consumer of that field
sees a directive-declared entry without any of them changing: `mcpp run`'s
loader path, `mcpp pack`'s closure search, and the ELF/Mach-O
`-Wl,-rpath` rendering. Persisted like `deploy`/`warning`/`pack-format`
(non-empty cache tag, `kCacheEpoch` not bumped, same reasoning), and the
root package's own build.mcpp needed the same manifest-snapshot mirror
`deploy` already has in prepare.cppm, or `resolve_runtime_contract` never
sees a directive-sourced entry.
Adds unit coverage in test_build_directives.cpp and an e2e script
(779) that links an executable against a prebuilt shared library only the
directive's RUNPATH makes loadable, checks the build.mcpp cache-hit replay,
and checks `mcpp pack --format dir`'s closure staging.
Docs: docs/30-build-mcpp.md and docs/zh/30-build-mcpp.md gain the directive,
the typed API entry and a worked section; docs/04-mcpp-toml.md and its zh
counterpart point `[runtime] library_dirs` at the build-program form.
Copy file name to clipboardExpand all lines: docs/30-build-mcpp.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,7 @@ is ignored, so diagnostics may be logged freely.
67
67
|`mcpp:windows-subsystem=<target>:<value>`*(2026.9.12.2+)*| set the PE subsystem (`console` or `windows`) of the executable `<target>` of **this** package, the same field as `[targets.<target>] windows_subsystem` (docs/04). Reaches that target's link and no other, never a consumer, and renders nothing on a target that is not PE. A target the package does not declare with `kind = "bin"`, a value outside the set, and a value that contradicts mcpp.toml are each refused before any directive is applied |
68
68
|`mcpp:windows-entry=<target>:<value>`*(2026.9.12.2+)*| set the entry function (`main`, `wmain`, `WinMain` or `wWinMain`) of the executable `<target>`, the same field as `windows_entry`; the scope and the refusals are those of `windows-subsystem`|
69
69
|`mcpp:deploy=<from>\t<to>`*(2026.9.12.3+, protocol 11)*| place a file this program produced or selected beside the artifact, at `<to>`, relative to the executable's directory — the build-program form of `[runtime] deploy` (docs/04 §2.11). `<from>` may be absolute (an action's own declared output) or resolved against the package root; TAB-separated, because an absolute Windows `<from>` contains a colon. **Reaches the consumer**, joining the same `LinkIntent``link-lib`/`link-search`/`link-flag` feed — see below |
70
+
|`mcpp:runtime-library-dir=<dir>`*(2026.9.27.1+, protocol 12)*| add `<dir>` to the launch-time search path — the build-program form of `[runtime] library_dirs` (docs/04 §2.11). Relative resolves against the package root. **Reaches the consumer**, joining the same `LinkIntent` field the manifest key populates: RUNPATH/rpath on ELF and Mach-O, never `-L`, and `mcpp pack`'s closure search — see below |
70
71
|`mcpp:link-script=<path>`*(2026.8.19+)*| link with this **linker script** (`-T`; relative resolves against the package root, and the emitted path is absolute because the link runs in the build directory). Reaches the **consumer**, unlike `include-dir` — a board's memory layout is the one thing a consumer cannot write for itself |
71
72
|`mcpp:warning=<text>`*(2026.8.21.2+)*| say something to the user and **keep going**. The one directive that changes no compile line, no link line and no source set. Survives the build cache — see below |
72
73
|`mcpp:fact=<name>=<version>`*(2026.9.5.2+)*| state something the program **established about the machine** (`cuda.driver=12.4`). Compared against floors before anything is compiled; see below |
|`mcpp::runner(tok)`*(2026.8.19.2+)*|`mcpp:runner=` — see below |
139
141
|`mcpp::xpkg_dir(ns, name)` / `mcpp::xpkg_dir(name)`*(2026.8.19+)*| the payload directory of a package declared in `[xlings.workspace]` — by this manifest, or by a dependency compiled into this build program *(2026.9.6.6+)*; `""` when it was not declared or is not installed (see below) |
@@ -656,6 +658,38 @@ int main() {
656
658
|`.apk`|`assets/myapp.resources/`|
657
659
| web | the same relative path in the static directory, served beside `<name>.js`. A project that wants the files inside the `.data` preload instead links with `--preload-file <dir>@/<to>`, an ordinary link flag |
658
660
661
+
### A launch-time search directory: `runtime_library_dir` (2026.9.27.1+, protocol 12)
662
+
663
+
`[runtime] library_dirs` (docs/04 §2.11) names a directory to search when the
664
+
artifact runs. It is a fixed TOML array, so it cannot name a directory a
665
+
build.mcpp only discovers — a vcpkg prefix's `bin/`, a Qt SDK's `bin/`, or any
666
+
other prebuilt-dependency layout a build-time probe locates. `mcpp::runtime_library_dir`
667
+
is that same declaration, reached from a build program:
668
+
669
+
```cpp
670
+
import mcpp;
671
+
#include<string>
672
+
673
+
intmain() {
674
+
const std::string qtBin = locate_qt_prefix() + "/bin"; // however this
675
+
// package finds it
676
+
mcpp::link_search(qtBin.c_str());
677
+
mcpp::runtime_library_dir(qtBin.c_str());
678
+
}
679
+
```
680
+
681
+
-**Joins the same field the manifest key populates.** A directive-declared
682
+
directory reaches every consumer of `[runtime] library_dirs` exactly as one
683
+
written in `mcpp.toml` would: `mcpp run`'s loader path, `mcpp pack`'s closure
684
+
search, and RUNPATH/rpath on ELF and Mach-O (never `-L` — a launch-time
685
+
search directory is not a link-library search path).
686
+
-**`dir` may be absolute or package-relative.** A relative value resolves
687
+
against the package root, like every other `AbsPath` directive
688
+
(`include-dir`, `deploy`'s `from`).
689
+
-**Replayed on a cache hit.** A `runtime-library-dir` directive is persisted
690
+
in the build cache like `deploy` and `warning`; a cached run restores it
691
+
exactly as a fresh run would.
692
+
659
693
### Producing a distributable: `pack_format` / `stage_dir` (2026.9.11.1+)
660
694
661
695
An `.msi`, a `.deb`, an AppImage and a signed `.app` are none of the four roles'
0 commit comments