Skip to content

Commit

Permalink
check allowed archs
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jul 20, 2021
1 parent 801cc4d commit b49d1cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions xmake/actions/config/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions xmake/core/project/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ function project.apis()
, "add_requires"
, "add_requireconfs"
, "add_repositories"
, "add_allowedmodes"
, "add_allowedarchs"
}
, paths =
{
Expand Down

0 comments on commit b49d1cc

Please sign in to comment.