summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules
diff options
context:
space:
mode:
authorSnowinterCat <[email protected]>2025-11-28 14:16:56 +0800
committerSnowinterCat <[email protected]>2025-11-28 14:16:56 +0800
commit315ddb090acfb4cac9737ac60efce7d79d8bc261 (patch)
tree094f97d386ebba34581252826163b2cf426749c0 /xmake/rules/c++/modules
parentec0c0d458a14c6a9aff1a01d5e1cf264c8dcfeb2 (diff)
fix_libc++_cannot_find_stdmodule
Diffstat (limited to 'xmake/rules/c++/modules')
-rw-r--r--xmake/rules/c++/modules/clang/support.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/clang/support.lua b/xmake/rules/c++/modules/clang/support.lua
index ad8d008aa..e0d3792b7 100644
--- a/xmake/rules/c++/modules/clang/support.lua
+++ b/xmake/rules/c++/modules/clang/support.lua
@@ -243,6 +243,17 @@ function get_clang_scan_deps(target)
return clang_scan_deps or nil
end
+function parse_link_files(filepath)
+ if not os.islink(filepath) then
+ return filepath
+ end
+ local target = os.readlink(filepath)
+ if path.is_absolute(target) then
+ return target
+ end
+ return path.join(path.directory(filepath), target)
+end
+
function get_stdmodules(target)
local cpplib = get_cpplibrary_name(target)
@@ -255,7 +266,8 @@ function get_stdmodules(target)
if modules_json and modules_json.modules and #modules_json.modules > 0 then
local std_module_directory = path.directory(modules_json.modules[1]["source-path"])
if not path.is_absolute(std_module_directory) then
- std_module_directory = path.join(path.directory(modules_json_path), std_module_directory)
+ local clang_dir = path.directory(parse_link_files(get_clang_path(target)))
+ std_module_directory = path.join(clang_dir, std_module_directory)
end
if os.isdir(std_module_directory) then
return {path.normalize(path.join(std_module_directory, "std.cppm")), path.normalize(path.join(std_module_directory, "std.compat.cppm"))}