summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2024-01-26 18:39:14 +0100
committerArthur LAURENT <[email protected]>2024-01-26 18:39:14 +0100
commitb5c99f42cf9f4347bf72a2fd86ea8c3b0b8cc44c (patch)
tree9d265ebd2e54afb566efb7f95d139bc4a3ace613
parent445e43b40846b29b9abb1293b32b27b7104f54fa (diff)
fix missing libc++/libstdc++ runtime support on windows for clang
-rw-r--r--xmake/modules/core/tools/clang.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua
index 313728894..51a1de187 100644
--- a/xmake/modules/core/tools/clang.lua
+++ b/xmake/modules/core/tools/clang.lua
@@ -212,6 +212,14 @@ function nf_runtime(self, runtime, opt)
MD = "-fms-runtime-lib=dll",
MDd = "-fms-runtime-lib=dll_dbg"
}
+ if kind == "cxx" then
+ table.join2(maps, {
+ ["c++_static"] = "-stdlib=libc++",
+ ["c++_shared"] = "-stdlib=libc++",
+ ["stdc++_static"] = "-stdlib=libstdc++",
+ ["stdc++_shared"] = "-stdlib=libstdc++",
+ })
+ end
elseif kind == "ld" or kind == "sh" then
maps = {
MT = "-nostdlib",
@@ -219,6 +227,19 @@ function nf_runtime(self, runtime, opt)
MD = "-nostdlib",
MDd = "-nostdlib"
}
+ local target = opt.target
+ if target and target.sourcekinds and table.contains(table.wrap(target:sourcekinds()), "cxx") then
+ table.join2(maps, {
+ ["c++_static"] = "-stdlib=libc++",
+ ["c++_shared"] = "-stdlib=libc++",
+ ["stdc++_static"] = "-stdlib=libstdc++",
+ ["stdc++_shared"] = "-stdlib=libstdc++",
+ })
+ if runtime:endswith("_static") and _has_static_libstdcxx(self) then
+ maps["c++_static"] = table.join(maps["c++_static"], "-static-libstdc++")
+ maps["stdc++_static"] = table.join(maps["stdc++_static"], "-static-libstdc++")
+ end
+ end
end
return maps and maps[runtime]
elseif not self:is_plat("android") then -- we will set runtimes in android ndk toolchain