{"id":49744157,"url":"https://github.com/mcpp-community/mcpp","last_synced_at":"2026-07-19T02:12:09.149Z","repository":{"id":356541731,"uuid":"1230511039","full_name":"mcpp-community/mcpp","owner":"mcpp-community","description":"一个 现代C++ 模块化构建工具 — 纯 C++23 模块编写(已实现自举) - 模块化 + 依赖/工具链管理 + 包索引 + 打包发布","archived":false,"fork":false,"pushed_at":"2026-05-24T03:02:42.000Z","size":1204,"stargazers_count":21,"open_issues_count":3,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T03:13:18.318Z","etag":null,"topics":["build-tool","cpp","cpp23","mcpp","toolchain"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcpp-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-06T04:16:35.000Z","updated_at":"2026-05-24T01:45:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mcpp-community/mcpp","commit_stats":null,"previous_names":["mcpp-community/mcpp"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/mcpp-community/mcpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcpp-community%2Fmcpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcpp-community%2Fmcpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcpp-community%2Fmcpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcpp-community%2Fmcpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcpp-community","download_url":"https://codeload.github.com/mcpp-community/mcpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcpp-community%2Fmcpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33677261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","cpp","cpp23","mcpp","toolchain"],"created_at":"2026-05-10T00:30:28.719Z","updated_at":"2026-07-19T02:12:09.141Z","avatar_url":"https://github.com/mcpp-community.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mcpp\n\n\u003e A modern C++ module-first build tool — written in pure C++23 modules, fully self-hosted\n\n**English** | [简体中文](README.zh-CN.md)\n\n[![Release](https://img.shields.io/github/v/release/mcpp-community/mcpp)](https://github.com/mcpp-community/mcpp/releases)\n[![C++23](https://img.shields.io/badge/C%2B%2B-23-blue.svg)](https://en.cppreference.com/w/cpp/23)\n[![Module](https://img.shields.io/badge/module-ok-green.svg)](https://en.cppreference.com/w/cpp/language/modules)\n[![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE)\n\n| [Documentation](docs/) · [Getting Started](docs/00-getting-started.md) · [mcpp.toml Guide](docs/05-mcpp-toml.md) · [Examples](docs/01-examples.md) · [Toolchains](docs/03-toolchains.md) |\n|:---:|\n| [Package index mcpp-index](https://github.com/mcpp-community/mcpp-index) · [Module libraries mcpplibs](https://github.com/mcpplibs) · [Community Forum](https://forum.d2learn.org/category/20) · [Issues](https://github.com/mcpp-community/mcpp/issues) · [Releases](https://github.com/mcpp-community/mcpp/releases) |\n| [![ci-linux](https://github.com/mcpp-community/mcpp/actions/workflows/ci-linux.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci-linux.yml) [![ci-macos](https://github.com/mcpp-community/mcpp/actions/workflows/ci-macos.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci-macos.yml) [![ci-windows](https://github.com/mcpp-community/mcpp/actions/workflows/ci-windows.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci-windows.yml) |\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/6c85896e-9a37-4f62-acfb-d37a4eae2363\" alt=\"mcpp demo\" width=\"720\"\u003e\n\u003c/p\u003e\n\n## Highlights\n\n- **Native C++23 module support** — `import std` handled automatically, file-level incremental builds, automatic module dependency analysis, zero manual configuration\n- **Pure modular self-hosting** — mcpp itself consists of 43+ C++23 modules and builds itself; the module pipeline is battle-tested\n- **Works out of the box** — one-command install, bundled GCC 16 / LLVM 20 toolchains downloaded into an isolated sandbox, never polluting your system\n- **Integrated dependency management** — SemVer constraint resolution, lockfile, cross-project BMI cache, custom package indices\n- **Multi-package workspaces** — unified lockfile and version management for larger projects\n\n## Why mcpp\n\nmcpp is built specifically for **C++23 module-first development**. If you want to use `import std`, module interface units (`.cppm`), module partitions, and other modern C++ features in your project, mcpp gives you a smooth, friendly experience on Linux and macOS ARM64:\n\n- **Modular by default** — projects created by `mcpp new` use C++23 modules directly; `import std` just works\n- **File-level incremental builds** — three-layer optimization based on P1689 dyndep (front-end dirty check + per-file scanning + BMI restat); only the modules that actually changed get recompiled\n- **Create \u0026 build in one go** — `mcpp new hello \u0026\u0026 cd hello \u0026\u0026 mcpp build`; toolchains install automatically, no compiler or build-system setup required\n- **A modular ecosystem** — [mcpplibs](https://github.com/mcpplibs) offers a growing set of directly `import`-able C++ module libraries, plus support for custom package indices\n\n\u003e [!NOTE]\n\u003e **Early-stage project** — mcpp is under active development; interfaces and behavior may change in future releases.\n\u003e Developers interested in modern C++ module-first build tooling are welcome to [contribute](#contributing).\n\u003e Questions / feedback / ideas — drop a note in [issues](https://github.com/mcpp-community/mcpp/issues).\n\n## Getting Started\n\n### Install\n\n**Install via xlings** (recommended)\n\n```bash\nxlings install mcpp -y\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eDon't have xlings yet? Click for the install command\u003c/summary\u003e\n\n**Linux / macOS**\n```bash\ncurl -fsSL https://d2learn.org/xlings-install.sh | bash\n```\n\n**Windows — PowerShell**\n```powershell\nirm https://d2learn.org/xlings-install.ps1.txt | iex\n```\n\n\u003e More about xlings → [xlings.d2learn.org](https://xlings.d2learn.org)\n\n\u003c/details\u003e\n\n**Other options**\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOption 1\u003c/b\u003e — one-line install script\u003c/summary\u003e\n\n```bash\ncurl -fsSL https://github.com/mcpp-community/mcpp/releases/latest/download/install.sh | bash\n```\n\nInstalls into `~/.mcpp/` and adds it to your shell PATH. Deleting `~/.mcpp` uninstalls cleanly.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOption 2\u003c/b\u003e — Arch Linux (AUR)\u003c/summary\u003e\n\n```bash\nyay -S mcpp-bin      # prebuilt release binary\nyay -S mcpp-m        # or build from source (bootstrapped with mcpp-bin)\n```\n\nInstalls the `mcpp` command system-wide; per-user data still lives in `~/.mcpp/`.\nOn Arch the name `mcpp` is an unrelated C preprocessor, so the packages are\n`mcpp-bin` / `mcpp-m` (see [`scripts/aur/`](scripts/aur/)).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOption 3\u003c/b\u003e — let an AI assistant install it for you\u003c/summary\u003e\n\nCopy the following prompt to your AI coding assistant (Claude Code / Cursor / Copilot, etc.):\n\n```\nRead the README of https://github.com/mcpp-community/mcpp,\nthen install mcpp for me and create a C++23 module project, build and run it.\nThe repo's .agents/skills/mcpp-usage/SKILL.md has a detailed usage guide.\n```\n\n\u003c/details\u003e\n\n### Create, build \u0026 run a project\n\n```bash\nmcpp new hello\ncd hello\nmcpp build\nmcpp run\n```\n\n\u003e Note: the first build initializes the environment and fetches the toolchain, which may take a while.\n\n### Project layout\n\n```\nhello/\n├── mcpp.toml             ← project manifest\n└── src/\n    └── main.cpp          ← import std; works directly\n```\n\n```toml\n# mcpp.toml\n[package]\nname = \"hello\"\n\n[targets.hello]\nkind = \"bin\"\nmain = \"src/main.cpp\"\n```\n\n### Using module libraries\n\nAdd a two-line dependency to `mcpp.toml` to pull in a community module library from [mcpplibs](https://github.com/mcpplibs):\n\n```toml\n[dependencies]\ncmdline = \"0.0.2\"\n```\n\nThen `import` it directly in your code:\n\n```cpp\nimport mcpplibs.cmdline;\n```\n\n\u003e For more dependency options (version constraints, namespaces, Git references, local paths, etc.), see the [mcpp.toml guide — dependency management](docs/05-mcpp-toml.md).\n\n## Feature Overview\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eBuild system\u003c/b\u003e\u003c/summary\u003e\n\n- Native C++20/23 module support (interface units, implementation units, module partitions)\n- Fully automatic precompilation and caching of `import std` / `import std.compat`\n- Three-layer incremental optimization: front-end dirty check + per-file P1689 dyndep + BMI copy-if-different restat\n- Fingerprinted BMI cache: hashed by compiler/flags/standard library, shared across projects\n- Ninja backend: auto-generated build.ninja, parallel compilation\n- compile_commands.json generated automatically (ready for clangd / ccls)\n- First-class C support: `.c` files auto-detected, mixed C/C++ projects\n- User-defined cflags / cxxflags / ldflags / c_standard\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eToolchain management\u003c/b\u003e\u003c/summary\u003e\n\n- Bundled GCC 16.1.0 + LLVM/Clang 20.1.7, one-command install\n- Fully static musl-gcc toolchain (default)\n- Multiple versions side by side: `mcpp toolchain install gcc 16` / `mcpp toolchain install llvm 20`\n- Isolated sandbox: all toolchains live in `~/.mcpp/registry/`, leaving the system untouched\n- Per-platform selection: `linux = \"gcc@16\"`, `macos = \"llvm@20\"`\n- GCC and Clang compile pipelines at parity (driven by the `BmiTraits` abstraction layer)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003ePackage \u0026 dependency management\u003c/b\u003e\u003c/summary\u003e\n\n- SemVer constraint resolution: `^`, `~`, ranges, exact versions\n- Three-stage resolution: constraint merging → multi-version mangling fallback → exact match\n- Lockfile mcpp.lock (v2 format: index snapshot + namespaces)\n- Namespace system: `[dependencies.myteam] foo = \"1.0\"`\n- Custom package indices: `[indices] acme = \"git@...\"` / `{ path = \"...\" }`\n- Project-level index isolation (`.mcpp/` directory, no global pollution)\n- Dependency sources: index / Git / local path\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWorkspaces\u003c/b\u003e\u003c/summary\u003e\n\n- `[workspace] members = [\"libs/*\", \"apps/*\"]`\n- Unified lockfile + unified target directory\n- Centralized version management: `[workspace.dependencies]` + `.workspace = true`\n- Selective builds: `mcpp build -p member-name`\n- Config inheritance: toolchains, build flags, and indices cascade from root to members\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003ePackaging \u0026 publishing\u003c/b\u003e\u003c/summary\u003e\n\n- `mcpp pack`: three Linux release modes — static (fully static musl) / bundle-project / bundle-all\n- Fully static musl binaries: single-file distribution, no glibc dependency (Linux x86_64)\n- `mcpp publish`: generates xpkg.lua + publishes to a package index\n- Automatic RPATH fix-up via patchelf (Linux)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eDeveloper experience\u003c/b\u003e\u003c/summary\u003e\n\n- `mcpp new` — create a modular project; `--template \u003cpkg\u003e[@ver][:\u003ctmpl\u003e]` uses a **library-provided template** (e.g. `--template imgui`); `--list-templates \u003cpkg\u003e` lists them\n- `mcpp run [-- args]` — build and run\n- `mcpp test [-- args]` — auto-discover and run tests\n- `mcpp search` — search package indices\n- `mcpp add / remove / update` — dependency management\n- `mcpp explain E0001` — detailed error-code explanations\n- `mcpp self doctor` — environment self-diagnosis\n\n\u003c/details\u003e\n\n## Platform Support\n\nmcpp's identity model has two orthogonal axes: a **toolchain** is\n`family@version` (family ∈ gcc | llvm | msvc), a **target** is a triple\n`arch-os[-env]`. Cross-compiling is just `mcpp build --target \u003ctriple\u003e` —\nthe right toolchain payload is resolved and installed automatically.\n`mcpp toolchain list` shows live status on your machine.\n\n**Hosts** (where mcpp itself runs): Linux x86_64 / aarch64, macOS arm64, Windows x86_64.\n\n**Targets** (what `--target` accepts; this table mirrors the in-code vocabulary):\n\n| Target | Convention toolchain | Status |\n|---|---|:---:|\n| `x86_64-linux-gnu`    | gcc *(Linux default)* or llvm | ✅ |\n| `x86_64-linux-musl`   | gcc 16, fully static | ✅ |\n| `aarch64-linux-musl`  | gcc 16, fully static — cross from x86_64 (qemu-verified) or native | ✅ |\n| `x86_64-windows-gnu`  | gcc 16 MinGW-w64 — native on Windows, cross from Linux (wine-verified) | ✅ |\n| `x86_64-windows-msvc` | `msvc@system` (detected VS/BuildTools) or llvm ¹ *(Windows default)* | ✅ |\n| `aarch64-macos`       | llvm *(macOS default)* | ✅ |\n| `riscv64-linux-musl`  | — | 🔄 |\n| `aarch64-linux-gnu`   | — | 🔄 |\n| `x86_64-macos`        | — | 🔄 |\n\n✅ verified — CI builds **and executes** the artifact end-to-end (qemu/wine included) ｜ 🔄 planned\n\n\u003e Release binaries for Linux are fully static musl builds (`x86_64-linux-musl`).\n\u003e Legacy spellings — `x86_64-w64-mingw32`, `gcc@16.1.0-musl`, `mingw-cross@…`,\n\u003e `musl-gcc@…` — stay permanently accepted as aliases and normalize to the\n\u003e canonical forms above.\n\u003e\n\u003e ¹ On Windows, llvm requires an existing **MSVC BuildTools or Visual Studio**\n\u003e (UCRT, Windows SDK, MSVC STL). The MinGW route (`--target x86_64-windows-gnu`,\n\u003e or `mcpp toolchain default gcc@16 --target x86_64-windows-gnu`) needs no\n\u003e Visual Studio at all.\n\n## Documentation\n\n- [Getting Started](docs/00-getting-started.md) — install → new → build → run in 5 minutes\n- [Examples](docs/01-examples.md)\n- [Packaging \u0026 Release](docs/02-pack-and-release.md)\n- [Toolchain Management](docs/03-toolchains.md)\n- [Building from Source](docs/04-build-from-source.md)\n- [mcpp.toml Guide](docs/05-mcpp-toml.md)\n- [Workspaces](docs/06-workspace.md)\n\nFull options for any command are available via `mcpp \u003ccmd\u003e --help`.\n\n**AI-assisted learning**: send the following prompt to an AI coding assistant to get up to speed with mcpp quickly:\n\n```\nRead .agents/skills/mcpp-usage/SKILL.md and the docs/ directory of the\nhttps://github.com/mcpp-community/mcpp repository,\nthen tell me how to create a C++23 module project with dependencies using mcpp.\n```\n\n## Who's Using mcpp\n\nReal projects built with mcpp — `import`-able C++23 modules and the toolchain it builds on:\n\n| Project | Description |\n| --- | --- |\n| [mcpp](https://github.com/mcpp-community/mcpp) | mcpp itself — 43+ C++23 modules, fully self-hosted |\n| [xlings](https://github.com/openxlings/xlings) | Toolchain \u0026 package-management foundation mcpp builds on |\n| [tinyhttps](https://github.com/mcpplibs/tinyhttps) | Minimal C++23 HTTP/HTTPS client with SSE streaming |\n| [llmapi](https://github.com/mcpplibs/llmapi) | Modern C++ LLM API client (OpenAI-compatible) |\n| [imgui-m](https://github.com/mcpplibs/imgui-m) | Dear ImGui as a C++23 module package |\n| [cmdline](https://github.com/mcpplibs/cmdline) | Command-line parsing library / framework (mcpp uses it) |\n\nMore modular libraries → [mcpplibs](https://github.com/mcpplibs) · package index → [mcpp-index](https://github.com/mcpp-community/mcpp-index)\n\n## Contributing\n\nContributions via issues and PRs are welcome. The project accepts contributions developed with AI agents.\n\n**Basic workflow**\n\n1. Open an issue — for bug fixes, new features, or improvements, start a discussion in [issues](https://github.com/mcpp-community/mcpp/issues) first\n2. Implement the change — fork the repo, create a branch, implement and verify (`mcpp build` + E2E tests)\n3. Submit a PR — use `gh pr create` and make sure CI passes\n4. CI must pass — PRs with failing CI will not be merged\n\n**Commit message convention**: `feat:` / `fix:` / `test:` / `docs:` / `refactor:` prefixes\n\n**AI agent contributions**: the repo's [`.agents/skills/mcpp-contributing/SKILL.md`](.agents/skills/mcpp-contributing/SKILL.md) provides a complete agent contribution workflow and project structure guide. Just send this prompt to your AI assistant:\n\n```\nRead .agents/skills/mcpp-contributing/SKILL.md of the\nhttps://github.com/mcpp-community/mcpp repository,\nthen follow the guide to help me submit a contribution to mcpp.\n```\n\n## Community \u0026 Ecosystem\n\n- [Community Forum](https://forum.d2learn.org/category/20) — chat group (QQ: 1067245099)\n- [mcpp-index](https://github.com/mcpp-community/mcpp-index) — default package index\n- [mcpplibs](https://github.com/mcpplibs) — collection of modular C++ libraries\n\n### Acknowledgements\n\nDependencies and sources of inspiration:\n\n- [xlings](https://github.com/d2learn/xlings) — toolchain / package-management foundation\n- [mcpplibs.cmdline](https://github.com/mcpplibs/cmdline) — CLI framework\n- [ninja](https://github.com/ninja-build/ninja) — underlying build engine\n- [xmake](https://github.com/xmake-io/xmake) — cross-platform build tool\n- [cargo](https://github.com/rust-lang/cargo) — Rust package manager\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcpp-community%2Fmcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcpp-community%2Fmcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcpp-community%2Fmcpp/lists"}