diff options
| author | ruki <[email protected]> | 2025-03-31 22:50:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-08 15:31:57 +0800 |
| commit | 1b735b328bda4d207675a1406dfe714e934de0c8 (patch) | |
| tree | 36cb837b1b44e8f4ea1f4a560d666e9e493a3e6e /xmake/rules/c++/modules/xmake.lua | |
| parent | 147ef59b5d5aeb19519e98ed07179ff84edaa5c9 (diff) | |
improve c++modules for jobgraph
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index f967dd133..30d65cf2a 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -71,7 +71,7 @@ rule("c++.build.modules.builder") set_extensions(".mpp", ".mxx", ".cppm", ".ixx") -- parallel build support to accelerate `xmake build` to build modules - before_build_files(function(target, batchjobs, sourcebatch, opt) + before_build_files(function(target, jobgraph, sourcebatch, opt) if target:data("cxx.has_modules") then import("modules_support.compiler_support") import("modules_support.dependency_scanner") @@ -102,7 +102,7 @@ rule("c++.build.modules.builder") end opt = opt or {} - opt.batchjobs = true + opt.jobgraph = true compiler_support.patch_sourcebatch(target, sourcebatch, opt) local modules = dependency_scanner.get_module_dependencies(target, sourcebatch, opt) @@ -112,11 +112,17 @@ rule("c++.build.modules.builder") local build_objectfiles, link_objectfiles = dependency_scanner.sort_modules_by_dependencies(target, sourcebatch.objectfiles, modules) sourcebatch.objectfiles = build_objectfiles - -- build modules - builder.build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) - - -- build headerunits and we need to do it before building modules - builder.build_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) + if jobgraph.add_orders then + -- build modules + builder.build_modules_for_jobgraph(target, jobgraph, sourcebatch, modules, opt) + -- build headerunits and we need to do it before building modules + builder.build_headerunits_for_jobgraph(target, jobgraph, sourcebatch, modules, opt) + else + -- build modules, deprecated + builder.build_modules_for_batchjobs(target, jobgraph, sourcebatch, modules, opt) + -- build headerunits and we need to do it before building modules + builder.build_headerunits_for_batchjobs(target, jobgraph, sourcebatch, modules, opt) + end sourcebatch.objectfiles = link_objectfiles else @@ -129,7 +135,7 @@ rule("c++.build.modules.builder") -- avoid duplicate linking of object files of non-module programs sourcebatch.objectfiles = {} end - end, {batch = true}) + end, {jobgraph = true, batch = true}) -- serial compilation only, usually used to support project generator before_buildcmd_files(function(target, batchcmds, sourcebatch, opt) @@ -163,7 +169,7 @@ rule("c++.build.modules.builder") end opt = opt or {} - opt.batchjobs = false + opt.jobgraph = false compiler_support.patch_sourcebatch(target, sourcebatch, opt) local modules = dependency_scanner.get_module_dependencies(target, sourcebatch, opt) |
