ruki 1 rok pred
rodič
commit
30fe5e4570

+ 36 - 0
guide/build_policies.md

@@ -133,6 +133,42 @@ Of course, if the build source files in some special targets depend on previous
 set_policy("build.across_targets_in_parallel", false)
 ```
 
+### build.fence
+
+Due to the limitation of `set_policy(‘build.across_targets_in_parallel’, false)`, it will limit the parallelism between the parent target and all of its dependent subtargets, which is a bit wide.
+
+When we do codegen, sometimes we just want to limit the parallelism of one of the dependent targets, as a codegen program, and let it finish compiling in advance.
+
+In this case, `build.cross_targets_in_parallel` can't control it finely, and the compilation speed can't be optimised.
+
+Therefore, we have added the `build.fence` policy, which restricts parallel compilation links to only certain sub-targets.
+
+For background, see [#5003](https://github.com/xmake-io/xmake/issues/5003).
+
+Example:
+
+```lua
+target(‘autogen’)
+    set_default(false)
+    set_kind(‘binary’)
+    set_plat(os.host())
+    set_arch(os.arch())
+    add_files(‘src/autogen.cpp’)
+    set_languages(‘c++11’)
+    set_policy(‘build.fence’, true)
+
+target(‘test’)
+    set_kind(‘binary’)
+    add_deps(‘autogen’)
+    add_rules(‘autogen’)
+    add_files(‘src/main.cpp’)
+    add_files(‘src/*.in’)
+```
+
+The autogen target needs to be compiled and linked before the source code of the test program is compiled, because the test target needs to run the autogen program to dynamically generate some source code to participate in the compilation.
+
+The autogen configuration `set_policy(‘build.fence’, true)` does this.
+
 ### build.merge_archive
 
 If this policy is set, then the target libraries that are dependent on using `add_deps()` no longer exist as links, but are merged directly into the parent target library.

+ 25 - 0
mirror/guide/build_policies.html

@@ -168,6 +168,31 @@ target("test")
 <p>Of course, if the build source files in some special targets depend on previous targets (especially in the case of some custom rules, although rarely encountered), we can also disable this optimization behavior through the following settings:</p>
 <pre><code class="lang-bash">set_policy("build.across_targets_in_parallel", false)
 </code></pre>
+<h3 id="buildfence">build.fence</h3>
+<p>Due to the limitation of <code>set_policy(‘build.across_targets_in_parallel’, false)</code>, it will limit the parallelism between the parent target and all of its dependent subtargets, which is a bit wide.</p>
+<p>When we do codegen, sometimes we just want to limit the parallelism of one of the dependent targets, as a codegen program, and let it finish compiling in advance.</p>
+<p>In this case, <code>build.cross_targets_in_parallel</code> can&#39;t control it finely, and the compilation speed can&#39;t be optimised.</p>
+<p>Therefore, we have added the <code>build.fence</code> policy, which restricts parallel compilation links to only certain sub-targets.</p>
+<p>For background, see <a href="https://github.com/xmake-io/xmake/issues/5003">#5003</a>.</p>
+<p>Example:</p>
+<pre><code class="lang-lua">target(‘autogen’)
+    set_default(false)
+    set_kind(‘binary’)
+    set_plat(os.host())
+    set_arch(os.arch())
+    add_files(‘src/autogen.cpp’)
+    set_languages(‘c++11’)
+    set_policy(‘build.fence’, true)
+
+target(‘test’)
+    set_kind(‘binary’)
+    add_deps(‘autogen’)
+    add_rules(‘autogen’)
+    add_files(‘src/main.cpp’)
+    add_files(‘src/*.in’)
+</code></pre>
+<p>The autogen target needs to be compiled and linked before the source code of the test program is compiled, because the test target needs to run the autogen program to dynamically generate some source code to participate in the compilation.</p>
+<p>The autogen configuration <code>set_policy(‘build.fence’, true)</code> does this.</p>
 <h3 id="buildmerge_archive">build.merge_archive</h3>
 <p>If this policy is set, then the target libraries that are dependent on using <code>add_deps()</code> no longer exist as links, but are merged directly into the parent target library.</p>
 <p>Example.</p>

+ 3 - 3
mirror/guide/quickstart.html

@@ -106,7 +106,7 @@
 <p>The content of <code>xmake.lua</code> is very simple:</p>
 <pre><code class="lang-lua">target("hello")
     set_kind("binary")
-    add_files("src/*.c") 
+    add_files("src/*.c")
 </code></pre>
 <p>Supported Languages</p>
 <ul>
@@ -137,11 +137,11 @@ $ xmake
 </code></pre>
 <h2 id="debugprogram">Debug Program</h2>
 <p>To debug the hello, you need change to the debug mode and build it.</p>
-<pre><code class="lang-bash">$ xmake config -m debug 
+<pre><code class="lang-bash">$ xmake config -m debug
 $ xmake
 </code></pre>
 <p>Then run the following command to debug target program.</p>
-<pre><code class="lang-bash">$ xmake run -d hello 
+<pre><code class="lang-bash">$ xmake run -d hello
 </code></pre>
 <p>It will start the debugger (.e.g lldb, gdb, windbg, vsjitdebugger, ollydbg ..) to load our program.</p>
 <pre><code class="lang-bash">[lldb]$target create "build/hello"

+ 25 - 0
mirror/zh-cn/guide/build_policies.html

@@ -170,6 +170,31 @@ target("test")
 <p>当然,如果有些特殊的target里面的构建源文件要依赖先前的target(尤其是一些自定义rules的情况,虽然很少遇到),我们也可以通过下面的设置禁用这个优化行为:</p>
 <pre><code class="lang-bash">set_policy("build.across_targets_in_parallel", false)
 </code></pre>
+<h3 id="buildfence">build.fence</h3>
+<p>由于配置 <code>set_policy("build.across_targets_in_parallel", false)</code> 存在局限性,它会限制父 target 和它的所有依赖的子 target 之间的并行度,影响的范围有点大。</p>
+<p>而我们做 codegen 时候,有时候仅仅只是想对其中某个依赖的 target 限制并行度,作为 codegen 程序,提前让它完成编译。</p>
+<p>这个时候,<code>build.across_targets_in_parallel</code> 就无法精细控制了,编译速度也无法达到最优。</p>
+<p>因此,我们新增了 <code>build.fence</code> 策略,它可以仅仅只针对特定的子 target 限制并行编译链接。</p>
+<p>相关的背景细节,可以看下:<a href="https://github.com/xmake-io/xmake/issues/5003">#5003</a></p>
+<p>例如:</p>
+<pre><code class="lang-lua">target("autogen")
+    set_default(false)
+    set_kind("binary")
+    set_plat(os.host())
+    set_arch(os.arch())
+    add_files("src/autogen.cpp")
+    set_languages("c++11")
+    set_policy("build.fence", true)
+
+target("test")
+    set_kind("binary")
+    add_deps("autogen")
+    add_rules("autogen")
+    add_files("src/main.cpp")
+    add_files("src/*.in")
+</code></pre>
+<p>其中 autogen 目标程序需要在 test 程序的源码被编译前,就要完成编译链接,因为 test 目标需要运行 autogen 程序,去动态生成一些源码参与编译。</p>
+<p>而针对 autogen 配置 <code>set_policy("build.fence", true)</code> 就可以实现这个目的。</p>
 <h3 id="buildmerge_archive">build.merge_archive</h3>
 <p>如果设置了这个策略,那么使用 <code>add_deps()</code> 依赖的目标库不再作为链接存在,而是直接把它们合并到父目标库中去。</p>
 <p>例如:</p>

+ 106 - 106
sitemap.xml

@@ -12,532 +12,532 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2024-04-26T21:31:39+08:00</lastmod>
+  <lastmod>2024-05-21T22:52:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2024-04-26T21:31:39+08:00</lastmod>
+  <lastmod>2024-05-21T22:52:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2024-04-26T21:31:40+08:00</lastmod>
+  <lastmod>2024-05-21T22:52:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/build_policies.html</loc>
-  <lastmod>2024-04-26T21:31:40+08:00</lastmod>
+  <lastmod>2024-05-21T22:52:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2024-04-26T21:31:40+08:00</lastmod>
+  <lastmod>2024-05-21T22:52:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2024-04-26T21:31:40+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2024-04-26T21:31:40+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/remote_build.html</loc>
-  <lastmod>2024-04-26T21:31:41+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/unity_build.html</loc>
-  <lastmod>2024-04-26T21:31:41+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/distcc_build.html</loc>
-  <lastmod>2024-04-26T21:31:41+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/trybuild.html</loc>
-  <lastmod>2024-04-26T21:31:41+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/autogen.html</loc>
-  <lastmod>2024-04-26T21:31:41+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/build_cache.html</loc>
-  <lastmod>2024-04-26T21:31:42+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2024-04-26T21:31:42+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2024-04-26T21:31:42+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2024-04-26T21:31:42+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2024-04-26T21:31:42+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2024-04-26T21:31:43+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2024-04-26T21:31:43+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2024-04-26T21:31:43+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2024-04-26T21:31:43+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/who_is_using_xmake.html</loc>
-  <lastmod>2024-04-26T21:31:43+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2024-04-26T21:31:44+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2024-04-26T21:31:44+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2024-04-26T21:31:44+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2024-04-26T21:31:44+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2024-04-26T21:31:44+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/build_policies.html</loc>
-  <lastmod>2024-04-26T21:31:45+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2024-04-26T21:31:45+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2024-04-26T21:31:45+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2024-04-26T21:31:45+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/remote_build.html</loc>
-  <lastmod>2024-04-26T21:31:46+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/unity_build.html</loc>
-  <lastmod>2024-04-26T21:31:46+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/distcc_build.html</loc>
-  <lastmod>2024-04-26T21:31:46+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/trybuild.html</loc>
-  <lastmod>2024-04-26T21:31:46+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/autogen.html</loc>
-  <lastmod>2024-04-26T21:31:46+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/build_cache.html</loc>
-  <lastmod>2024-04-26T21:31:47+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2024-04-26T21:31:47+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2024-04-26T21:31:47+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2024-04-26T21:31:47+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2024-04-26T21:31:47+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2024-04-26T21:31:48+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2024-04-26T21:31:48+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2024-04-26T21:31:48+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2024-04-26T21:31:48+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2024-04-26T21:31:48+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/who_is_using_xmake.html</loc>
-  <lastmod>2024-04-26T21:31:49+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2024-04-26T21:31:49+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2024-04-26T21:31:49+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2024-04-26T21:31:49+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2024-04-26T21:31:49+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/native_modules.html</loc>
-  <lastmod>2024-04-26T21:31:50+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2024-04-26T21:31:50+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2024-04-26T21:31:50+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2024-04-26T21:31:50+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2024-04-26T21:31:50+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/target_instance.html</loc>
-  <lastmod>2024-04-26T21:31:51+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2024-04-26T21:31:51+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2024-04-26T21:31:51+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2024-04-26T21:31:51+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2024-04-26T21:31:52+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2024-04-26T21:31:52+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2024-04-26T21:31:52+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2024-04-26T21:31:52+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/helper_interfaces.html</loc>
-  <lastmod>2024-04-26T21:31:52+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2024-04-26T21:31:53+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_instance.html</loc>
-  <lastmod>2024-04-26T21:31:53+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/xpack.html</loc>
-  <lastmod>2024-04-26T21:31:53+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/option_instance.html</loc>
-  <lastmod>2024-04-26T21:31:53+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2024-04-26T21:31:53+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2024-04-26T21:31:54+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_3rd_source_library.html</loc>
-  <lastmod>2024-04-26T21:31:54+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package_old.html</loc>
-  <lastmod>2024-04-26T21:31:54+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2024-04-26T21:31:54+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2024-04-26T21:31:55+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2024-04-26T21:31:55+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/remote_toolchain.html</loc>
-  <lastmod>2024-04-26T21:31:55+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2024-04-26T21:31:55+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:14+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2024-04-26T21:31:55+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/native_modules.html</loc>
-  <lastmod>2024-04-26T21:31:56+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2024-04-26T21:31:56+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2024-04-26T21:31:56+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2024-04-26T21:31:56+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2024-04-26T21:31:56+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/target_instance.html</loc>
-  <lastmod>2024-04-26T21:31:57+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2024-04-26T21:31:57+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2024-04-26T21:31:57+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2024-04-26T21:31:57+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2024-04-26T21:31:57+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2024-04-26T21:31:58+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2024-04-26T21:31:58+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2024-04-26T21:31:58+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/helper_interfaces.html</loc>
-  <lastmod>2024-04-26T21:31:58+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2024-04-26T21:31:59+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_instance.html</loc>
-  <lastmod>2024-04-26T21:31:59+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/xpack.html</loc>
-  <lastmod>2024-04-26T21:31:59+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/option_instance.html</loc>
-  <lastmod>2024-04-26T21:31:59+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2024-04-26T21:31:59+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2024-04-26T21:32:00+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_3rd_source_library.html</loc>
-  <lastmod>2024-04-26T21:32:00+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package_old.html</loc>
-  <lastmod>2024-04-26T21:32:00+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2024-04-26T21:32:00+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2024-04-26T21:32:00+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2024-04-26T21:32:01+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/remote_toolchain.html</loc>
-  <lastmod>2024-04-26T21:32:01+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2024-04-26T21:32:01+08:00</lastmod>
+  <lastmod>2024-05-21T22:53:20+08:00</lastmod>
 </url>
 
 </urlset>

+ 36 - 0
zh-cn/guide/build_policies.md

@@ -136,6 +136,42 @@ set_policy("check.auto_map_flags", false)
 set_policy("build.across_targets_in_parallel", false)
 ```
 
+### build.fence
+
+由于配置 `set_policy("build.across_targets_in_parallel", false)` 存在局限性,它会限制父 target 和它的所有依赖的子 target 之间的并行度,影响的范围有点大。
+
+而我们做 codegen 时候,有时候仅仅只是想对其中某个依赖的 target 限制并行度,作为 codegen 程序,提前让它完成编译。
+
+这个时候,`build.across_targets_in_parallel` 就无法精细控制了,编译速度也无法达到最优。
+
+因此,我们新增了 `build.fence` 策略,它可以仅仅只针对特定的子 target 限制并行编译链接。
+
+相关的背景细节,可以看下:[#5003](https://github.com/xmake-io/xmake/issues/5003)
+
+例如:
+
+```lua
+target("autogen")
+    set_default(false)
+    set_kind("binary")
+    set_plat(os.host())
+    set_arch(os.arch())
+    add_files("src/autogen.cpp")
+    set_languages("c++11")
+    set_policy("build.fence", true)
+
+target("test")
+    set_kind("binary")
+    add_deps("autogen")
+    add_rules("autogen")
+    add_files("src/main.cpp")
+    add_files("src/*.in")
+```
+
+其中 autogen 目标程序需要在 test 程序的源码被编译前,就要完成编译链接,因为 test 目标需要运行 autogen 程序,去动态生成一些源码参与编译。
+
+而针对 autogen 配置 `set_policy("build.fence", true)` 就可以实现这个目的。
+
 ### build.merge_archive
 
 如果设置了这个策略,那么使用 `add_deps()` 依赖的目标库不再作为链接存在,而是直接把它们合并到父目标库中去。