summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-07-21 22:41:44 +0800
committerruki <[email protected]>2021-07-21 22:41:44 +0800
commit111e917c3317543125fb18aac9101c7c78ab1176 (patch)
tree362df2f295738b6b0af029fafb9a6ff5cc797d0b
parent3557aa0c7934ee6a42defc9649e94d27d7c39b28 (diff)
use default arch
-rw-r--r--xmake/actions/config/main.lua3
-rw-r--r--xmake/core/project/project.lua3
-rw-r--r--xmake/modules/private/detect/find_platform.lua4
3 files changed, 7 insertions, 3 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 6749cd14d..9e67eec57 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -218,9 +218,8 @@ function _check_configs()
end
-- check allowed archs
- local plat = config.plat()
local arch = config.arch()
- local allowed_archs = project.allowed_archs()
+ local allowed_archs = project.allowed_archs(config.plat())
if allowed_archs then
if not allowed_archs:has(arch) then
local allowed_archs_str = table.concat(allowed_archs:to_array(), ", ")
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 7cc5dd0bc..9d2e5a636 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -1248,7 +1248,8 @@ end
-- get allowed archs
--
-- add_allowedarchs("arm64", "x86_64", {plat = "macosx"})
--- add_allowedarchs("i386", {plat = "linux"})
+-- add_allowedarchs("i386", {plat = "linux", default = true})
+-- add_allowedarchs("arm64", "x86_64", {plat = "linux"})
--
function project.allowed_archs(plat)
local allowed_archs_set = project._ALLOWED_ARCHS
diff --git a/xmake/modules/private/detect/find_platform.lua b/xmake/modules/private/detect/find_platform.lua
index 317d11ce9..ebbee55b6 100644
--- a/xmake/modules/private/detect/find_platform.lua
+++ b/xmake/modules/private/detect/find_platform.lua
@@ -83,6 +83,10 @@ function _find_arch(plat, arch)
arch = arch or config.get("arch")
if not arch then
if not arch then
+ local _, default_arch = project.allowed_archs(plat)
+ arch = default_arch
+ end
+ if not arch then
if plat == "android" then
arch = "armeabi-v7a"
elseif plat == "iphoneos" or plat == "appletvos" then