diff options
| author | ruki <[email protected]> | 2024-07-13 16:29:57 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-07-13 16:29:57 +0800 |
| commit | ded9e3e9b5fde19d546dfb336800c0f993240361 (patch) | |
| tree | eaaa25a796ad63146121ae17fa3bc228cbe2a6da | |
| parent | 73074a7c21280622b49dc34f73fb0412fa8eb04e (diff) | |
| parent | 661b8b4aabd1c033fcb33f7c5a2b0ac5820048fe (diff) | |
Merge pull request #5340 from Arthapz/improve-clang-scan-deps-warning-for-modules
add a proper warning when falling back to fallback module scanner for…
| -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 |
