summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2024-08-04 18:07:24 +0200
committerArthur LAURENT <[email protected]>2024-10-08 13:47:43 +0200
commit3fc650750d19020568c17aa2d5540e48faf92d63 (patch)
tree2293b1607d5e9b63648c8a545831e3c3824bc844 /xmake/rules/c++/modules
parent124e091f949eb35a47129086f8320eb8ae5bfcbd (diff)
fix clang module scanning when buildflags are updated
Diffstat (limited to 'xmake/rules/c++/modules')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua
index 4bc15dbde..03c86eaa3 100644
--- a/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua
+++ b/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua
@@ -31,6 +31,7 @@ function generate_dependency_for(target, sourcefile, opt)
local compinst = target:compiler("cxx")
local changed = false
local dependfile = target:dependfile(sourcefile)
+ local compflags = compinst:compflags({sourcefile = file, target = target})
depend.on_changed(function()
if opt.progress then
progress.show(opt.progress, "${color.build.target}<%s> generating.module.deps %s", target:name(), sourcefile)
@@ -47,7 +48,6 @@ function generate_dependency_for(target, sourcefile, opt)
clang_path = compiler_support.get_clang_path(target) or compinst:program()
end
local clangscandeps = compiler_support.get_clang_scan_deps(target)
- local compflags = compinst:compflags({sourcefile = sourcefile, target = target})
local flags = table.join({"--format=p1689", "--",
clang_path, "-x", "c++", "-c", sourcefile, "-o", target:objectfile(sourcefile)}, compflags or {})
if option.get("verbose") then
@@ -63,7 +63,6 @@ function generate_dependency_for(target, sourcefile, opt)
end
fallback_generate_dependencies(target, jsonfile, sourcefile, function(file)
local keepsystemincludesflag = compiler_support.get_keepsystemincludesflag(target)
- local compflags = compinst:compflags({sourcefile = file, target = target})
-- exclude -fmodule* and -std=c++/gnu++* flags because
-- when they are set clang try to find bmi of imported modules but they don't exists in this point of compilation
table.remove_if(compflags, function(_, flag)
@@ -81,8 +80,7 @@ function generate_dependency_for(target, sourcefile, opt)
local rawdependinfo = io.readfile(jsonfile)
return {moduleinfo = rawdependinfo}
- end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt()})
-
+ end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt(), values = compflags})
return changed
end