diff options
| author | ruki <[email protected]> | 2026-01-24 22:21:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-24 22:21:01 +0800 |
| commit | 6f2f989f19df66e73999ffaaffc69b8df1159a68 (patch) | |
| tree | 505f60d1873ada42d55244b6550e22cb1beede79 /xmake/rules/objc++ | |
| parent | 1532bf0e2acfe769c2545b3d3d4f35ed5556de24 (diff) | |
improve objc pch
Diffstat (limited to 'xmake/rules/objc++')
| -rw-r--r-- | xmake/rules/objc++/precompiled_header/xmake.lua | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/xmake/rules/objc++/precompiled_header/xmake.lua b/xmake/rules/objc++/precompiled_header/xmake.lua index ed0eda0a4..5dafb0e84 100644 --- a/xmake/rules/objc++/precompiled_header/xmake.lua +++ b/xmake/rules/objc++/precompiled_header/xmake.lua @@ -20,18 +20,32 @@ rule("objc.build.pcheader") on_config(function (target, opt) - import("private.action.build.pcheader").config(target, "m", opt) + import("private.action.build.pcheader") + if not pcheader.config(target, "m", opt) then + target:rule_enable("objc.build.pcheader", false) + end end) - before_prepare(function (target, jobgraph, opt) - import("private.action.build.pcheader").build(target, jobgraph, "m", opt) + + before_build(function (target, jobgraph, opt) + if not os.getenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR") then + import("private.action.build.pcheader").build(target, jobgraph, "m", opt) + end end, {jobgraph = true}) rule("objc++.build.pcheader") add_orders("objc++.build.pcheader", "c++.build.modules.builder") on_config(function (target, opt) - import("private.action.build.pcheader").config(target, "mxx", opt) + import("private.action.build.pcheader") + if not pcheader.config(target, "mxx", opt) then + target:rule_enable("objc++.build.pcheader", false) + end end) - before_prepare(function (target, jobgraph, opt) + + -- Since Objective-C typically does not have C++ modules, + -- we can always enable parallel compilation across targets + -- without blocking the compilation of other cpp files, + -- we perform this as much as possible during the before_build stage. + before_build(function (target, jobgraph, opt) import("private.action.build.pcheader").build(target, jobgraph, "mxx", opt) end, {jobgraph = true}) |
