From 111e917c3317543125fb18aac9101c7c78ab1176 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 21 Jul 2021 22:41:44 +0800 Subject: use default arch --- xmake/actions/config/main.lua | 3 +-- xmake/core/project/project.lua | 3 ++- xmake/modules/private/detect/find_platform.lua | 4 ++++ 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 @@ -82,6 +82,10 @@ end 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" -- cgit v1.3.1