summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-10-28 20:38:40 +0800
committerruki <[email protected]>2019-10-28 20:38:40 +0800
commite51e92ebd5c96f88223556912c56bebf594d2432 (patch)
tree13a1ab5b69fe004e5cc9d486c658776e701dfc08
parentdbf355ebf4f492503ce19feb7d5637bbe3f2c0d7 (diff)
improve to detect android ndk version
-rw-r--r--xmake/modules/detect/sdks/find_ndk.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua
index 4fc94de21..b63c68634 100644
--- a/xmake/modules/detect/sdks/find_ndk.lua
+++ b/xmake/modules/detect/sdks/find_ndk.lua
@@ -43,11 +43,22 @@ function _find_ndkdir(sdkdir)
end
-- find the sdk version of ndk
-function _find_ndk_sdkver(sdkdir, arch)
+function _find_ndk_sdkver(sdkdir, bindir, arch)
+
+ -- uses llvm stl?
+ local use_llvm = false
+ local ndk_cxxstl = config.get("ndk_cxxstl")
+ if ndk_cxxstl then
+ if ndk_cxxstl:startswith("llvmstl") then
+ use_llvm = true
+ end
+ elseif bindir and bindir:find("llvm", 1, true) then
+ use_llvm = true
+ end
-- try to select the best compatible version
local sdkver = "16"
- if arch == "arm64-v8a" then
+ if use_llvm or arch == "arm64-v8a" then
sdkver = "21"
end
if os.isdir(path.join(sdkdir, "platforms", "android-" .. sdkver)) then
@@ -125,7 +136,7 @@ function _find_ndk(sdkdir, arch, ndk_sdkver, ndk_toolchains_ver)
end
-- find the sdk version
- local sdkver = ndk_sdkver or _find_ndk_sdkver(sdkdir, arch)
+ local sdkver = ndk_sdkver or _find_ndk_sdkver(sdkdir, bindir, arch)
if not sdkver then
return {}
end