diff options
| author | ruki <[email protected]> | 2022-08-27 10:59:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-08-27 10:59:39 +0800 |
| commit | 79232b37232fbaa5cb4e453d34540b427a884745 (patch) | |
| tree | 5db2579cebe189f418d3ac37f20ba0502bde54cd | |
| parent | eb9a71b929de0c144dad3d137c61297c908440c8 (diff) | |
improve modules
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index 062dea52b..8a05ff0e0 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -52,24 +52,6 @@ rule("c++.build.modules.builder") set_sourcekinds("cxx") set_extensions(".mpp", ".mxx", ".cppm", ".ixx") - -- generate headerunits - -- parallel build support to accelerate `xmake build` to build headerunits - before_build(function(target, batchjobs, opt) - local job - if target:data("cxx.has_modules") then - import("modules_support.common") - local sourcebatch = target:sourcebatches()["c++.build.modules.builder"] - common.patch_sourcebatch(target, sourcebatch, opt) - - -- generate headerunits - local modules = common.get_module_dependencies(target, sourcebatch, opt) - batchjobs:group_enter(target:name() .. "/generate_headerunits") - common.generate_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) - job = batchjobs:group_leave() - end - return job or opt.rootjob - end, {batch = true}) - -- build modules -- parallel build support to accelerate `xmake build` to build modules before_build_files(function(target, batchjobs, sourcebatch, opt) @@ -77,7 +59,14 @@ rule("c++.build.modules.builder") import("modules_support.common") common.patch_sourcebatch(target, sourcebatch, opt) local modules = common.get_module_dependencies(target, sourcebatch, opt) + + -- build modules common.build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) + + -- generate headerunits and we need do it before building modules + opt.rootjob = batchjobs:group_leave() or opt.rootjob + batchjobs:group_enter(target:name() .. "/generate_headerunits") + common.generate_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) else -- avoid duplicate linking of object files of non-module programs sourcebatch.objectfiles = {} |
