summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/clang.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-09 22:42:52 +0800
committerruki <[email protected]>2022-08-09 22:42:52 +0800
commitaf7118dcc94785f628abe1cea5cd030514ea9e88 (patch)
treeb4b59671a866348f471985125d3382d700cfe78c /xmake/rules/c++/modules/modules_support/clang.lua
parent1c039fcf27683545adb20ca316d42b1123282719 (diff)
improve mapper for clang/msvc
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/clang.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index 1b086c27a..866669257 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -367,6 +367,15 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
if not os.isdir(objectdir) then
os.mkdir(objectdir)
end
+ -- append module mapper flags first
+ -- @note we add it at the end to ensure that the full mapflags are already stored in the mapper
+ if not target:data("cxx.add_modules_mapflags") then
+ local mapflags = _get_mapflags_from_mapper()
+ if mapflags then
+ target:add("cxxflags", mapflags, {force = true})
+ end
+ target:data_set("cxx.add_modules_mapflags", true)
+ end
local args = {emitmoduleinterfaceflag, "-c", "-x", "c++-module", "--precompile", provide.sourcefile, "-o", bmifile}
os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args))
os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, {bmifile}, {"-c", "-o", objectfile}))
@@ -383,12 +392,6 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
end
_flush_mapflags_to_mapper()
- -- append module mapper flags
- local mapflags = _get_mapflags_from_mapper()
- if mapflags then
- target:add("cxxflags", mapflags, {force = true})
- end
-
-- build batchjobs for modules
common.build_batchjobs_for_modules(provided_modules, batchjobs, opt.rootjob)
end