<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Topics tagged with mcpplibs]]></title><description><![CDATA[A list of topics that have been tagged with mcpplibs]]></description><link>http://forum.d2learn.org/tags/mcpplibs</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 07:20:24 GMT</lastBuildDate><atom:link href="http://forum.d2learn.org/tags/mcpplibs.rss" rel="self" type="application/rss+xml"/><pubDate>Invalid Date</pubDate><ttl>60</ttl><item><title><![CDATA[[mcpp]: 用 C++23 模块 + import std 开发了个构建工具，并实现自己构建自己(自举)]]></title><description><![CDATA[<p dir="auto">从去年 gcc 15.1 初步支持 import std 开始, 我就在 C++的模块化上做了很多实践</p>
<p dir="auto">前段时间, 突然产生了以 C++23 模块化为基础, <strong>实现一个现代 C++模块化项目的构建工具</strong>。并以其能用自己从源码构建出自己也就是所谓的<strong>自举来做为初步目标</strong>, 目前这个目标已经实现</p>
<p dir="auto">欢迎对现代 C++和模块化感兴趣的朋友来用, mcpp 构建工具使用模块化特性 玩一玩或开发开发小项目 也欢迎大家来反馈和交流</p>
<p dir="auto"><strong>开源仓库:</strong> <a href="https://github.com/mcpp-community/mcpp" rel="nofollow ugc">https://github.com/mcpp-community/mcpp</a></p>
<hr />
<h1>mcpp</h1>
<blockquote>
<p dir="auto">一个 现代 C++ 模块化构建工具 — 纯 C++23 模块编写，已实现自举</p>
</blockquote>
<h2>核心特性</h2>
<ul>
<li><strong>C++23 模块原生支持</strong> — <code>import std</code> 自动处理，文件级增量构建，模块依赖自动分析，零手动配置</li>
<li><strong>纯模块化自举</strong> — mcpp 自身由 43+ 个 C++23 模块组成，用自己构建自己，模块系统经实战验证</li>
<li><strong>开箱即用</strong> — 一条命令安装，内置 GCC 16 / LLVM 20 工具链，自动下载到隔离沙盒，不污染系统</li>
<li><strong>集成依赖管理</strong> — SemVer 约束解析、锁文件、跨项目 BMI 缓存、自定义包索引</li>
<li><strong>多包工作空间</strong> — Workspace 统一锁文件与版本管理，适合大型项目</li>
</ul>
<h2>为什么选择 mcpp ?</h2>
<p dir="auto">mcpp 专门为 <strong>C++23 模块化开发</strong> 打造。如果你想在项目中使用 <code>import std</code>、模块接口单元（<code>.cppm</code>）、模块分区等现代 C++ 特性，mcpp 在 Linux 上能为你提供便捷且友好的开发体验：</p>
<ul>
<li><strong>默认模块化</strong> — <code>mcpp new</code> 创建的项目模板直接使用 C++23 模块，<code>import std</code> 开箱即用</li>
<li><strong>文件级增量构建</strong> — 基于 P1689 dyndep 的三层优化（前端脏检查 + 逐文件扫描 + BMI restat ），只重编真正变化的模块</li>
<li><strong>一键创建 &amp; 构建</strong> — <code>mcpp new hello &amp;&amp; cd hello &amp;&amp; mcpp build</code>，工具链自动安装，无需手动配置编译器和构建系统</li>
<li><strong>模块化生态</strong> — <a href="https://github.com/mcpplibs" rel="nofollow ugc">mcpplibs</a> 提供一系列可直接 <code>import</code> 的 C++ 模块化库，支持自定义包索引</li>
</ul>
<blockquote>
<p dir="auto">注: <strong>早期版本</strong> — mcpp 仍在积极开发中，接口和行为可能在后续版本调整。<br />
欢迎对现代 C++ 模块化构建工具感兴趣的开发者<a href="#%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE">参与贡献</a>。<br />
问题 / 反馈 / 想法欢迎在 <a href="https://github.com/mcpp-community/mcpp/issues" rel="nofollow ugc">issues</a> 留言。</p>
</blockquote>
<h2>快速开始</h2>
<h3>安装</h3>
<p dir="auto"><strong>方式一：使用 xlings 安装（推荐）</strong></p>
<pre><code class="language-bash">xlings install mcpp -y
</code></pre>
<p dir="auto"><strong>方式二：一键安装脚本</strong></p>
<pre><code class="language-bash">curl -fsSL https://github.com/mcpp-community/mcpp/releases/latest/download/install.sh | bash
</code></pre>
<p dir="auto">安装到 <code>~/.mcpp/</code>，自动加进 shell PATH 。删除 <code>~/.mcpp</code> 即可干净卸载。</p>
<p dir="auto"><strong>方式三：让 AI 助手帮你安装</strong></p>
<p dir="auto">将以下提示词复制给你的 AI 编码助手（ Claude Code / Cursor / Copilot 等）：</p>
<pre><code>阅读 https://github.com/mcpp-community/mcpp 的 README ，
帮我安装 mcpp 并创建一个 C++23 模块项目，构建并运行。
项目的 .agents/skills/mcpp-usage/SKILL.md 有详细的使用指南。
</code></pre>
<h3>创建项目 &amp; 构建运行</h3>
<pre><code class="language-bash">mcpp new hello
cd hello
mcpp build
mcpp run
</code></pre>
<blockquote>
<p dir="auto">注：首次构建会初始化环境并获取工具链，可能需要一些时间。</p>
</blockquote>
<h3>项目结构</h3>
<pre><code>hello/
├── mcpp.toml             ← 工程描述
└── src/
    └── main.cpp          ← import std; 直接可用
</code></pre>
<pre><code class="language-toml"># mcpp.toml
[package]
name = "hello"

[targets.hello]
kind = "bin"
main = "src/main.cpp"
</code></pre>
<h3>使用模块化库</h3>
<p dir="auto">在 <code>mcpp.toml</code> 中添加两行依赖，即可引用 <a href="https://github.com/mcpplibs" rel="nofollow ugc">mcpplibs</a> 社区模块化库：</p>
<pre><code class="language-toml">[dependencies]
cmdline = "0.0.2"
</code></pre>
<p dir="auto">然后在代码中直接 <code>import</code>：</p>
<pre><code class="language-cpp">import mcpplibs.cmdline;
</code></pre>
<blockquote>
<p dir="auto">更多依赖配置方式（版本约束、命名空间、Git 引用、本地路径等）参见 <a href="docs/05-mcpp-toml.md">mcpp.toml 指南 — 依赖管理</a>。</p>
</blockquote>
<h2>平台支持</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>OS / arch</th>
<th style="text-align:center">GCC (glibc)</th>
<th style="text-align:center">GCC (musl)</th>
<th style="text-align:center">Clang / LLVM</th>
<th style="text-align:center">MSVC</th>
</tr>
</thead>
<tbody>
<tr>
<td>Linux x86_64</td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:23px;width:auto;vertical-align:middle" title=":white_check_mark:" alt="✅" /></td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:23px;width:auto;vertical-align:middle" title=":white_check_mark:" alt="✅" /> <em>默认</em></td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:23px;width:auto;vertical-align:middle" title=":white_check_mark:" alt="✅" /></td>
<td style="text-align:center">—</td>
</tr>
<tr>
<td>Linux aarch64</td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /></td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /></td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /></td>
<td style="text-align:center">—</td>
</tr>
<tr>
<td>macOS</td>
<td style="text-align:center">—</td>
<td style="text-align:center">—</td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /></td>
<td style="text-align:center">—</td>
</tr>
<tr>
<td>Windows</td>
<td style="text-align:center">—</td>
<td style="text-align:center">—</td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /></td>
<td style="text-align:center"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /></td>
</tr>
</tbody>
</table>
<p dir="auto"><img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:23px;width:auto;vertical-align:middle" title=":white_check_mark:" alt="✅" /> 已支持 ｜ <img src="http://forum.d2learn.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=c6uec18e3vu" class="not-responsive emoji emoji-android emoji--arrows_counterclockwise" style="height:23px;width:auto;vertical-align:middle" title=":arrows_counterclockwise:" alt="🔄" /> 计划中</p>
<blockquote>
<p dir="auto"><em>默认</em>：release 二进制走 musl 全静态，Linux x86_64 可直接运行，无 glibc 依赖。</p>
</blockquote>
<h2>文档</h2>
<ul>
<li><a href="docs/00-getting-started.md">快速开始</a> — 5 分钟完成 install → new → build → run</li>
<li><a href="docs/01-examples.md">示例项目</a></li>
<li><a href="docs/02-pack-and-release.md">发布打包</a></li>
<li><a href="docs/03-toolchains.md">工具链管理</a></li>
<li><a href="docs/04-build-from-source.md">从源码构建</a></li>
<li><a href="docs/05-mcpp-toml.md">mcpp.toml 指南</a></li>
<li><a href="docs/06-workspace.md">工作空间</a></li>
</ul>
<p dir="auto">任意命令的完整选项可通过 <code>mcpp &lt;cmd&gt; --help</code> 查阅。</p>
<p dir="auto"><strong>AI 辅助学习</strong>：你可以将以下提示词发给 AI 编码助手，让它帮你快速了解 mcpp：</p>
<pre><code>阅读 https://github.com/mcpp-community/mcpp 仓库的
.agents/skills/mcpp-usage/SKILL.md 和 docs/ 目录下的文档，
告诉我如何用 mcpp 创建一个带依赖的 C++23 模块项目。
</code></pre>
<h2>参与贡献</h2>
<p dir="auto">欢迎通过 Issue 和 PR 参与项目开发。项目接受开发者使用 AI Agent 参与开发与贡献。</p>
<p dir="auto"><strong>基本流程</strong></p>
<ol>
<li>创建 Issue — Bug 修复、新功能、优化等，先在 <a href="https://github.com/mcpp-community/mcpp/issues" rel="nofollow ugc">issues</a> 创建讨论</li>
<li>实现改动 — Fork 仓库，创建分支，实现并验证（<code>mcpp build</code> + E2E 测试）</li>
<li>提交 PR — 使用 <code>gh pr create</code>，确保 CI 通过</li>
<li>CI 必须通过 — CI 不通过的 PR 不会被合入</li>
</ol>
<p dir="auto"><strong>提交信息规范</strong>：<code>feat:</code> / <code>fix:</code> / <code>test:</code> / <code>docs:</code> / <code>refactor:</code> 前缀</p>
<p dir="auto"><strong>AI Agent 贡献</strong>：项目的 <a href=".agents/skills/mcpp-contributing/SKILL.md"><code>.agents/skills/mcpp-contributing/SKILL.md</code></a> 提供了完整的 Agent 贡献流程和项目结构说明。将以下提示词发给 AI 助手即可：</p>
<pre><code>阅读 https://github.com/mcpp-community/mcpp 仓库的
.agents/skills/mcpp-contributing/SKILL.md ，
按照指南帮我给 mcpp 项目提交一个贡献。
</code></pre>
<h2>社区 &amp; 生态</h2>
<ul>
<li><a href="https://forum.d2learn.org/category/20" rel="nofollow ugc">社区论坛</a> — 交流群 (Q: 1067245099)</li>
<li><a href="https://github.com/mcpp-community/mcpp-index" rel="nofollow ugc">mcpp-index</a> — 默认包索引</li>
<li><a href="https://github.com/mcpplibs" rel="nofollow ugc">mcpplibs</a> — 模块化 C++ 库集合</li>
</ul>
<h3>致谢</h3>
<p dir="auto">项目依赖和灵感来源：</p>
<ul>
<li><a href="https://github.com/d2learn/xlings" rel="nofollow ugc">xlings</a> — 工具链 / 包管理底座</li>
<li><a href="https://github.com/mcpplibs/cmdline" rel="nofollow ugc">mcpplibs.cmdline</a> — CLI 框架</li>
<li><a href="https://github.com/ninja-build/ninja" rel="nofollow ugc">ninja</a> — 底层构建引擎</li>
<li><a href="https://github.com/xmake-io/xmake" rel="nofollow ugc">xmake</a> — 跨平台构建工具</li>
<li><a href="https://github.com/rust-lang/cargo" rel="nofollow ugc">cargo</a> — Rust 包管理器</li>
</ul>
]]></description><link>http://forum.d2learn.org/topic/207/mcpp-用-c-23-模块-import-std-开发了个构建工具-并实现自己构建自己-自举</link><guid isPermaLink="true">http://forum.d2learn.org/topic/207/mcpp-用-c-23-模块-import-std-开发了个构建工具-并实现自己构建自己-自举</guid><dc:creator><![CDATA[SPeak]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>