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 df7a443
Browse filesBrowse the repository at this point in the historyBrowse files
feat(pack): ship a library as interface + prebuilt binaries (#433)
Closes#433.
`mcpp pack <target>` now ships a library as **interface + prebuilt binaries**,
and a consumer builds against it through the ordinary dependency path.
**No new manifest section and no new key.** `[targets.<n>].kind` decides what is
packed (so there is no `--lib`, no `--artifact`), the published interface is the
module closure of the lib root, the public headers are `include_dirs` in full,
and each leg's ABI tag, digest and provenance ride on the existing
`[[runtime.artifacts]]`. The result is an ordinary mcpp package, which is why an
older mcpp can still build against it — it simply does not run the gates.
**Two gates, both for failures that are otherwise silent:** an ABI tag mismatch
(measured: swapping two struct fields in a shipped interface compiled, linked,
ran, printed wrong data, and produced no diagnostic at all) and an interface
digest that ties the published sources to the binaries they were built from.
**`kind = "shared"` beyond ELF.** Mach-O and PE/MinGW are supported now — the PE
side needed the import library modelled (a PE shared library is two files, and
mingw's tolerance for linking the `.dll` directly was hiding that), Mach-O needed
`@rpath` install names or every relocated `.dylib` would report `image not
found`. MSVC stays refused, for the real reason: it exports nothing from a DLL
without `__declspec(dllexport)`, so the import library would be empty.
**Three pre-existing defects fixed on the way**, each with its own regression
test: `[target.'<triple>'.build]` never matched on a native build; `sources = []`
was byte-identical to omitting the key; an implementation partition (`module
M:part;`) was recorded as requiring its own name, which left the graph with no
ordering edge and failed on Windows clang with `failed to read compiled module`.
And `--target` no longer accepts a target this host cannot produce — it used to
resolve the native compiler and deliver an ELF as a Windows build.
Docs: `docs/12-binary-distribution.md` (+ zh), `examples/05-lib-distribution`.
Design, measurements and the four designs my own experiments disproved:
`.agents/docs/2026-08-17-library-distribution-design.md`.
0 commit comments