summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-27 22:39:53 +0800
committerruki <[email protected]>2020-03-27 09:59:22 +0800
commitbbf30dbc869965a523ba20a0ca65be163fd80d06 (patch)
treed7b290a342daed2b02922e843973e92e2d682438
parenteb477c19a1e5f4cf7cd8320dcca30d1562c285fc (diff)
improve android abi
-rw-r--r--xmake/core/package/package.lua6
-rw-r--r--xmake/core/project/rule.lua6
-rw-r--r--xmake/core/project/target.lua6
-rw-r--r--xmake/modules/detect/sdks/find_ndk.lua14
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua2
-rw-r--r--xmake/modules/package/manager/conan/find_package.lua24
-rw-r--r--xmake/modules/package/manager/conan/install_package.lua24
-rw-r--r--xmake/modules/package/tools/autoconf.lua12
-rw-r--r--xmake/modules/private/action/trybuild/autotools.lua12
-rw-r--r--xmake/platforms/android/config.lua2
-rw-r--r--xmake/platforms/android/load.lua55
-rw-r--r--xmake/platforms/android/xmake.lua10
-rw-r--r--xmake/rules/qt/deploy/android.lua10
13 files changed, 109 insertions, 74 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 7ea3ff717..b69b4f094 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -737,9 +737,9 @@ function _instance:script(name, generic)
-- `@linux|x86_64`
-- `@macosx,linux`
-- `android@macosx,linux`
- -- `android|armv7-a@macosx,linux`
- -- `android|armv7-a@macosx,linux|x86_64`
- -- `android|armv7-a@linux|x86_64`
+ -- `android|armeabi-v7a@macosx,linux`
+ -- `android|armeabi-v7a@macosx,linux|x86_64`
+ -- `android|armeabi-v7a@linux|x86_64`
--
for _pattern, _script in pairs(script) do
local hosts = {}
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua
index 43c8e3db2..7b4a17d75 100644
--- a/xmake/core/project/rule.lua
+++ b/xmake/core/project/rule.lua
@@ -259,9 +259,9 @@ function rule:script(name, generic)
-- `@linux|x86_64`
-- `@macosx,linux`
-- `android@macosx,linux`
- -- `android|armv7-a@macosx,linux`
- -- `android|armv7-a@macosx,linux|x86_64`
- -- `android|armv7-a@linux|x86_64`
+ -- `android|armeabi-v7a@macosx,linux`
+ -- `android|armeabi-v7a@macosx,linux|x86_64`
+ -- `android|armeabi-v7a@linux|x86_64`
--
for _pattern, _script in pairs(script) do
local hosts = {}
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 60b323d54..8f6a5220f 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1426,9 +1426,9 @@ function _instance:script(name, generic)
-- `@linux|x86_64`
-- `@macosx,linux`
-- `android@macosx,linux`
- -- `android|armv7-a@macosx,linux`
- -- `android|armv7-a@macosx,linux|x86_64`
- -- `android|armv7-a@linux|x86_64`
+ -- `android|armeabi-v7a@macosx,linux`
+ -- `android|armeabi-v7a@macosx,linux|x86_64`
+ -- `android|armeabi-v7a@linux|x86_64`
--
for _pattern, _script in pairs(script) do
local hosts = {}
diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua
index 70801d697..f88d54693 100644
--- a/xmake/modules/detect/sdks/find_ndk.lua
+++ b/xmake/modules/detect/sdks/find_ndk.lua
@@ -103,13 +103,15 @@ function _find_ndk(sdkdir, arch, ndk_sdkver, ndk_toolchains_ver)
-- get cross
local crosses =
{
- ["armv5te"] = "arm-linux-androideabi-"
- , ["armv7-a"] = "arm-linux-androideabi-"
+ ["armv5te"] = "arm-linux-androideabi-" -- deprecated
+ , ["armv7-a"] = "arm-linux-androideabi-" -- deprecated
+ , ["armeabi"] = "arm-linux-androideabi-" -- removed in ndk r17
+ , ["armeabi-v7a"] = "arm-linux-androideabi-"
, ["arm64-v8a"] = "aarch64-linux-android-"
, i386 = "i686-linux-android-"
, x86_64 = "x86_64-linux-android-"
- , mips = "mips-linux-android-"
- , mips64 = "mips64-linux-android-"
+ , mips = "mips-linux-android-" -- removed in ndk r17
+ , mips64 = "mips64-linux-android-" -- removed in ndk r17
}
local cross = crosses[arch]
@@ -118,6 +120,8 @@ function _find_ndk(sdkdir, arch, ndk_sdkver, ndk_toolchains_ver)
{
["armv5te"] = "arm-linux-androideabi-*"
, ["armv7-a"] = "arm-linux-androideabi-*"
+ , ["armeabi"] = "arm-linux-androideabi-*"
+ , ["armeabi-v7a"] = "arm-linux-androideabi-*"
, ["arm64-v8a"] = "aarch64-linux-android-*"
, i386 = "x86-*"
, x86_64 = "x86_64-*"
@@ -174,7 +178,7 @@ end
--
-- @param sdkdir the ndk directory
-- @param opt the argument options
--- e.g. {arch = "[armv5te|armv6|armv7-a|armv8-a|arm64-v8a]", verbose = true, force = false, sdkver = 19, toolchains_ver = "4.9"}
+-- e.g. {arch = "[armeabi|armeabi-v7a|arm64-v8a]", verbose = true, force = false, sdkver = 19, toolchains_ver = "4.9"}
--
-- @return the ndk toolchains. e.g. {bindir = .., cross = ..}
--
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index e6c77ebf5..9062a9212 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -49,7 +49,7 @@ function _find_sdkdir(sdkdir, sdkver)
local subdir = "android_*"
if is_arch("arm64-v8a") then
subdir = "android_arm64_v8a"
- elseif is_arch("armv7-a") then
+ elseif is_arch("armeabi-v7a", "armeabi", "armv7-a", "armv5te") then -- armv7-a/armv5te are deprecated
subdir = "android_armv7"
elseif is_arch("i386") then
subdir = "android_x86"
diff --git a/xmake/modules/package/manager/conan/find_package.lua b/xmake/modules/package/manager/conan/find_package.lua
index 233784976..bdfd1715e 100644
--- a/xmake/modules/package/manager/conan/find_package.lua
+++ b/xmake/modules/package/manager/conan/find_package.lua
@@ -35,17 +35,19 @@ end
-- get conan architecture
function _conan_get_arch(opt)
- local archs = {x86_64 = "x86_64",
- x64 = "x86_64",
- i386 = "x86",
- x86 = "x86",
- armv7 = "armv7",
- ["armv7-a"] = "armv7", -- for android
- armv7s = "armv7s", -- for iphoneos
- arm64 = "armv8", -- for iphoneos
- ["arm64-v8a"] = "armv8", -- for android
- mips = "mips",
- mips64 = "mips64"}
+ local archs = {x86_64 = "x86_64",
+ x64 = "x86_64",
+ i386 = "x86",
+ x86 = "x86",
+ armv7 = "armv7",
+ ["armv7-a"] = "armv7", -- for android, deprecated
+ ["armeabi"] = "armv7", -- for android, removed in ndk r17
+ ["armeabi-v7a"] = "armv7", -- for android
+ armv7s = "armv7s", -- for iphoneos
+ arm64 = "armv8", -- for iphoneos
+ ["arm64-v8a"] = "armv8", -- for android
+ mips = "mips",
+ mips64 = "mips64"}
return archs[opt.arch]
end
diff --git a/xmake/modules/package/manager/conan/install_package.lua b/xmake/modules/package/manager/conan/install_package.lua
index 458816220..a74cd8817 100644
--- a/xmake/modules/package/manager/conan/install_package.lua
+++ b/xmake/modules/package/manager/conan/install_package.lua
@@ -177,17 +177,19 @@ function main(name, opt)
end
-- set architecture
- local archs = {x86_64 = "x86_64",
- x64 = "x86_64",
- i386 = "x86",
- x86 = "x86",
- armv7 = "armv7",
- ["armv7-a"] = "armv7", -- for android
- armv7s = "armv7s", -- for iphoneos
- arm64 = "armv8", -- for iphoneos
- ["arm64-v8a"] = "armv8", -- for android
- mips = "mips",
- mips64 = "mips64"}
+ local archs = {x86_64 = "x86_64",
+ x64 = "x86_64",
+ i386 = "x86",
+ x86 = "x86",
+ armv7 = "armv7",
+ ["armv7-a"] = "armv7", -- for android, deprecated
+ ["armeabi"] = "armv7", -- for android, removed in ndk r17
+ ["armeabi-v7a"] = "armv7", -- for android
+ armv7s = "armv7s", -- for iphoneos
+ arm64 = "armv8", -- for iphoneos
+ ["arm64-v8a"] = "armv8", -- for android
+ mips = "mips",
+ mips64 = "mips64"}
table.insert(argv, "-s")
local arch = archs[opt.arch]
if arch then
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 4b83d12ef..c029b3d54 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -45,15 +45,17 @@ function _get_configs(package, configs)
-- @see https://developer.android.com/ndk/guides/other_build_systems#autoconf
local triples =
{
- ["armv5te"] = "arm-linux-androideabi",
- ["armv7-a"] = "arm-linux-androideabi",
+ ["armv5te"] = "arm-linux-androideabi", -- deprecated
+ ["armv7-a"] = "arm-linux-androideabi", -- deprecated
+ ["armeabi"] = "arm-linux-androideabi", -- removed in ndk r17
+ ["armeabi-v7a"] = "arm-linux-androideabi",
["arm64-v8a"] = "aarch64-linux-android",
i386 = "i686-linux-android",
x86_64 = "x86_64-linux-android",
- mips = "mips-linux-android",
- mips64 = "mips64-linux-android"
+ mips = "mips-linux-android", -- removed in ndk r17
+ mips64 = "mips64-linux-android" -- removed in ndk r17
}
- table.insert(configs, "--host=" .. (triples[package:arch()] or triples["armv7-a"]))
+ table.insert(configs, "--host=" .. (triples[package:arch()] or triples["armeabi-v7a"]))
elseif package:is_plat("mingw") then
local triples =
{
diff --git a/xmake/modules/private/action/trybuild/autotools.lua b/xmake/modules/private/action/trybuild/autotools.lua
index 6b0861b62..54f81d18d 100644
--- a/xmake/modules/private/action/trybuild/autotools.lua
+++ b/xmake/modules/private/action/trybuild/autotools.lua
@@ -129,15 +129,17 @@ function _get_configs(artifacts_dir)
-- @see https://developer.android.com/ndk/guides/other_build_systems#autoconf
local triples =
{
- ["armv5te"] = "arm-linux-androideabi",
- ["armv7-a"] = "arm-linux-androideabi",
+ ["armv5te"] = "arm-linux-androideabi", -- deprecated
+ ["armv7-a"] = "arm-linux-androideabi", -- deprecated
+ ["armeabi"] = "arm-linux-androideabi", -- removed in ndk r17
+ ["armeabi-v7a"] = "arm-linux-androideabi",
["arm64-v8a"] = "aarch64-linux-android",
i386 = "i686-linux-android",
x86_64 = "x86_64-linux-android",
- mips = "mips-linux-android",
- mips64 = "mips64-linux-android"
+ mips = "mips-linux-android", -- removed in ndk r17
+ mips64 = "mips64-linux-android" -- removed in ndk r17
}
- table.insert(configs, "--host=" .. (triples[config.arch()] or triples["armv7-a"]))
+ table.insert(configs, "--host=" .. (triples[config.arch()] or triples["armeabi-v7a"]))
elseif is_plat("mingw") then
local triples =
{
diff --git a/xmake/platforms/android/config.lua b/xmake/platforms/android/config.lua
index a51eac6b0..8e1e86639 100644
--- a/xmake/platforms/android/config.lua
+++ b/xmake/platforms/android/config.lua
@@ -134,7 +134,7 @@ function main(platform, name)
else
-- check arch
- check_arch(config, "armv7-a")
+ check_arch(config, "armeabi-v7a")
-- check ndk
_check_ndk()
diff --git a/xmake/platforms/android/load.lua b/xmake/platforms/android/load.lua
index 4b197cf93..e19c62c23 100644
--- a/xmake/platforms/android/load.lua
+++ b/xmake/platforms/android/load.lua
@@ -25,10 +25,12 @@ import("core.project.config")
function main(platform)
-- init flags
+ local arm32 = false
local arch = config.get("arch")
platform:add("ldflags", "-llog")
platform:add("shflags", "-llog")
- if arch and (arch == "armv5te" or arch == "armv7-a") then
+ if arch and (arch == "armeabi" or arch == "armeabi-v7a" or arch == "armv5te" or arch == "armv7-a") then -- armv5te/armv7-a are deprecated
+ arm32 = true
platform:add("cxflags", "-mthumb")
platform:add("asflags", "-mthumb")
platform:add("ldflags", "-mthumb")
@@ -48,12 +50,15 @@ function main(platform)
-- add target
local targets =
{
- ["armv5te"] = "armv5te-none-linux-androideabi"
- , ["armv7-a"] = "armv7-none-linux-androideabi"
+ ["armv5te"] = "armv5te-none-linux-androideabi" -- deprecated
+ , ["armeabi"] = "armv5te-none-linux-androideabi" -- removed in ndk r17
+ , ["armv7-a"] = "armv7-none-linux-androideabi" -- deprecated
+ , ["armeabi-v7a"] = "armv7-none-linux-androideabi"
, ["arm64-v8a"] = "aarch64-none-linux-android"
, ["i386"] = "i686-none-linux-android"
, ["x86_64"] = "x86_64-none-linux-android"
- , ["mips"] = "mipsel-none-linux-android"
+ , ["mips"] = "mipsel-none-linux-android" -- removed in ndk r17
+ , ["mips64"] = "mips64el-none-linux-android" -- removed in ndk r17
}
assert(targets[arch], "unknown arch(%s) for android!", arch)
platform:add("cxflags", "-target " .. targets[arch])
@@ -73,6 +78,8 @@ function main(platform)
local march = arch
if arch == "arm64-v8a" then
march = "armv8-a"
+ else
+ march = "armv5te"
end
-- old version ndk
platform:add("cxflags", "-march=" .. march)
@@ -93,13 +100,15 @@ function main(platform)
-- the sysroot archs
local sysroot_archs =
{
- ["armv5te"] = "arch-arm"
- , ["armv7-a"] = "arch-arm"
+ ["armv5te"] = "arch-arm" -- deprecated
+ , ["armv7-a"] = "arch-arm" -- deprecated
+ , ["armeabi"] = "arch-arm" -- removed in ndk r17
+ , ["armeabi-v7a"] = "arch-arm"
, ["arm64-v8a"] = "arch-arm64"
, i386 = "arch-x86"
, x86_64 = "arch-x86_64"
- , mips = "arch-mips"
- , mips64 = "arch-mips64"
+ , mips = "arch-mips" -- removed in ndk r17
+ , mips64 = "arch-mips64" -- removed in ndk r17
}
local sysroot_arch = sysroot_archs[arch]
@@ -126,13 +135,15 @@ function main(platform)
-- the triples
local triples =
{
- ["armv5te"] = "arm-linux-androideabi"
- , ["armv7-a"] = "arm-linux-androideabi"
+ ["armv5te"] = "arm-linux-androideabi" -- deprecated
+ , ["armv7-a"] = "arm-linux-androideabi" -- deprecated
+ , ["armeabi"] = "arm-linux-androideabi" -- removed in ndk r17
+ , ["armeabi-v7a"] = "arm-linux-androideabi"
, ["arm64-v8a"] = "aarch64-linux-android"
, i386 = "i686-linux-android"
, x86_64 = "x86_64-linux-android"
- , mips = "mips-linux-android"
- , mips64 = "mips64-linux-android"
+ , mips = "mips-linux-android" -- removed in ndk r17
+ , mips64 = "mips64-linux-android" -- removed in ndk r17
}
platform:add("cxflags", "-D__ANDROID_API__=" .. ndk_sdkver)
platform:add("asflags", "-D__ANDROID_API__=" .. ndk_sdkver)
@@ -198,13 +209,15 @@ function main(platform)
-- the toolchains archs
local toolchains_archs =
{
- ["armv5te"] = "armeabi"
- , ["armv7-a"] = "armeabi-v7a"
+ ["armv5te"] = "armeabi" -- deprecated
+ , ["armv7-a"] = "armeabi-v7a" -- deprecated
+ , ["armeabi"] = "armeabi" -- removed in ndk r17
+ , ["armeabi-v7a"] = "armeabi-v7a"
, ["arm64-v8a"] = "arm64-v8a"
, i386 = "x86"
, x86_64 = "x86_64"
- , mips = "mips"
- , mips64 = "mips64"
+ , mips = "mips" -- removed in ndk r17
+ , mips64 = "mips64" -- removed in ndk r17
}
local toolchains_arch = toolchains_archs[arch]
@@ -239,14 +252,14 @@ function main(platform)
if ndk_cxxstl == "llvmstl_static" then
platform:add("ldflags", "-lc++_static", "-lc++abi")
platform:add("shflags", "-lc++_static", "-lc++abi")
- if arch == "armv7-a" or arch == "armv5te" then
+ if arm32 then
platform:add("ldflags", "-lunwind", "-latomic")
platform:add("shflags", "-lunwind", "-latomic")
end
elseif ndk_cxxstl == "llvmstl_shared" then
platform:add("ldflags", "-lc++_shared", "-lc++abi")
platform:add("shflags", "-lc++_shared", "-lc++abi")
- if arch == "armv7-a" or arch == "armv5te" then
+ if arm32 then
platform:add("ldflags", "-lunwind", "-latomic")
platform:add("shflags", "-lunwind", "-latomic")
end
@@ -276,8 +289,10 @@ function main(platform)
-- init targets for rust
local targets_rust =
{
- ["armv5te"] = "arm-linux-androideabi"
- , ["armv7-a"] = "arm-linux-androideabi"
+ ["armv5te"] = "arm-linux-androideabi" -- deprecated
+ , ["armv7-a"] = "arm-linux-androideabi" -- deprecated
+ , ["armeabi"] = "arm-linux-androideabi" -- removed in ndk r17
+ , ["armeabi-v7a"] = "arm-linux-androideabi"
, ["arm64-v8a"] = "aarch64-linux-android"
}
diff --git a/xmake/platforms/android/xmake.lua b/xmake/platforms/android/xmake.lua
index 496c66a7c..8d60b8373 100644
--- a/xmake/platforms/android/xmake.lua
+++ b/xmake/platforms/android/xmake.lua
@@ -27,8 +27,14 @@ platform("android")
-- set hosts
set_hosts("macosx", "linux", "windows")
- -- set archs
- set_archs("armv7-a", "arm64-v8a", "armv5te", "mips", "mips64", "i386", "x86_64")
+ -- set archs, we use the latest android abi provided in android ndk now.
+ -- we will continue to support the old abi architectures for old version ndk.
+ -- e.g. armv5te(armeabi), armv7-a(armeabi-v7a), mips, mips64
+ --
+ -- @see https://developer.android.google.cn/ndk/guides/abis
+ -- @note The NDK previously supported ARMv5 (armeabi) and 32-bit and 64-bit MIPS, but this support has been removed in NDK r17.
+ --
+ set_archs("armeabi", "armeabi-v7a", "arm64-v8a", "i386", "x86_64", "mips", "mip64")
-- set formats
set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).so", symbol = "$(name).sym"}
diff --git a/xmake/rules/qt/deploy/android.lua b/xmake/rules/qt/deploy/android.lua
index 2a8fd9314..9f53ecc84 100644
--- a/xmake/rules/qt/deploy/android.lua
+++ b/xmake/rules/qt/deploy/android.lua
@@ -79,13 +79,15 @@ function main(target, opt)
-- get the target architecture
local target_archs =
{
- ["armv5te"] = "armeabi"
- , ["armv7-a"] = "armeabi-v7a"
+ ["armv5te"] = "armeabi" -- deprecated
+ , ["armv7-a"] = "armeabi-v7a" -- deprecated
+ , ["armeabi"] = "armeabi"
+ , ["armeabi-v7a"] = "armeabi-v7a"
, ["arm64-v8a"] = "arm64-v8a"
, i386 = "x86"
, x86_64 = "x86_64"
- , mips = "mips"
- , mips64 = "mips64"
+ , mips = "mips" -- removed in ndk r71
+ , mips64 = "mips64" -- removed in ndk r71
}
local target_arch = assert(target_archs[config.arch()], "unsupport target arch(%s)!", config.arch())