summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/msvc
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-04-23 18:40:13 +0200
committerArthur LAURENT <[email protected]>2025-04-23 18:40:13 +0200
commita26ab0a2df198a1af1c3a68d63fd16b042b01486 (patch)
tree2f1a05acfc39d8f49ee738ef6bcbc148cec7f2c6 /xmake/rules/c++/modules/msvc
parentd60e9b244f091593232fffae837ec0504c51f032 (diff)
(C++ modules support) improve modules policy naming
Diffstat (limited to 'xmake/rules/c++/modules/msvc')
-rw-r--r--xmake/rules/c++/modules/msvc/scanner.lua5
-rw-r--r--xmake/rules/c++/modules/msvc/support.lua4
2 files changed, 7 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/msvc/scanner.lua b/xmake/rules/c++/modules/msvc/scanner.lua
index b4d68df37..07342a55e 100644
--- a/xmake/rules/c++/modules/msvc/scanner.lua
+++ b/xmake/rules/c++/modules/msvc/scanner.lua
@@ -38,13 +38,16 @@ function generate_dependency_for(target, sourcefile, opt)
local compinst = target:compiler("cxx")
local flags = compinst:compflags({sourcefile = sourcefile, target = target}) or {}
local changed = false
+ local fallbackscanner = target:policy("build.c++.modules.fallbackscanner") or
+ target:policy("build.c++.modules.msvc.fallbackscanner") or
+ target:policy("build.c++.msvc.fallbackscanner")
depend.on_changed(function ()
progress.show(opt.progress, "${color.build.target}<%s> generating.module.deps %s", target:fullname(), sourcefile)
local outputdir = support.get_outputdir(target, sourcefile)
local jsonfile = path.join(outputdir, path.filename(sourcefile) .. ".module.json")
- if scandependenciesflag and not target:policy("build.c++.msvc.fallbackscanner") then
+ if scandependenciesflag and not fallbackscanner then
local dependency_flags = {jsonfile, sourcefile, ifcoutputflag, outputdir, "-Fo" .. target:objectfile(sourcefile)}
local compflags = table.join(flags, common_flags, dependency_flags)
os.vrunv(compinst:program(), winos.cmdargv(compflags), {envs = msvc:runenvs()})
diff --git a/xmake/rules/c++/modules/msvc/support.lua b/xmake/rules/c++/modules/msvc/support.lua
index f2b07b999..0da24501f 100644
--- a/xmake/rules/c++/modules/msvc/support.lua
+++ b/xmake/rules/c++/modules/msvc/support.lua
@@ -94,7 +94,9 @@ function strip_flags(target, flags)
"analyze",
"?",
}
- if not target:policy("build.c++.modules.tryreuse.discriminate_on_defines") then
+ local strict = target:policy("build.c++.modules.reuse.strict") or
+ target:policy("build.c++.modules.tryreuse.discriminate_on_defines")
+ if not strict then
table.join2(strippable_flags, {"D", "U"})
end
local output = {}