summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2024-03-24 00:03:19 +0100
committerArthur LAURENT <[email protected]>2024-03-24 00:03:19 +0100
commit808757405eef0ace00c96442174245dbf8512c18 (patch)
tree2b6b7b5f5d3f061dc358d8931f40712a9a0786bd
parenta596970f9b49e71e7f27cc3ed66a137b3705ff0c (diff)
support --sdk= by adding sysroot to std module manifest detection line
-rw-r--r--xmake/rules/c++/modules/modules_support/clang/compiler_support.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua
index faffa1e49..367494f7c 100644
--- a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua
+++ b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua
@@ -81,9 +81,10 @@ end
function _get_std_module_manifest_path(target)
local print_module_manifest_flag = get_print_library_module_manifest_path_flag(target)
+ local clang_path = path.directory(get_clang_path(target))
if print_module_manifest_flag then
local compinst = target:compiler("cxx")
- local outdata, _ = try { function() return os.iorunv(compinst:program(), {"-std=c++23", "-stdlib=libc++", print_module_manifest_flag}, {envs = compinst:runenvs()}) end }
+ local outdata, _ = try { function() return os.iorunv(compinst:program(), {"-std=c++23", "-stdlib=libc++", "--sysroot=" .. path.join(clang_path, ".."), print_module_manifest_flag}, {envs = compinst:runenvs()}) end }
if outdata and not outdata:startswith("<NOT PRESENT>") then
return outdata:trim()
end
@@ -91,7 +92,6 @@ function _get_std_module_manifest_path(target)
-- fallback on custom detection
-- manifest can be found in <llvm_path>/lib subdirectory (i.e on debian it should be <llvm_path>/lib/x86_64-unknown-linux-gnu/)
- local clang_path = path.directory(get_clang_path(target))
local clang_lib_path = path.join(clang_path, "..", "lib")
local modules_json_path = path.join(clang_lib_path, "libc++.modules.json")
if not os.isfile(modules_json_path) then