diff options
| author | Arthur LAURENT <[email protected]> | 2025-05-11 16:27:56 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2025-05-11 16:27:56 +0200 |
| commit | 35d6036d26bc982be7f03e179919d96110236e50 (patch) | |
| tree | 9b3c66ef11114602f647b5f09e338d504ab71aac | |
| parent | 2c161e887cb5aeb6e2e3d4d0871a7380403e5e09 (diff) | |
(C++ modules support) implement fallback for gcc libstdc++.modules.json search
| -rw-r--r-- | xmake/rules/c++/modules/gcc/support.lua | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/gcc/support.lua b/xmake/rules/c++/modules/gcc/support.lua index e6f8591a0..75bb91030 100644 --- a/xmake/rules/c++/modules/gcc/support.lua +++ b/xmake/rules/c++/modules/gcc/support.lua @@ -146,10 +146,24 @@ function _get_std_module_manifest_path(target) return modules_json_path end end - -- fallback on custom detection - -- manifest can be found alongside libstdc++.so - - -- TODO + local ext = ".so" + if target:is_plat("windows") or target:is_plat("mingw") then + ext = ".dll" + elseif target:is_plat("macos") or target:is_plat("ios") or target:is_plat("tvos") then + ext = ".dylib" + end + local stdcpp_libfile, _ = try { + function() + return os.iorunv(compinst:program(), {"-print-file-name=libstdc++" .. ext}, {envs = compinst:runenvs()}) + end + } + if stdcpp_libfile then + modules_json_path = path.join(path.directory(stdcpp_libfile), "libstdc++.modules.json") + modules_json_path = modules_json_path:trim() + if os.isfile(modules_json_path) then + return modules_json_path + end + end end function get_stdmodules(target) |
