summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-18 19:11:27 +0800
committerruki <[email protected]>2020-04-18 19:11:27 +0800
commitedf228fe9a4f1dd748e564562475b73078c42f89 (patch)
tree1f9154f3bc1fbe9cd41b0c3868685cad696d8f97
parent86f5f4aed4bdb1e895d880e024e681915d2bb66b (diff)
uses c++_static instead of llvmstl_xxx
-rw-r--r--xmake/modules/detect/sdks/find_ndk.lua3
-rw-r--r--xmake/platforms/android/load.lua13
-rw-r--r--xmake/platforms/android/xmake.lua6
3 files changed, 12 insertions, 10 deletions
diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua
index ae60c4dc1..df7616fc2 100644
--- a/xmake/modules/detect/sdks/find_ndk.lua
+++ b/xmake/modules/detect/sdks/find_ndk.lua
@@ -49,7 +49,8 @@ function _find_ndk_sdkver(sdkdir, bindir, arch)
local use_llvm = false
local ndk_cxxstl = config.get("ndk_cxxstl")
if ndk_cxxstl then
- if ndk_cxxstl:startswith("llvmstl") then
+ -- we uses c++_static/c++_shared instead of llvmstl_static/llvmstl_shared
+ if ndk_cxxstl:startswith("c++") or ndk_cxxstl:startswith("llvmstl") then
use_llvm = true
end
elseif bindir and bindir:find("llvm", 1, true) then
diff --git a/xmake/platforms/android/load.lua b/xmake/platforms/android/load.lua
index 5e6077746..b0ed21ba3 100644
--- a/xmake/platforms/android/load.lua
+++ b/xmake/platforms/android/load.lua
@@ -188,7 +188,8 @@ function main(platform)
local cxxstl_sdkdir = nil
local ndk_cxxstl = config.get("ndk_cxxstl")
if ndk_cxxstl then
- if ndk_cxxstl:startswith("llvmstl") then
+ -- we uses c++_static/c++_shared instead of llvmstl_static/llvmstl_shared
+ if ndk_cxxstl:startswith("c++") or ndk_cxxstl:startswith("llvmstl") then
cxxstl_sdkdir = cxxstl_sdkdir_llvmstl
elseif ndk_cxxstl:startswith("gnustl") then
cxxstl_sdkdir = cxxstl_sdkdir_gnustl
@@ -197,7 +198,7 @@ function main(platform)
end
else
if isllvm then
- ndk_cxxstl = "llvmstl_static"
+ ndk_cxxstl = "c++_static"
cxxstl_sdkdir = cxxstl_sdkdir_llvmstl
end
if (cxxstl_sdkdir == nil or not os.isdir(cxxstl_sdkdir)) and cxxstl_sdkdir_gnustl then -- <= ndk r16
@@ -230,7 +231,7 @@ function main(platform)
platform:add("ldflags", format("-L%s/libs/%s", cxxstl_sdkdir, toolchains_arch))
platform:add("shflags", format("-L%s/libs/%s", cxxstl_sdkdir, toolchains_arch))
end
- if ndk_cxxstl:startswith("llvmstl") then
+ if ndk_cxxstl:startswith("c++") or ndk_cxxstl:startswith("llvmstl") then
platform:add("cxxflags", format("-I%s/include", cxxstl_sdkdir))
if toolchains_arch then
platform:add("cxxflags", format("-I%s/libs/%s/include", cxxstl_sdkdir, toolchains_arch))
@@ -253,14 +254,14 @@ function main(platform)
end
-- add c++ stl links
- if ndk_cxxstl == "llvmstl_static" then
+ if ndk_cxxstl == "c++_static" or ndk_cxxstl == "llvmstl_static" then
platform:add("ldflags", "-lc++_static", "-lc++abi")
platform:add("shflags", "-lc++_static", "-lc++abi")
if arm32 then
platform:add("ldflags", "-lunwind", "-latomic")
platform:add("shflags", "-lunwind", "-latomic")
end
- elseif ndk_cxxstl == "llvmstl_shared" then
+ elseif ndk_cxxstl == "c++_shared" or ndk_cxxstl == "llvmstl_shared" then
platform:add("ldflags", "-lc++_shared", "-lc++abi")
platform:add("shflags", "-lc++_shared", "-lc++abi")
if arm32 then
@@ -283,7 +284,7 @@ function main(platform)
-- fix 'ld: error: cannot find -lc++' for clang++.exe on r20/windows
-- @see https://github.com/xmake-io/xmake/issues/684
- if ndkver and ndkver >= 20 and ndk_cxxstl:startswith("llvmstl") then
+ if ndkver and ndkver >= 20 and (ndk_cxxstl:startswith("c++") or ndk_cxxstl:startswith("llvmstl")) then
platform:add("ldflags", "-nostdlib++")
platform:add("shflags", "-nostdlib++")
end
diff --git a/xmake/platforms/android/xmake.lua b/xmake/platforms/android/xmake.lua
index f591cc062..45a4eaf8d 100644
--- a/xmake/platforms/android/xmake.lua
+++ b/xmake/platforms/android/xmake.lua
@@ -56,10 +56,10 @@ platform("android")
, {nil, "build_toolver", "kv", nil, "The Build Tool Version of Android SDK" }
, {nil, "ndk_stdcxx", "kv", true, "Use stdc++ library for NDK" }
, {nil, "ndk_cxxstl", "kv", nil, "The stdc++ stl library for NDK",
- " - gnustl_shared",
+ " - c++_static",
+ " - c++_shared",
" - gnustl_static",
- " - llvmstl_shared",
- " - llvmstl_static",
+ " - gnustl_shared",
" - stlport_shared",
" - stlport_static" }
}