summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2024-08-04 18:59:53 +0200
committerArthur LAURENT <[email protected]>2024-10-08 13:47:44 +0200
commitfb0286bc3d912dc83a92260db1b82dac2990b971 (patch)
treefc69224c34a4a7812921fe17b79b24ef946be250
parentaad386b8e891bc8b0aa6d6db03c1f6bbaf97a15b (diff)
fix msvc dependency scanner
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua
index 489ca1d97..cd0928f49 100644
--- a/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc/dependency_scanner.lua
@@ -35,6 +35,7 @@ function generate_dependency_for(target, sourcefile, opt)
local ifcoutputflag = compiler_support.get_ifcoutputflag(target)
local common_flags = {"-TP", scandependenciesflag}
local dependfile = target:dependfile(sourcefile)
+ local compinst = target:compiler("cxx")
local flags = compinst:compflags({sourcefile = file, target = target}) or {}
local changed = false
@@ -45,12 +46,10 @@ function generate_dependency_for(target, sourcefile, opt)
local jsonfile = path.join(outputdir, path.filename(sourcefile) .. ".module.json")
if scandependenciesflag and not target:policy("build.c++.msvc.fallbackscanner") then
local dependency_flags = {jsonfile, sourcefile, ifcoutputflag, outputdir, "-Fo" .. target:objectfile(sourcefile)}
- local compinst = target:compiler("cxx")
local compflags = table.join(flags, common_flags, dependency_flags)
os.vrunv(compinst:program(), winos.cmdargv(compflags), {envs = msvc:runenvs()})
else
fallback_generate_dependencies(target, jsonfile, sourcefile, function(file)
- local compinst = target:compiler("cxx")
local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i"))
os.vrunv(compinst:program(), table.join(flags,
{"/P", "-TP", file, "/Fi" .. ifile}), {envs = msvc:runenvs()})