[*] Updated guess-platform-code to use filters instead of the legacy options.lua mechanism

This commit is contained in:
Reece Wilson 2021-11-16 11:28:53 +00:00
parent 76405a5b58
commit 613bff8771
2 changed files with 30 additions and 47 deletions

View File

@ -140,7 +140,7 @@ local function auFilterOf(configFilter, ...)
return
end
if (not test(platform, configFilter.platforms, configFilter.notPlatform)) then
if (not test(platform, configFilter.platforms, configFilter.notPlatforms)) then
return
end

View File

@ -1,5 +1,5 @@
local feature = function()
local excludeFiles = function(name, noFiles)
if (not noFiles) then
excludes("**/*" .. name .. ".masm")
@ -8,76 +8,59 @@ local feature = function()
excludes("**/" .. name .. "/**")
end
if (not _G["win32"]) then
if (not _G["x86_64"]) then
excludeFiles "win64"
end
excludeFiles "win32"
end
filter(auFilterOf({notPlatforms = {"win32"}, notArchs = {"win64"}}))
excludeFiles "win64"
if (not _G["win32"]) then
filter(auFilterOf({notPlatforms = {"win32"}}))
excludeFiles "windows"
end
excludeFiles "win32"
if (not _G["xbox"]) then
filter(auFilterOf({notPlatforms = {"xbox"}}))
excludeFiles "xbox"
end
if (not _G["uwp"]) then
excludeFiles "uwp"
end
--if (not _G["uwp"]) then
excludeFiles "uwp"
if (not _G["win32"] and not _G["xbox"]) then
filter(auFilterOf({notPlatforms = {"win32", "xbox"}}))
excludeFiles "nt"
end
if (not _G["android"]) then
filter(auFilterOf({notPlatforms = {"android"}}))
excludeFiles "android"
end
if (_G["mac"]) then
excludeFiles "macos"
end
local isNotApple = {"mac",
"ios"}
local isNotApple = not _G["mac"]
and not _G["ios"]
local isNotBsd = not _G["bsd"]
and not _G["ps4"]
and not _G["ps5"]
and isNotApple
local isNotBsd = auConcatArrays({"bsd",
"ps4",
"ps5"}, isNotApple)
if (not isNotBsd) then
filter(auFilterOf({notPlatforms = isNotBsd}))
excludeFiles "bsd"
end
if (isNotApple) then
filter(auFilterOf({notPlatforms = isNotApple}))
excludeFiles "apple"
excludeFiles "xnu"
end
if (not _G["mac"]) then
filter(auFilterOf({notPlatforms = {"mac"}}))
excludeFiles "osx"
end
excludeFiles "macos"
local isNotLinux = not _G["linux"]
and not _G["android"]
local isNotLinux = {"linux",
"android"}
if (isNotBsd and isNotLinux) then
filter(auFilterOf({notPlatforms = auConcatArrays(isNotBsd, isNotLinux)}))
excludeFiles "unix"
end
if (isNotLinux) then
filter(auFilterOf({notPlatforms = {"linux", "android"}}))
excludeFiles "linux"
end
if (not _G["x86_64"]) then
filter(auFilterOf({notArchs = "x86_64"}))
excludeFiles "x64"
excludeFiles "x86_64"
excludeFiles "amd64"
end
if (not _G["x86_32"]) then
filter(auFilterOf({notArchs = "x86_32"}))
excludes "**/x86/**"
excludes "**/x86/**.c"
excludes "**/x86/**.h"
@ -88,13 +71,13 @@ local feature = function()
excludes "**/*.x86.*pp"
excludeFiles "x86_32"
excludeFiles "intel"
end
if (not _G["arm"]) then
filter(auFilterOf({notArchs = "arm"}))
excludeFiles ("arm", true)
excludeFiles "aarch64"
excludeFiles "aarch"
end
filter{}
excludeFiles "mips"
excludeFiles "mips64"