summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/xmake.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
-rw-r--r--xmake/rules/c++/modules/xmake.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 387534fe0..4a7193710 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -63,9 +63,22 @@ rule("c++.build.modules.builder")
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", {rootjob = opt.rootjob})
- common.generate_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules, opt)
+ local user_headerunits, stl_headerunits = common.get_headerunits(target, sourcebatch, modules)
+ if user_headerunits or stl_headerunits then
+ -- we need new group(headerunits)
+ -- e.g. group(build_modules) -> group(headerunits)
+ opt.rootjob = batchjobs:group_leave() or opt.rootjob
+ batchjobs:group_enter(target:name() .. "/generate_headerunits", {rootjob = opt.rootjob})
+ local modules_support = common.modules_support(target)
+ if stl_headerunits then
+ -- build stl header units as other headerunits may need them
+ -- TODO maybe we need new group(build_modules) -> group(user_headerunits) -> group(stl_headerunits)
+ modules_support.generate_stl_headerunits_for_batchjobs(target, batchjobs, stl_headerunits, opt)
+ end
+ if user_headerunits then
+ modules_support.generate_user_headerunits_for_batchjobs(target, batchjobs, user_headerunits, opt)
+ end
+ end
else
-- avoid duplicate linking of object files of non-module programs
sourcebatch.objectfiles = {}