diff options
| author | Arthur LAURENT <[email protected]> | 2024-07-12 18:12:36 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-07-12 18:12:36 +0200 |
| commit | 661b8b4aabd1c033fcb33f7c5a2b0ac5820048fe (patch) | |
| tree | 8fbb84188328ddcc15b17d5b7fef6167f1cb8014 /xmake/rules/c++/modules/modules_support | |
| parent | 008d6a92e171d9ef1d8a62fca1e4900ed5faa48f (diff) | |
add a proper warning when falling back to fallback module scanner for gcc and clang
Diffstat (limited to 'xmake/rules/c++/modules/modules_support')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua | 6 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua | 6 |
2 files changed, 10 insertions, 2 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 009bf519a..4bc15dbde 100644 --- a/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/clang/dependency_scanner.lua @@ -38,7 +38,8 @@ function generate_dependency_for(target, sourcefile, opt) local outputdir = compiler_support.get_outputdir(target, sourcefile) local jsonfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".json")) - if compiler_support.has_clangscandepssupport(target) and not target:policy("build.c++.clang.fallbackscanner") then + local has_clangscandepssupport = compiler_support.has_clangscandepssupport(target) + if has_clangscandepssupport and not target:policy("build.c++.clang.fallbackscanner") then -- We need absolute path of clang to use clang-scan-deps -- See https://clang.llvm.org/docs/StandardCPlusPlusModules.html#possible-issues-failed-to-find-system-headers local clang_path = compinst:program() @@ -57,6 +58,9 @@ function generate_dependency_for(target, sourcefile, opt) io.writefile(jsonfile, outdata) else + if not has_clangscandepssupport then + wprint("No clang-scan-deps found ! using fallback scanner") + end fallback_generate_dependencies(target, jsonfile, sourcefile, function(file) local keepsystemincludesflag = compiler_support.get_keepsystemincludesflag(target) local compflags = compinst:compflags({sourcefile = file, target = target}) 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 8cdb0a0a3..38d7c6069 100644 --- a/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/gcc/dependency_scanner.lua @@ -44,7 +44,8 @@ function generate_dependency_for(target, sourcefile, opt) local outputdir = compiler_support.get_outputdir(target, sourcefile) local jsonfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".json")) - if depsformatflag and depsfileflag and depstargetflag and not target:policy("build.c++.gcc.fallbackscanner") then + local has_depsflags = depsformatflag and depsfileflag and depstargetflag + 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}) @@ -53,6 +54,9 @@ function generate_dependency_for(target, sourcefile, opt) os.rm(ifile) os.rm(dfile) else + if not has_depsflags then + 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}) -- 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 |
