Parcourir la source

update modules docs

ruki il y a 2 ans
Parent
commit
aa5c19bef3

+ 138 - 5
guide/project_examples.md

@@ -1250,7 +1250,9 @@ target("example")
     add_packages("python")
 ```
 
-### C++20 Module
+## C++20 Module
+
+### Quick Start
 
 xmake uses `.mpp` as the default module extension, but also supports `.ixx`, `.cppm`, `.mxx` and other extensions.
 
@@ -1266,6 +1268,8 @@ target("class")
 
 For more examples, see: [C++ Modules](https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules)
 
+### Cpp-only project
+
 The v2.7.1 release has refactored and upgraded the C++20 module implementation to include support for Headerunits,
 which allows us to introduce Stl and user header modules into the module.
 
@@ -1286,10 +1290,139 @@ target("test")
     set_policy("build.c++.modules", true)
 ```
 
+### C++ Module distribution
+
+Many thanks to [Arthapz](https://github.com/Arthapz) for continuing to help improve xmake's support for C++ Modules in this new release.
+
+We can now distribute C++ Modules as packages for quick integration and reuse in other projects.
+
+This is a prototype implementation based on the draft design for module distribution in [p2473r1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2473r1.pdf).
+
+#### Creating a C++ Modules package for distribution
+
+We start by maintaining a build of the modules using xmake.lua and telling xmake which module files to install for external distribution by specifying ``{install = true}`''.
+
+```lua
+add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+target("foo")
+    set_kind("static")
+    add_files("*.cpp")
+    add_files("*.mpp", { install = true })
+```
+
+We then make it into a package that we can commit to the [xmake-repo](https://github.com/xmake-io/xmake-repo) repository, or of course directly into a local package, or a private repository package.
+
+Here, for testing purposes, we just make it a local package via ``set_sourcedir``.
+
+```lua
+package("foo")
+    set_sourcedir(path.join(os.scriptdir(), "src"))
+    on_install(function(package)
+        import("package.tools.xmake").install(package, {})
+    end)
+````
+
+#### Integrating the C++ Modules package
+
+We then quickly integrate the C++ Modules package for use via the package integration interface with `add_requires("foo")`.
+
+Since the modules packages for foo are defined in a private repository, we introduce our own package repository via `add_repositories("my-repo my-repo")`.
+
+If the package has already been committed to the official xmake-repo repository, there is no need to configure it additionally.
+
+```lua
+add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+add_repositories("my-repo my-repo")
+add_requires("foo", "bar")
+
+target("packages")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    add_packages("foo", "bar")
+    set_policy("build.c++.modules", true)
+```
+
+Once the packages are integrated, we can run the ``xmake`'' command to download, compile and integrate the C++ Modules package for use with one click.
+
+```bash
+$ xmake
+checking for platform ... linux
+checking for architecture ... x86_64
+note: install or modify (m) these packages (pass -y to skip confirm)?
+in my-repo:
+  -> foo latest
+  -> bar latest
+please input: y (y/n/m)
+
+  => install bar latest ... ok
+  => install foo latest ... ok
+[ 0%]: generating.module.deps src/main.cpp
+[ 0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/ 4e0143c97b65425b855ad5fd03038b6a/modules/bar/bar.mpp
+[ 0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/f/foo/latest/ 4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp
+[ 14%]: compiling.module.release bar
+[ 14%]: compiling.module.release foo
+[ 57%]: compiling.release src/main.cpp
+[ 71%]: linking.release packages
+[ 100%]: build ok!
+```''
+
+Note: After each package is installed, a meta-info file for the maintenance module is stored in the package path, this is a format specification agreed in ``p2473r1.pdf``, it may not be the final standard, but this does not affect our ability to use the distribution of the module now.
+
+```bash
+$ cat . /build/.packages/f/f/foo/latest/4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp.meta-info
+{"_VENDOR_extension":{"xmake":{"name": "foo", "file": "foo.mpp"}}, "definitions":{}, "include_paths":{}}
+```
+
+The full example project is available at: [C++ Modules package distribution example project](https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules/packages)
+
+### Support for C++23 Std Modules
+
+[Arthapz](https://github.com/Arthapz) has also helped to improve support for C++23 Std Modules.
+
+It is currently supported by three compilers in progress.
+
+#### Msvc
+
+The latest Visual Studio 17.5 preview already supports it, and the non-standard ifc std modules will be deprecated.
+
+For the standard C++23 std modules, this is how we introduced them.
+
+```c
+import std;
+```
+
+Whereas for ifc std modules, we need to write it like this.
+
+```
+import std.core;
+```
+
+This is not a C++23 standard, it is only provided by msvc, it is not compatible with other compilers and will be deprecated in new versions of msvc.
+Therefore the new version of Xmake will only support C++23 std modules and not the deprecated ifc std modules.
+
+#### Clang
+
+It seems that the latest clang does not yet fully support C++23 std modules either, and is still in draft patch status, [#D135507](https://reviews.llvm.org/D135507).
+
+However, Xmake does support it, so if you want to try it out, you can merge in the patch and test it with xmake.
+
+There is also experimental support for non-standard std modules in lower versions of clang.
+
+It is still possible to experiment with xmake to build std modules in lower versions of clang, even though it is probably still a toy (and will encounter many problems).
+
+For a discussion see: [#3255](https://github.com/xmake-io/xmake/pull/3255)
+
+#### Gcc
+
+It is not currently supported.
 
-### Merge static libraries
+## Merge static libraries
 
-#### Automatically merge target libraries
+### Automatically merge target libraries
 
 After 2.5.8, we can enable automatic merging of all dependent static libraries by setting the `build.merge_archive` strategy, for example:
 
@@ -1317,7 +1450,7 @@ The mul static library automatically merges the add and sub static libraries to
 
 This merge is relatively stable and complete, supports ar and msvc/lib.exe, also supports the merge of static libraries generated by the cross-compilation tool chain, and also supports static libraries with the same name obj file.
 
-#### Merge specified static library files
+### Merge specified static library files
 
 If the automatic merge does not meet the requirements, we can also actively call the `utils.archive.merge_archive` module to merge the specified static library list in the `after_link` stage.
 
@@ -1329,7 +1462,7 @@ target("test")
     end)
 ```
 
-#### Use add_files to merge static libraries
+### Use add_files to merge static libraries
 
 In fact, our previous version already supports merging static libraries through `add_files("*.a")`.
 

+ 94 - 5
mirror/guide/project_examples.html

@@ -936,7 +936,8 @@ target("example")
     add_files("src/example.cpp")
     add_packages("python")
 </code></pre>
-<h3 id="c20module">C++20 Module</h3>
+<h2 id="c20module">C++20 Module</h2>
+<h3 id="quickstart">Quick Start</h3>
 <p>xmake uses <code>.mpp</code> as the default module extension, but also supports <code>.ixx</code>, <code>.cppm</code>, <code>.mxx</code> and other extensions.</p>
 <p>At present, xmake has fully supported the C++20 Modules construction support of gcc11/clang/msvc,<br>and can automatically analyze the dependencies between modules to maximize parallel compilation.</p>
 <pre><code class="lang-lua">set_languages("c++20")
@@ -945,6 +946,7 @@ target("class")
     add_files("src/*.cpp", "src/*.mpp")
 </code></pre>
 <p>For more examples, see: <a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules">C++ Modules</a></p>
+<h3 id="cpponlyproject">Cpp-only project</h3>
 <p>The v2.7.1 release has refactored and upgraded the C++20 module implementation to include support for Headerunits,<br>which allows us to introduce Stl and user header modules into the module.</p>
 <p>The relevant patch is available at: <a href="https://github.com/xmake-io/xmake/pull/2641">#2641</a>.</p>
 <p>Note: Normally we need to add at least one <code>.mpp</code> file to enable C++20 modules compilation, if we only have a cpp file, module compilation will not be enabled by default.</p>
@@ -957,8 +959,95 @@ target("test")
     set_languages("c++20")
     set_policy("build.c++.modules", true)
 </code></pre>
-<h3 id="mergestaticlibraries">Merge static libraries</h3>
-<h4 id="automaticallymergetargetlibraries">Automatically merge target libraries</h4>
+<h3 id="cmoduledistribution">C++ Module distribution</h3>
+<p>Many thanks to <a href="https://github.com/Arthapz">Arthapz</a> for continuing to help improve xmake&#39;s support for C++ Modules in this new release.</p>
+<p>We can now distribute C++ Modules as packages for quick integration and reuse in other projects.</p>
+<p>This is a prototype implementation based on the draft design for module distribution in <a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2473r1.pdf">p2473r1</a>.</p>
+<h4 id="creatingacmodulespackagefordistribution">Creating a C++ Modules package for distribution</h4>
+<p>We start by maintaining a build of the modules using xmake.lua and telling xmake which module files to install for external distribution by specifying <code></code>{install = true}`&#39;&#39;.</p>
+<pre><code class="lang-lua">add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+target("foo")
+    set_kind("static")
+    add_files("*.cpp")
+    add_files("*.mpp", { install = true })
+</code></pre>
+<p>We then make it into a package that we can commit to the <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> repository, or of course directly into a local package, or a private repository package.</p>
+<p>Here, for testing purposes, we just make it a local package via <code>set_sourcedir</code>.</p>
+<pre><code class="lang-lua">package("foo")
+    set_sourcedir(path.join(os.scriptdir(), "src"))
+    on_install(function(package)
+        import("package.tools.xmake").install(package, {})
+    end)
+`
+</code></pre>
+<h4 id="integratingthecmodulespackage">Integrating the C++ Modules package</h4>
+<p>We then quickly integrate the C++ Modules package for use via the package integration interface with <code>add_requires("foo")</code>.</p>
+<p>Since the modules packages for foo are defined in a private repository, we introduce our own package repository via <code>add_repositories("my-repo my-repo")</code>.</p>
+<p>If the package has already been committed to the official xmake-repo repository, there is no need to configure it additionally.</p>
+<pre><code class="lang-lua">add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+add_repositories("my-repo my-repo")
+add_requires("foo", "bar")
+
+target("packages")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    add_packages("foo", "bar")
+    set_policy("build.c++.modules", true)
+</code></pre>
+<p>Once the packages are integrated, we can run the <code></code>xmake`&#39;&#39; command to download, compile and integrate the C++ Modules package for use with one click.</p>
+<pre><code class="lang-bash">$ xmake
+checking for platform ... linux
+checking for architecture ... x86_64
+note: install or modify (m) these packages (pass -y to skip confirm)?
+in my-repo:
+  -> foo latest
+  -> bar latest
+please input: y (y/n/m)
+
+  => install bar latest ... ok
+  => install foo latest ... ok
+[ 0%]: generating.module.deps src/main.cpp
+[ 0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/ 4e0143c97b65425b855ad5fd03038b6a/modules/bar/bar.mpp
+[ 0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/f/foo/latest/ 4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp
+[ 14%]: compiling.module.release bar
+[ 14%]: compiling.module.release foo
+[ 57%]: compiling.release src/main.cpp
+[ 71%]: linking.release packages
+[ 100%]: build ok!
+```&#39;&#39;
+
+Note: After each package is installed, a meta-info file for the maintenance module is stored in the package path, this is a format specification agreed in ``p2473r1.pdf``, it may not be the final standard, but this does not affect our ability to use the distribution of the module now.
+
+```bash
+$ cat . /build/.packages/f/f/foo/latest/4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp.meta-info
+{"_VENDOR_extension":{"xmake":{"name": "foo", "file": "foo.mpp"}}, "definitions":{}, "include_paths":{}}
+</code></pre>
+<p>The full example project is available at: <a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules/packages">C++ Modules package distribution example project</a></p>
+<h3 id="supportforc23stdmodules">Support for C++23 Std Modules</h3>
+<p><a href="https://github.com/Arthapz">Arthapz</a> has also helped to improve support for C++23 Std Modules.</p>
+<p>It is currently supported by three compilers in progress.</p>
+<h4 id="msvc">Msvc</h4>
+<p>The latest Visual Studio 17.5 preview already supports it, and the non-standard ifc std modules will be deprecated.</p>
+<p>For the standard C++23 std modules, this is how we introduced them.</p>
+<pre><code class="lang-c">import std;
+</code></pre>
+<p>Whereas for ifc std modules, we need to write it like this.</p>
+<pre><code>import std.core;
+</code></pre><p>This is not a C++23 standard, it is only provided by msvc, it is not compatible with other compilers and will be deprecated in new versions of msvc.<br>Therefore the new version of Xmake will only support C++23 std modules and not the deprecated ifc std modules.</p>
+<h4 id="clang">Clang</h4>
+<p>It seems that the latest clang does not yet fully support C++23 std modules either, and is still in draft patch status, <a href="https://reviews.llvm.org/D135507">#D135507</a>.</p>
+<p>However, Xmake does support it, so if you want to try it out, you can merge in the patch and test it with xmake.</p>
+<p>There is also experimental support for non-standard std modules in lower versions of clang.</p>
+<p>It is still possible to experiment with xmake to build std modules in lower versions of clang, even though it is probably still a toy (and will encounter many problems).</p>
+<p>For a discussion see: <a href="https://github.com/xmake-io/xmake/pull/3255">#3255</a></p>
+<h4 id="gcc">Gcc</h4>
+<p>It is not currently supported.</p>
+<h2 id="mergestaticlibraries">Merge static libraries</h2>
+<h3 id="automaticallymergetargetlibraries">Automatically merge target libraries</h3>
 <p>After 2.5.8, we can enable automatic merging of all dependent static libraries by setting the <code>build.merge_archive</code> strategy, for example:</p>
 <pre><code class="lang-lua">add_rules("mode.debug", "mode.release")
 
@@ -980,7 +1069,7 @@ target("mul")
 </code></pre>
 <p>The mul static library automatically merges the add and sub static libraries to generate a complete libmul.a library containing add/sub code.</p>
 <p>This merge is relatively stable and complete, supports ar and msvc/lib.exe, also supports the merge of static libraries generated by the cross-compilation tool chain, and also supports static libraries with the same name obj file.</p>
-<h4 id="mergespecifiedstaticlibraryfiles">Merge specified static library files</h4>
+<h3 id="mergespecifiedstaticlibraryfiles">Merge specified static library files</h3>
 <p>If the automatic merge does not meet the requirements, we can also actively call the <code>utils.archive.merge_archive</code> module to merge the specified static library list in the <code>after_link</code> stage.</p>
 <pre><code class="lang-lua">target("test")
     after_link(function (target)
@@ -988,7 +1077,7 @@ target("mul")
         merge_staticlib(target, "libout.a", {"libfoo.a", "libbar.a"})
     end)
 </code></pre>
-<h4 id="useadd_filestomergestaticlibraries">Use add_files to merge static libraries</h4>
+<h3 id="useadd_filestomergestaticlibraries">Use add_files to merge static libraries</h3>
 <p>In fact, our previous version already supports merging static libraries through <code>add_files("*.a")</code>.</p>
 <pre><code class="lang-lua">target("test")
     set_kind("binary")

+ 1 - 1
mirror/plugin/plugin_development.html

@@ -104,7 +104,7 @@
 <li>macro: Record and playback some xmake commands repeatably.</li>
 <li>doxygen:Generate doxygen document automatically.</li>
 <li>hello:  The demo plugin and only print: &#39;hello xmake!&#39;</li>
-<li>project:Generate project file for IDE, only generate makefile now and will generate vs, xcode project in the future</li>
+<li>project:Generate project file for IDE, and now it can generate make, cmake, vs, xcode (need cmake), ninja project file and compile_commands.json and compile_flags.txt</li>
 </ul>
 <h2 id="quickstart">Quick Start</h2>
 <p>Now we write a simple plugin demo for printing &#39;hello xmake!&#39;</p>

+ 5 - 0
mirror/zh-cn/about/who_is_using_xmake.html

@@ -209,6 +209,11 @@
 <td style="text-align:left">C语言实现的NES模拟器 GitHub地址: <a href="https://github.com/Dozingfiretruck">https://github.com/Dozingfiretruck</a>     Gitee地址: <a href="https://gitee.com/Dozingfiretruck/nes">https://gitee.com/Dozingfiretruck/nes</a></td>
 <td style="text-align:left">xmake 可以使你极其方便的部署C/C++构建,节省大量时间从而将精力放在代码编写上而非项目构建上</td>
 </tr>
+<tr>
+<td style="text-align:left"><a href="https://github.com/WSSDude">WSSDude</a></td>
+<td style="text-align:left"><a href="https://github.com/WSSDude/HitmanAudioTool">Hitman Audio Tool</a></td>
+<td style="text-align:left">Very easy to use build system with what I believe is currently the best package management integrated within. Definitely plan to include it in my other future projects (both personal and public). Using it since 2020 and counting.</td>
+</tr>
 </tbody>
 </table>
 </article>

+ 87 - 5
mirror/zh-cn/guide/project_examples.html

@@ -939,7 +939,8 @@ target("example")
     add_files("src/example.cpp")
     add_packages("python")
 </code></pre>
-<h3 id="c20">C++20 模块</h3>
+<h2 id="c20">C++20 模块</h2>
+<h3 id="">快速开始</h3>
 <p>xmake 采用 <code>.mpp</code> 作为默认的模块扩展名,但是也同时支持 <code>.ixx</code>, <code>.cppm</code>, <code>.mxx</code> 等扩展名。</p>
 <p>目前 xmake 已经完整支持 gcc11/clang/msvc 的 C++20 Modules 构建支持,并且能够自动分析模块间的依赖关系,实现最大化并行编译。</p>
 <pre><code class="lang-lua">set_languages("c++20")
@@ -948,6 +949,7 @@ target("class")
     add_files("src/*.cpp", "src/*.mpp")
 </code></pre>
 <p>更多例子见:<a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules">C++ Modules</a></p>
+<h3 id="cpponly">Cpp-Only 工程</h3>
 <p>v2.7.1 版本对 C++20 模块的实现进行了重构和升级,新增了对 Headerunits 的支持,我们可以在模块中引入 Stl 和 用户头文件模块。</p>
 <p>相关的补丁见:<a href="https://github.com/xmake-io/xmake/pull/2641">#2641</a>。</p>
 <p>注:通常我们至少需要添加一个 <code>.mpp</code> 文件,才能开启 C++20 modules 编译,如果只有 cpp 文件,默认是不会开启模块编译的。</p>
@@ -960,8 +962,88 @@ target("test")
     set_languages("c++20")
     set_policy("build.c++.modules", true)
 </code></pre>
-<h3 id="">合并静态库</h3>
-<h4 id="target">自动合并 target 库</h4>
+<h3 id="">模块的分发和集成</h3>
+<h4 id="cmodules">分发 C++ Modules 包</h4>
+<p>我们先使用 xmake.lua 维护模块的构建,并通过指定 <code>{install = true}</code>,来告诉 xmake 哪些模块文件需要安装对外分发。</p>
+<pre><code class="lang-lua">add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+target("foo")
+    set_kind("static")
+    add_files("*.cpp")
+    add_files("*.mpp", { install = true })
+</code></pre>
+<p>然后,我们把它做成包,可以提交到 <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> 仓库,当然也可以直接做成本地包,或者私有仓库包。</p>
+<p>这里,为了方便测试验证,我们仅仅通过 <code>set_sourcedir</code> 将它做成本地包。</p>
+<pre><code class="lang-lua">package("foo")
+    set_sourcedir(path.join(os.scriptdir(), "src"))
+    on_install(function(package)
+        import("package.tools.xmake").install(package, {})
+    end)
+</code></pre>
+<h4 id="cmodules">集成 C++ Modules 包</h4>
+<p>然后,我们通过 <code>add_requires("foo")</code> 的包集成接口,对 C++ Modules 包进行快速集成使用。</p>
+<p>由于 foo 的模块包,我们放在私有仓库中定义,所以我们通过 <code>add_repositories("my-repo my-repo")</code> 引入自己的包仓库。</p>
+<p>如果,包已经提交到 xmake-repo 官方仓库,就不需要额外配置它。</p>
+<pre><code class="lang-lua">add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+add_repositories("my-repo my-repo")
+add_requires("foo", "bar")
+
+target("packages")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    add_packages("foo", "bar")
+    set_policy("build.c++.modules", true)
+</code></pre>
+<p>集成好包后,我们就可以执行 <code>xmake</code> 命令,一键下载、编译、集成 C++ Modules 包来使用。</p>
+<pre><code class="lang-bash">$ xmake
+checking for platform ... linux
+checking for architecture ... x86_64
+note: install or modify (m) these packages (pass -y to skip confirm)?
+in my-repo:
+  -> foo latest
+  -> bar latest
+please input: y (y/n/m)
+
+  => install bar latest .. ok
+  => install foo latest .. ok
+[  0%]: generating.module.deps src/main.cpp
+[  0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/4e0143c97b65425b855ad5fd03038b6a/modules/bar/bar.mpp
+[  0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/f/foo/latest/4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp
+[ 14%]: compiling.module.release bar
+[ 14%]: compiling.module.release foo
+[ 57%]: compiling.release src/main.cpp
+[ 71%]: linking.release packages
+[100%]: build ok!
+</code></pre>
+<p>注:每个包安装后,会在包路径下,存储维护模块的 meta-info 文件,这是 <code>p2473r1.pdf</code> 中约定的一种格式规范,也许它不是最终的标准,但这并不影响我们现在去使用模块的分发。</p>
+<pre><code class="lang-bash">$ cat ./build/.packages/f/foo/latest/4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp.meta-info
+{"_VENDOR_extension":{"xmake":{"name":"foo","file":"foo.mpp"}},"definitions":{},"include_paths":{}}
+</code></pre>
+<p>完整的例子工程见:<a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules/packages">C++ Modules 包分发例子工程</a></p>
+<h3 id="c23stdmodules">支持 C++23 Std Modules</h3>
+<p><a href="https://github.com/Arthapz">Arthapz</a> 也帮忙改进了对 C++23 Std Modules 的支持。</p>
+<p>目前三个编译器对它的支持进展:</p>
+<h4 id="msvc">Msvc</h4>
+<p>最新 Visual Studio 17.5 preview 已经支持,并且非标准的 ifc std modules 将被废弃。</p>
+<p>对于标准的 C++23 std modules,我们是这么引入的。</p>
+<pre><code class="lang-c">import std;
+</code></pre>
+<p>而对于 ifc std modules,我们需要这么写:</p>
+<pre><code>import std.core;
+</code></pre><p>它不是 C++23 标准,仅仅 msvc 提供,对其他编译器并不兼容,以后新版本 msvc 中也会逐步废弃。<br>因此新版本 Xmake 将仅仅 C++23 std modules,不再支持废弃的 ifc std modules。</p>
+<h4 id="clang">Clang</h4>
+<p>目前最新的 clang 似乎也还没完全支持 C++23 std modules,当前还是 draft patch 状态,<a href="https://reviews.llvm.org/D135507">#D135507</a>。</p>
+<p>但是,Xmake 也对它进行了支持,如果大家想要尝鲜,可以自行合入这个 patch,然后使用 xmake 来测试。</p>
+<p>另外,低版本的 clang 也有对非标准的 std modules 做了实验性支持。</p>
+<p>我们还是可以在低版本 clang 中尝试性使用 xmake 来构建 std modules,尽管它可能还只是个玩具(会遇到很多问题)。</p>
+<p>相关讨论见:<a href="https://github.com/xmake-io/xmake/pull/3255">#3255</a></p>
+<h4 id="gcc">Gcc</h4>
+<p>目前还不支持。</p>
+<h2 id="">合并静态库</h2>
+<h3 id="target">自动合并 target 库</h3>
 <p>2.5.8 之后,我们可以通过设置 <code>build.merge_archive</code> 策略,启用自动合并依赖的所有静态库,例如:</p>
 <pre><code class="lang-lua">add_rules("mode.debug", "mode.release")
 
@@ -983,7 +1065,7 @@ target("mul")
 </code></pre>
 <p>mul 静态库自动合并了 add 和 sub 静态库,生成一个包含 add/sub 代码的完整 libmul.a 库。</p>
 <p>这个合并相对比较稳定完善,支持 ar 和 msvc/lib.exe,也支持交叉编译工具链生成的静态库合并,也支持带有重名 obj 文件的静态库。</p>
-<h4 id="">合并指定的静态库文件</h4>
+<h3 id="">合并指定的静态库文件</h3>
 <p>如果自动合并不满足需求,我们也可以主动调用 <code>utils.archive.merge_archive</code> 模块在 <code>after_link</code> 阶段合并指定的静态库列表。</p>
 <pre><code class="lang-lua">target("test")
     after_link(function (target)
@@ -991,7 +1073,7 @@ target("mul")
         merge_staticlib(target, "libout.a", {"libfoo.a", "libbar.a"})
     end)
 </code></pre>
-<h4 id="add_files">使用 add_files 合并静态库</h4>
+<h3 id="add_files">使用 add_files 合并静态库</h3>
 <p>其实,我们之前的版本已经支持通过 <code>add_files("*.a")</code> 来合并静态库。</p>
 <pre><code class="lang-lua">target("test")
     set_kind("binary")

+ 1 - 1
mirror/zh-cn/plugin/plugin_development.html

@@ -104,7 +104,7 @@
 <li>macro: 这个很实用,宏脚本插件,可以手动录制多条xmake命令并且回放,也可以通过脚本实现一些复杂的宏脚本,这个我们后续会更加详细的介绍</li>
 <li>doxygen:一键生成doxygen文档的插件</li>
 <li>hello: 插件demo,仅仅显示一句话:&#39;hello xmake!&#39;</li>
-<li>project: 生成工程文件的插件,目前仅支持(makefile),后续还会支持(vs,xcode等工程)的生成</li>
+<li>project: 生成工程文件的插件,目前已经支持make, cmake, ninja, xcode (需要 cmake) 和 vs 的工程文件以及 compile_commands.json 和 compile_flags.txt 文件的生成</li>
 </ul>
 <h2 id="">快速开始</h2>
 <p>接下来我们介绍下本文的重点,一个简单的hello xmake插件的开发,代码如下:</p>

+ 102 - 102
sitemap.xml

@@ -12,512 +12,512 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2023-04-08T20:26:09+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2023-04-08T20:26:09+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2023-04-08T20:26:09+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/build_policies.html</loc>
-  <lastmod>2023-04-08T20:26:10+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2023-04-08T20:26:10+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2023-04-08T20:26:10+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2023-04-08T20:26:10+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/remote_build.html</loc>
-  <lastmod>2023-04-08T20:26:10+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/unity_build.html</loc>
-  <lastmod>2023-04-08T20:26:11+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/distcc_build.html</loc>
-  <lastmod>2023-04-08T20:26:11+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/trybuild.html</loc>
-  <lastmod>2023-04-08T20:26:11+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/autogen.html</loc>
-  <lastmod>2023-04-08T20:26:11+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/build_cache.html</loc>
-  <lastmod>2023-04-08T20:26:11+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2023-04-08T20:26:11+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2023-04-08T20:26:12+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-04-08T20:26:12+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2023-04-08T20:26:12+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2023-04-08T20:26:12+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2023-04-08T20:26:12+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2023-04-08T20:26:12+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2023-04-08T20:26:13+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-04-08T20:26:13+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2023-04-08T20:26:13+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2023-04-08T20:26:13+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2023-04-08T20:26:13+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2023-04-08T20:26:14+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2023-04-08T20:26:14+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/build_policies.html</loc>
-  <lastmod>2023-04-08T20:26:14+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2023-04-08T20:26:14+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2023-04-08T20:26:14+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2023-04-08T20:26:14+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/remote_build.html</loc>
-  <lastmod>2023-04-08T20:26:15+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/unity_build.html</loc>
-  <lastmod>2023-04-08T20:26:15+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/distcc_build.html</loc>
-  <lastmod>2023-04-08T20:26:15+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/trybuild.html</loc>
-  <lastmod>2023-04-08T20:26:15+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/autogen.html</loc>
-  <lastmod>2023-04-08T20:26:15+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/build_cache.html</loc>
-  <lastmod>2023-04-08T20:26:15+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2023-04-08T20:26:16+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2023-04-08T20:26:16+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-04-08T20:26:16+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2023-04-08T20:26:16+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2023-04-08T20:26:16+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2023-04-08T20:26:17+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2023-04-08T20:26:17+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2023-04-08T20:26:17+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2023-04-08T20:26:17+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-04-08T20:26:17+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2023-04-08T20:26:17+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2023-04-08T20:26:18+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2023-04-08T20:26:18+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2023-04-08T20:26:18+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2023-04-08T20:26:18+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2023-04-08T20:26:18+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2023-04-08T20:26:19+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2023-04-08T20:26:19+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/target_instance.html</loc>
-  <lastmod>2023-04-08T20:26:19+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2023-04-08T20:26:19+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2023-04-08T20:26:19+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2023-04-08T20:26:19+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2023-04-08T20:26:20+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2023-04-08T20:26:20+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2023-04-08T20:26:20+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2023-04-08T20:26:20+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/helper_interfaces.html</loc>
-  <lastmod>2023-04-08T20:26:20+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2023-04-08T20:26:21+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_instance.html</loc>
-  <lastmod>2023-04-08T20:26:21+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/option_instance.html</loc>
-  <lastmod>2023-04-08T20:26:21+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2023-04-08T20:26:21+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2023-04-08T20:26:21+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-04-08T20:26:21+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package_old.html</loc>
-  <lastmod>2023-04-08T20:26:22+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2023-04-08T20:26:22+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2023-04-08T20:26:22+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2023-04-08T20:26:22+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-04-08T20:26:22+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-04-08T20:26:23+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2023-04-08T20:26:23+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2023-04-08T20:26:23+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2023-04-08T20:26:23+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2023-04-08T20:26:23+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2023-04-08T20:26:23+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/target_instance.html</loc>
-  <lastmod>2023-04-08T20:26:24+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2023-04-08T20:26:24+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2023-04-08T20:26:24+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2023-04-08T20:26:24+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2023-04-08T20:26:24+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2023-04-08T20:26:25+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2023-04-08T20:26:25+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2023-04-08T20:26:25+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/helper_interfaces.html</loc>
-  <lastmod>2023-04-08T20:26:25+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2023-04-08T20:26:25+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_instance.html</loc>
-  <lastmod>2023-04-08T20:26:26+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/option_instance.html</loc>
-  <lastmod>2023-04-08T20:26:26+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2023-04-08T20:26:26+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2023-04-08T20:26:26+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-04-08T20:26:26+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package_old.html</loc>
-  <lastmod>2023-04-08T20:26:27+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2023-04-08T20:26:27+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2023-04-08T20:26:27+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2023-04-08T20:26:27+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-04-08T20:26:27+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-04-08T20:26:28+08:00</lastmod>
+  <lastmod>2023-04-20T10:11:32+08:00</lastmod>
 </url>
 
 </urlset>

+ 133 - 5
zh-cn/guide/project_examples.md

@@ -1256,7 +1256,9 @@ target("example")
     add_packages("python")
 ```
 
-### C++20 模块
+## C++20 模块
+
+### 快速开始
 
 xmake 采用 `.mpp` 作为默认的模块扩展名,但是也同时支持 `.ixx`, `.cppm`, `.mxx` 等扩展名。
 
@@ -1271,6 +1273,8 @@ target("class")
 
 更多例子见:[C++ Modules](https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules)
 
+### Cpp-Only 工程
+
 v2.7.1 版本对 C++20 模块的实现进行了重构和升级,新增了对 Headerunits 的支持,我们可以在模块中引入 Stl 和 用户头文件模块。
 
 相关的补丁见:[#2641](https://github.com/xmake-io/xmake/pull/2641)。
@@ -1290,9 +1294,133 @@ target("test")
     set_policy("build.c++.modules", true)
 ```
 
-### 合并静态库
+### 模块的分发和集成
+
+#### 分发 C++ Modules 包
+
+我们先使用 xmake.lua 维护模块的构建,并通过指定 `{install = true}`,来告诉 xmake 哪些模块文件需要安装对外分发。
+
+```lua
+add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+target("foo")
+    set_kind("static")
+    add_files("*.cpp")
+    add_files("*.mpp", { install = true })
+```
+
+然后,我们把它做成包,可以提交到 [xmake-repo](https://github.com/xmake-io/xmake-repo) 仓库,当然也可以直接做成本地包,或者私有仓库包。
+
+这里,为了方便测试验证,我们仅仅通过 `set_sourcedir` 将它做成本地包。
+
+```lua
+package("foo")
+    set_sourcedir(path.join(os.scriptdir(), "src"))
+    on_install(function(package)
+        import("package.tools.xmake").install(package, {})
+    end)
+```
+
+#### 集成 C++ Modules 包
+
+然后,我们通过 `add_requires("foo")` 的包集成接口,对 C++ Modules 包进行快速集成使用。
+
+由于 foo 的模块包,我们放在私有仓库中定义,所以我们通过 `add_repositories("my-repo my-repo")` 引入自己的包仓库。
+
+如果,包已经提交到 xmake-repo 官方仓库,就不需要额外配置它。
+
+```lua
+add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+
+add_repositories("my-repo my-repo")
+add_requires("foo", "bar")
+
+target("packages")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    add_packages("foo", "bar")
+    set_policy("build.c++.modules", true)
+```
+
+集成好包后,我们就可以执行 `xmake` 命令,一键下载、编译、集成 C++ Modules 包来使用。
+
+```bash
+$ xmake
+checking for platform ... linux
+checking for architecture ... x86_64
+note: install or modify (m) these packages (pass -y to skip confirm)?
+in my-repo:
+  -> foo latest
+  -> bar latest
+please input: y (y/n/m)
+
+  => install bar latest .. ok
+  => install foo latest .. ok
+[  0%]: generating.module.deps src/main.cpp
+[  0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/b/bar/latest/4e0143c97b65425b855ad5fd03038b6a/modules/bar/bar.mpp
+[  0%]: generating.module.deps /mnt/xmake/tests/projects/c++/modules/packages/build/.packages/f/foo/latest/4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp
+[ 14%]: compiling.module.release bar
+[ 14%]: compiling.module.release foo
+[ 57%]: compiling.release src/main.cpp
+[ 71%]: linking.release packages
+[100%]: build ok!
+```
+
+注:每个包安装后,会在包路径下,存储维护模块的 meta-info 文件,这是 `p2473r1.pdf` 中约定的一种格式规范,也许它不是最终的标准,但这并不影响我们现在去使用模块的分发。
+
+```bash
+$ cat ./build/.packages/f/foo/latest/4e0143c97b65425b855ad5fd03038b6a/modules/foo/foo.mpp.meta-info
+{"_VENDOR_extension":{"xmake":{"name":"foo","file":"foo.mpp"}},"definitions":{},"include_paths":{}}
+```
+
+完整的例子工程见:[C++ Modules 包分发例子工程](https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/modules/packages)
+
+### 支持 C++23 Std Modules
+
+[Arthapz](https://github.com/Arthapz) 也帮忙改进了对 C++23 Std Modules 的支持。
+
+目前三个编译器对它的支持进展:
+
+#### Msvc
+
+最新 Visual Studio 17.5 preview 已经支持,并且非标准的 ifc std modules 将被废弃。
+
+对于标准的 C++23 std modules,我们是这么引入的。
+
+```c
+import std;
+```
+
+而对于 ifc std modules,我们需要这么写:
+
+```
+import std.core;
+```
+
+它不是 C++23 标准,仅仅 msvc 提供,对其他编译器并不兼容,以后新版本 msvc 中也会逐步废弃。
+因此新版本 Xmake 将仅仅 C++23 std modules,不再支持废弃的 ifc std modules。
+
+#### Clang
+
+目前最新的 clang 似乎也还没完全支持 C++23 std modules,当前还是 draft patch 状态,[#D135507](https://reviews.llvm.org/D135507)。
+
+但是,Xmake 也对它进行了支持,如果大家想要尝鲜,可以自行合入这个 patch,然后使用 xmake 来测试。
+
+另外,低版本的 clang 也有对非标准的 std modules 做了实验性支持。
+
+我们还是可以在低版本 clang 中尝试性使用 xmake 来构建 std modules,尽管它可能还只是个玩具(会遇到很多问题)。
+
+相关讨论见:[#3255](https://github.com/xmake-io/xmake/pull/3255)
+
+#### Gcc
+
+目前还不支持。
+
+## 合并静态库
 
-#### 自动合并 target 库
+### 自动合并 target 库
 
 2.5.8 之后,我们可以通过设置 `build.merge_archive` 策略,启用自动合并依赖的所有静态库,例如:
 
@@ -1320,7 +1448,7 @@ mul 静态库自动合并了 add 和 sub 静态库,生成一个包含 add/sub
 
 这个合并相对比较稳定完善,支持 ar 和 msvc/lib.exe,也支持交叉编译工具链生成的静态库合并,也支持带有重名 obj 文件的静态库。
 
-#### 合并指定的静态库文件
+### 合并指定的静态库文件
 
 如果自动合并不满足需求,我们也可以主动调用 `utils.archive.merge_archive` 模块在 `after_link` 阶段合并指定的静态库列表。
 
@@ -1332,7 +1460,7 @@ target("test")
     end)
 ```
 
-#### 使用 add_files 合并静态库
+### 使用 add_files 合并静态库
 
 其实,我们之前的版本已经支持通过 `add_files("*.a")` 来合并静态库。