summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-20 00:35:46 +0800
committerruki <[email protected]>2025-12-20 00:35:46 +0800
commit3608bf0165ec41d87c93137ae6aaf2eb3c82f86b (patch)
tree7b82147030b0fd2ff2a01ce6160609d656330528 /xmake/modules
parentdee8082d12241d69cf370c7f566c48c0ca8827bd (diff)
fix runtimes for clang/llvm
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/utils/toolchain.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/toolchain.lua b/xmake/modules/private/utils/toolchain.lua
index 49af8193f..2d6e63b15 100644
--- a/xmake/modules/private/utils/toolchain.lua
+++ b/xmake/modules/private/utils/toolchain.lua
@@ -91,6 +91,20 @@ function check_vstudio(toolchain, check)
return vs
end
+-- set llvm runtimes
+function set_llvm_runtimes(toolchain)
+ -- We should set them up uniformly here, because runtimes will be accessed early (in sanitizer),
+ -- which automatically triggers lazy loading of the toolchain.
+ -- However, if some runtime configurations are set in advance in the descriptor scope,
+ -- lazy loading will not be triggered when the runtimes are accessed, and some Windows runtimes may be lost.
+ --
+ -- @see https://github.com/xmake-io/xmake/pull/7146#issuecomment-3674402132
+ toolchain:set("runtimes", "c++_static", "c++_shared", "stdc++_static", "stdc++_shared")
+ if toolchain:is_plat("windows") then
+ toolchain:add("runtimes", "MT", "MTd", "MD", "MDd")
+ end
+end
+
-- check vc build tools sdk
function check_vc_build_tools(toolchain, sdkdir, check)
local opt = {}