diff options
| author | ruki <[email protected]> | 2021-07-21 00:00:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-07-21 00:00:02 +0800 |
| commit | b49d1cc0b6a5d39dc9dde7095da8e6f6d7b44b54 (patch) | |
| tree | fe9d21afdf45463c50c51c9ecb51e2f322a6aef7 | |
| parent | 801cc4d75f3aee6f845f69e9be7c55d70614071c (diff) | |
check allowed archs
| -rw-r--r-- | xmake/actions/config/main.lua | 12 | ||||
| -rw-r--r-- | xmake/core/project/project.lua | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index d96f32a9e..4e6e7fce0 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -221,12 +221,20 @@ function _check_configs() end -- check allowed archs + local plat = config.plat() local arch = config.arch() local allowedarchs = table.wrap(project.get("allowedarchs")) if #allowedarchs > 0 then - local allowedarchs_set = hashset.from(allowedarchs) + local allowedarchs_current = {} + for _, allowedarch in ipairs(allowedarchs) do + local p = project.extraconf("allowedarchs", allowedarch, "plat") + if p == plat then + table.insert(allowedarchs_current, allowedarch) + end + end + local allowedarchs_set = hashset.from(allowedarchs_current) if not allowedarchs_set:has(arch) then - local allowedarchs_str = table.concat(allowedarchs, ", ") + local allowedarchs_str = table.concat(allowedarchs_current, ", ") raise("`%s` is not a valid complation arch for this project, please use one of %s", arch, allowedarchs_str) end end diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 5bda50f05..ea66f2bb6 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -657,6 +657,8 @@ function project.apis() , "add_requires" , "add_requireconfs" , "add_repositories" + , "add_allowedmodes" + , "add_allowedarchs" } , paths = { |
