From 73b739597727ca6e0d4335f4e58b1dc7bf1018db Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Wed, 5 Nov 2025 12:13:10 +0100 Subject: (modules) add all supported platforms for clang get_cpp_library_name --- xmake/rules/c++/modules/support.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua index 0f89d4e98..700426e2c 100644 --- a/xmake/rules/c++/modules/support.lua +++ b/xmake/rules/c++/modules/support.lua @@ -21,6 +21,7 @@ import("core.base.bytes") import("core.base.option") import("core.base.json") import("core.base.hashset") +import("core.tool.toolchain") import("core.cache.memcache", {alias = "_memcache"}) import("core.cache.localcache", {alias = "_localcache"}) import("async.runjobs") @@ -73,15 +74,25 @@ function get_cpplibrary_name(target) -- libc++ come first because on windows, if we use libc++ clang will still use msvc crt so MD / MT / MDd / MTd can be set if target:has_runtime("c++_shared", "c++_static") then return "c++" - elseif target:has_runtime("stdc++_shared", "stdc++_static") then + elseif target:has_runtime("stdc++_shared", "stdc++_static", "gnustl_static", "gnustl_shared") then return "stdc++" + elseif target:has_runtime("stlport_static", "stlport_shared") then + return "stlport" elseif target:has_runtime("MD", "MT", "MDd", "MTd") then return "msstl" end -- if no specified runtime, fallback on native platform C++ library - if target:is_plat("macosx", "iphoneos", "appletvos") then + if target:is_plat("android") then + local ndk = toolchain.load("ndk", { plat = target:plat(), arch = target:arch() }) + local ver = ndk:config("ndkver") + if not ver or ver > 14 then + return "c++" + else + return "stdc++" + end + elseif target:is_plat("macosx", "iphoneos", "watchos", "appletvos", "applexros", "bsd", "harmony") then return "c++" - elseif target:is_plat("linux") or target:is_plat("mingw") then + elseif target:is_plat("linux", "mingw", "cygwin", "msys", "haiku") then return "stdc++" elseif target:is_plat("windows") then return "msstl" -- cgit v1.3.1