summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/toolchain.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-18 22:56:48 +0800
committerruki <[email protected]>2025-12-18 22:56:48 +0800
commitb1e1b3e8017e37d0db6983a8a69be87d3e419002 (patch)
tree606da2e99ca28e555acf51406b95cf0bb2f12571 /xmake/modules/private/utils/toolchain.lua
parent0b8c8bf80392e56710ef760b2604fd29a185556c (diff)
add llvm rtlib
Diffstat (limited to 'xmake/modules/private/utils/toolchain.lua')
-rw-r--r--xmake/modules/private/utils/toolchain.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/modules/private/utils/toolchain.lua b/xmake/modules/private/utils/toolchain.lua
index f742cf295..d687adf09 100644
--- a/xmake/modules/private/utils/toolchain.lua
+++ b/xmake/modules/private/utils/toolchain.lua
@@ -281,7 +281,7 @@ function get_llvm_dirs(toolchain)
rootdir = _get_llvm_rootdir(toolchain)
end
- local bindir, libdir, cxxlibdir, includedir, cxxincludedir, resdir, rtdir, rtlink
+ local bindir, libdir, cxxlibdir, includedir, cxxincludedir, resdir, rtdir, rtlink, rtlib
if rootdir then
bindir = path.join(rootdir, "bin")
bindir = os.isdir(bindir) and bindir or nil
@@ -321,7 +321,6 @@ function get_llvm_dirs(toolchain)
rtlib = rtlib,
rtlink = rtlink }
memcache:set(cachekey, llvm_dirs)
- _g.llvm_dirs = llvm_dirs
end
return llvm_dirs
end
@@ -350,3 +349,13 @@ function set_llvm_runenvs(toolchain)
end
end
end
+
+-- add compiler-rt for llvm
+function add_llvm_compiler_rt(toolchain)
+ local dirs = get_llvm_dirs(toolchain)
+ if dirs and dirs.rtlib and dirs.rtlink then
+ local rtlib_path = path.join(dirs.rtlib, path.filename(dirs.rtlink))
+ toolchain:add("ldflags", rtlib_path)
+ toolchain:add("shflags", rtlib_path)
+ end
+end