| name | mcpp |
|---|---|
| description | Use mcpp, the build tool and package manager for C++23 modules - its architecture and concepts, which command a task needs, the project conventions, and what to do when mcpp itself is wrong - analyse it, work around it, report it, fix it. |
mcpp builds C++23 module projects that mcpp.toml describes. Every command
answers --agent-skill-doc with a sheet that ends with the related commands.
- The engine plans a build from data: the manifest, the target's rows and providers, the indices' packages. Every default is data and has an override.
- The home (
~/.mcpp, orMCPP_HOME) holds the toolchains, the std module, the packages and the cache. A compiler of the host is used only when the project states it (mcpp why toolchainsays which one was used). - Two kinds of package. An mcpp package (
namespace.name: a library, a plugin; mcpp-index) is a dependency, resolved before planning and locked inmcpp.lock. A provider's package (xim:name: a tool, a runtime, a toolchain; xim-pkgindex) belongs to the project environment. - The project environment:
[xlings.workspace]lists the tools and runtimes the project's build programs, tests andmcpp runfind onPATH(mcpp add xim:<name>);[xlings] subos = "<name>"keeps it the project's own. - A build program (
build.mcpp) runs before the build and states flags, generated sources and actions; plugins are libraries it imports (mcpp.plugins:rules-*,deps-*,dist-*,tools-*).
| section | commands | for |
|---|---|---|
| Project | new, build, run, test, clean |
make, build, run and test a package |
| Packages | search, info, add, remove, update, fetch, index |
find, read and use packages |
| Inspect | why, resolve, explain |
understand a result or a refusal |
| Distribute | pack, publish, emit, xpkg |
ship a program or a library |
| Machine | toolchain, cache, self |
toolchains, the cache, the home |
Ask mcpp: mcpp --help, mcpp <command> --agent-skill-doc, mcpp why <topic>.
- A module is one
.cppm: the exported interface, thenmodule :private;with what is not exported and the implementation. mcpp builds the private fragment as a unit of its own, so an edit there recompiles no importer. - Dependencies are full identities as dotted keys in name order, as
mcpp addwrites them:mcpplibs.cmdline = "0.3.0"under[dependencies]. - A library is chosen in this order: a module library of mcpp-index (the
mcpplibsnamespace is maintained by its community); the module wrapper of an established library; acompat.*library; a CMake or vcpkg package through thedeps-cmakeordeps-vcpkgplugin. A module that exists is depended on, not written again. - An established C or C++ library (zlib, sqlite3, lua, opencv) is used through
its module wrapper in
mcpplibs.mwraprather than through headers:mcpp search mwrap, https://github.com/mcpplibs/mwrap. - Before using a dependency's interface, read
mcpp info <package> --agent-skill-doc: its author's account of it, read as its documentation. - A key mcpp does not know is reported, never ignored; fix it, do not mute it.
error:stopped the command;warning:andnote:did not;help:is the next step;impact:is what a reduced run lost.- A refusal ends with its reason token (
[layer-cycle]);mcpp explain layer-cyclegives the cause and the remedy, as forE0001andMCPP_*. --message-format json(build, test, pack) and--format json(queries) print JSON on standard output. Exit 0 success, 1 failed, 2 a usage error, 5 stopped by--deny, 70 an internal error.
A defect of mcpp is an exit 70 or a crash, a remedy that does not remedy, a result the documentation states otherwise, or two runs of the same inputs that differ. An error of the compiler in the project's own code is not one.
- Analyse:
mcpp explain <token>;mcpp why toolchain|deps|flags;mcpp build -vfor each step;target/.last-result.json, the record of the last build;mcpp self doctorfor the home. - Reduce it to the smallest project that shows it (
mcpp new repro). - Unblock the work:
mcpp clean,--cache off,-j 1, another--toolchain, or the switch thehelp:line names. A workaround kept in the project carries a comment naming the defect. - Propose a report: mcpp welcomes them. Ask the user before opening it, unless they have already said to; when the cause is located, ask in the same question whether to open a pull request with the fix as well.
- Print the address of what was opened, for the user to review.
An issue (gh issue create -R mcpp-community/mcpp --label bug; or
upstream-bug, documentation, enhancement) carries the command, its full
output, mcpp --version, mcpp self env and the smallest project.
mcpp build and mcpp test in a checkout; AGENTS.md states the rules and
.agents/skills/ the procedures; a fix is one pull request with its test.
https://github.com/mcpp-community/mcpp/tree/main/docs (the documentation), mcpp-index and mcpp-plugins beside it, openxlings/xim-pkgindex (tools).