summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/msvc.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/msvc.lua
parent1c039fcf27683545adb20ca316d42b1123282719 (diff)
improve mapper for clang/msvc
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua
index 7ac93273f..bcc781248 100644
--- a/xmake/rules/c++/modules/modules_support/msvc.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc.lua
@@ -368,6 +368,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 = {"-c", "-Fo" .. objectfile, interfaceflag, ifcoutputflag, bmifile, provide.sourcefile}
os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args), {envs = vcvars})
end, {dependfile = target:dependfile(bmifile), files = {provide.sourcefile}})
@@ -383,11 +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)