diff options
| author | ruki <[email protected]> | 2019-09-18 22:34:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-09-18 09:29:37 +0800 |
| commit | ab60d2da29bd4ec8e956b7ea0b17ee7f4e1d59c8 (patch) | |
| tree | f77be8cb92e0e05b28c8e2f2b0421e45799b3c19 /xmake/modules/detect | |
| parent | 860f2ddcfee2546ec9feeb8749fc5e5acd2a5b43 (diff) | |
improve to find ndk_sdkver
Diffstat (limited to 'xmake/modules/detect')
| -rw-r--r-- | xmake/modules/detect/sdks/find_ndk.lua | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua index 7dafc5cf4..512d1f1e3 100644 --- a/xmake/modules/detect/sdks/find_ndk.lua +++ b/xmake/modules/detect/sdks/find_ndk.lua @@ -43,7 +43,16 @@ function _find_ndkdir(sdkdir) end -- find the sdk version of ndk -function _find_ndk_sdkver(sdkdir) +function _find_ndk_sdkver(sdkdir, arch) + + -- try to select the best compatible version + local sdkver = "16" + if arch == "arm64-v8a" then + sdkver = "21" + end + if os.isdir(path.join(sdkdir, "platforms", "android-" .. sdkver)) then + return sdkver + end -- find the max version local sdkver_max = 0 @@ -55,15 +64,15 @@ function _find_ndk_sdkver(sdkdir) if count > 0 then -- get the max version - local sdkver = tonumber(version) - if sdkver > sdkver_max then - sdkver_max = sdkver + local sdkver_now = tonumber(version) + if sdkver_now > sdkver_max then + sdkver_max = sdkver_now end end end -- get the max sdk version - return sdkver_max > 0 and sdkver_max or nil + return sdkver_max > 0 and tostring(sdkver_max) or nil end -- find the toolchains version of ndk @@ -116,7 +125,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) + local sdkver = ndk_sdkver or _find_ndk_sdkver(sdkdir, arch) if not sdkver then return {} end |
