diff options
| author | Arthur LAURENT <[email protected]> | 2024-08-04 18:23:32 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-10-08 13:47:44 +0200 |
| commit | d3a75d4be2aa50a1dfdf5b7708c08409b5e28fcb (patch) | |
| tree | 7c722f86359df42de2dc692aeac4ead296bfdde6 /xmake/rules/c++/modules | |
| parent | 758fcd4b98944108663cbf80e6417966c30caa6d (diff) | |
fix gcc module scanning when buildflags are updated
Diffstat (limited to 'xmake/rules/c++/modules')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua index 38d7c6069..237e22627 100644 --- a/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua @@ -35,6 +35,7 @@ function generate_dependency_for(target, sourcefile, opt) local depsfileflag = compiler_support.get_depsfileflag(target) local depstargetflag = compiler_support.get_depstargetflag(target) local dependfile = target:dependfile(sourcefile) + local flags = compinst:compflags({sourcefile = file, target = target}) or {} local changed = false depend.on_changed(function() @@ -48,8 +49,7 @@ function generate_dependency_for(target, sourcefile, opt) if has_depsflags and not target:policy("build.c++.gcc.fallbackscanner") then local ifile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".i")) local dfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".d")) - local compflags = compinst:compflags({sourcefile = sourcefile, target = target}) - local flags = table.join(compflags or {}, baselineflags, {sourcefile, "-MT", jsonfile, "-MD", "-MF", dfile, depsformatflag, depsfileflag .. jsonfile, depstargetflag .. target:objectfile(sourcefile), "-o", ifile}) + local flags = table.join(flags or {}, baselineflags, {sourcefile, "-MT", jsonfile, "-MD", "-MF", dfile, depsformatflag, depsfileflag .. jsonfile, depstargetflag .. target:objectfile(sourcefile), "-o", ifile}) os.vrunv(compinst:program(), flags) os.rm(ifile) os.rm(dfile) @@ -58,7 +58,7 @@ function generate_dependency_for(target, sourcefile, opt) wprint("GCC doesn't support module scanning ! using fallback scanner") end fallback_generate_dependencies(target, jsonfile, sourcefile, function(file) - local compflags = compinst:compflags({sourcefile = file, target = target}) + local compflags = flags -- exclude -fmodule* flags because, when they are set gcc try to find bmi of imported modules but they don't exists a this point of compilation table.remove_if(compflags, function(_, flag) return flag:startswith("-fmodule") end) local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) @@ -73,7 +73,7 @@ function generate_dependency_for(target, sourcefile, opt) local dependinfo = io.readfile(jsonfile) return { moduleinfo = dependinfo } - end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt()}) + end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt(), values = flags}) return changed end |
