summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/msvc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-05 23:45:03 +0800
committerGitHub <[email protected]>2022-12-05 23:45:03 +0800
commit00b740c54e161a2c1abee2390a64a825de4f3271 (patch)
tree649fa19fd0bf6bf6a5f33aa2bcc87b757e81b91d /xmake/rules/c++/modules/modules_support/msvc.lua
parent47f6bbac08768f792f30e4cd4ff261e8c6645004 (diff)
parent718cccc5df0b1fe28cb80256dd325b57f3e44063 (diff)
Merge pull request #3133 from Arthapz/msvc-internal-partition
add support of internal partitions
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc.lua26
1 files changed, 16 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua
index d56a71e6d..0a4751886 100644
--- a/xmake/rules/c++/modules/modules_support/msvc.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc.lua
@@ -433,6 +433,7 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
local ifcoutputflag = get_ifcoutputflag(target)
local interfaceflag = get_interfaceflag(target)
local referenceflag = get_referenceflag(target)
+ local internalpartitionflag = get_internalpartitionflag(target)
-- flush job
local flushjob = batchjobs:addjob(target:name() .. "_modules", function(index, total)
@@ -464,12 +465,8 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
local dependfile = target:dependfile(objectfile)
if provide then
- table.join2(flags, {ifcoutputflag, provide.bmi})
+ table.join2(flags, {ifcoutputflag, path(provide.bmi), provide.interface and interfaceflag or internalpartitionflag})
dependfile = target:dependfile(provide.bmi)
-
- if provide.interface then
- table.insert(flags, interfaceflag)
- end
end
table.join2(moduleinfo, {
@@ -519,6 +516,7 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op
local ifcoutputflag = get_ifcoutputflag(target)
local interfaceflag = get_interfaceflag(target)
local referenceflag = get_referenceflag(target)
+ local internalpartitionflag = get_internalpartitionflag(target)
-- build modules
local depmtime = 0
@@ -549,11 +547,7 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op
local flags = table.join({"-TP", "-c", path(cppfile), path(objectfile, function (p) return "-Fo" .. p end)})
if provide or common.has_module_extension(cppfile) then
if provide then
- table.join2(flags, {ifcoutputflag, path(provide.bmi)})
-
- if provide.interface then
- table.insert(flags, interfaceflag)
- end
+ table.join2(flags, {ifcoutputflag, path(provide.bmi), provide.interface and interfaceflag or internalpartitionflag})
end
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.module.$(mode) %s", name or cppfile)
@@ -775,3 +769,15 @@ function get_cppversionflag(target)
end
return cppversionflag or nil
end
+
+function get_internalpartitionflag(target)
+ local internalpartitionflag = _g.internalpartitionflag
+ if internalpartitionflag == nil then
+ local compinst = target:compiler("cxx")
+ if compinst:has_flags("-internalPartition", "cxxflags", {flagskey = "cl_internal_partition"}) then
+ internalpartitionflag = "-internalPartition"
+ end
+ _g.internalpartitionflag = internalpartitionflag or false
+ end
+ return internalpartitionflag or nil
+end \ No newline at end of file