diff options
| author | ruki <[email protected]> | 2026-07-20 23:49:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-07-20 23:49:36 +0800 |
| commit | 4fa600df70530a478759aaffb50cc47af235d0d8 (patch) | |
| tree | 07ee24530dfbdf22f484e98495df7d2f2f92df38 /xmake/modules/private/utils/toolchain.lua | |
| parent | 64439096a06b65556fff59f3b0b4e6a439b44129 (diff) | |
fix clang c++_static runtimeclang
Diffstat (limited to 'xmake/modules/private/utils/toolchain.lua')
| -rw-r--r-- | xmake/modules/private/utils/toolchain.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/modules/private/utils/toolchain.lua b/xmake/modules/private/utils/toolchain.lua index c2840a591..3ae8d5e4f 100644 --- a/xmake/modules/private/utils/toolchain.lua +++ b/xmake/modules/private/utils/toolchain.lua @@ -457,6 +457,7 @@ function get_llvm_dirs(toolchain) end local bindir, libdir, cxxlibdir, includedir, cxxincludedir, resourcedir, rtdir, rtlink, rtlibdir + local libcxx_static, libcxxabi_static if rootdir then bindir = path.join(rootdir, "bin") bindir = os.isdir(bindir) and bindir or nil @@ -476,6 +477,19 @@ function get_llvm_dirs(toolchain) end end + -- detect the static c++ runtime archives (for --runtimes=c++_static with libc++) + if libdir then + local staticdirs = cxxlibdir and {cxxlibdir, libdir} or {libdir} + for _, dir in ipairs(staticdirs) do + if not libcxx_static and os.isfile(path.join(dir, "libc++.a")) then + libcxx_static = path.join(dir, "libc++.a") + end + if not libcxxabi_static and os.isfile(path.join(dir, "libc++abi.a")) then + libcxxabi_static = path.join(dir, "libc++abi.a") + end + end + end + includedir = path.join(rootdir, "include") includedir = os.isdir(includedir) and includedir or nil @@ -502,7 +516,9 @@ function get_llvm_dirs(toolchain) resourcedir = resourcedir, rtdir = rtdir, rtlibdir = rtlibdir, - rtlink = rtlink } + rtlink = rtlink, + libcxx_static = libcxx_static, + libcxxabi_static = libcxxabi_static } memcache:set(cachekey, llvm_dirs) end return llvm_dirs |
