summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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