[*] Switch over to platform/arch model (vs. config/arch)

This commit is contained in:
Reece Wilson 2022-03-18 11:29:00 +00:00
parent fb50a901d0
commit 69830e2784
3 changed files with 86 additions and 56 deletions

View File

@ -114,14 +114,27 @@ local projPlatform = _OPTIONS["project_platform"]
local projCfg = _OPTIONS["project_config"] local projCfg = _OPTIONS["project_config"]
local projArch = _OPTIONS["project_arch"] local projArch = _OPTIONS["project_arch"]
if (string.ends(projPlatform, projArch)) then
projPlatform = projPlatform:sub(1, - #projArch - 1)
end
if (string.find(projCfg, "|")) then if (string.find(projCfg, "|")) then
projCfg = projCfg:match("([^,]+)|([^,]+)") projCfg = projCfg:match("([^,]+)|([^,]+)")
end end
local targetName = string.format("%s.%s.%s.%s", projName, projCfg, projPlatform, projArch) auRequire("Core/Target").defineOutputNames(projPlatform)
local fileName = targetName
local platform = Aurora.Platforms[projPlatform] local platform = Aurora.Platforms[projPlatform]
local platformStyle = projPlatform
if (platform) then
if (platform.outputName) then
platformStyle = platform.outputName
end
end
local targetName = string.format("%s.%s.%s.%s", projName, projCfg, platformStyle, projArch)
local fileName = targetName
if (platform) then if (platform) then
fileName = fileName .. (platform.exts or {})[projType] or "" fileName = fileName .. (platform.exts or {})[projType] or ""
end end

View File

@ -23,65 +23,75 @@ local function addTarget(prefix, available, flags)
end) end)
end end
local function defineOutputNames(platformName)
local name = nil
local alt = Aurora.Platforms[platformName].stylizedName
if (alt) then
name = alt
else
name = platformName:gsub("^%l", string.upper)
end
Aurora.Platforms[platformName].outputName = name
end
local function start() local function start()
addTarget("target", Aurora.Platforms, _auCurrentPlatforms) addTarget("target", Aurora.Platforms, _auCurrentPlatforms)
addTarget("target", Aurora.Architectures, _auCurrentArchs) addTarget("target", Aurora.Architectures, _auCurrentArchs)
addTarget("flag", Aurora.Flags, _auCurrentFlags) addTarget("flag", Aurora.Flags, _auCurrentFlags)
auForEach(_auCurrentPlatforms, function(platformName) auForEach(_auCurrentPlatforms, defineOutputNames)
local name = nil
local alt = Aurora.Platforms[platformName].stylizedName
if (alt) then
name = alt
else
name = platformName:gsub("^%l", string.upper)
end
Aurora.Platforms[platformName].outputName = name
end)
_auExtendedArch = #_auCurrentArchs > 1 _auExtendedArch = #_auCurrentArchs > 1
end end
local function startProject() local function startProject()
auFilterForConfigPlatforms(function(config, platform) auFilterForPlatforms(function(platform)
if (not _auExtendedArch) then defines(Aurora.Platforms[platform].defines)
local architecture = _auCurrentArchs[1]
auFilter {}
auFilter ("configurations:" .. config)
_G.architecture(Aurora.Architectures[architecture].architecture)
defines(Aurora.Platforms[platform].defines)
else
auFilter {}
auForEach(_auCurrentArchs, function(architecture)
auFilter ("configurations:" .. config .. architecture)
_G.architecture(Aurora.Architectures[architecture].architecture)
defines(Aurora.Platforms[platform].defines)
auFilter {}
end)
auFilter ("platforms:none")
end
end) end)
end end
local function startSolution() local function startSolution()
local configs = {} local platforms = {}
if (not _auExtendedArch) then if (not _auExtendedArch) then
auForEach(Aurora.Settings.aNamesOfConfigs, function(config) auForEach(_auCurrentPlatforms, function(platform)
table.insert(configs, config) table.insert(platforms, platform)
end) end)
else else
auForEach(_auCurrentArchs, function(arch) auForEach(_auCurrentArchs, function(arch)
auForEach(Aurora.Settings.aNamesOfConfigs, function(config) auForEach(_auCurrentPlatforms, function(platform)
table.insert(configs, config .. arch) table.insert(platforms, platform .. arch)
end) end)
end) end)
end end
configurations(configs) configurations(Aurora.Settings.aNamesOfConfigs)
platforms(_auCurrentPlatforms) _G.platforms(platforms)
if (not _auExtendedArch) then
auForEach(_auCurrentPlatforms, function(platform)
auFilter({"platforms:"..platform})
system(Aurora.Platforms[platform].system)
architecture(Aurora.Architectures[arch].architecture)
auFilter{}
end)
else
auForEach(_auCurrentArchs, function(arch)
auForEach(_auCurrentPlatforms, function(platform)
auFilter({"platforms:"..platform .. arch})
system(Aurora.Platforms[platform].system)
architecture(Aurora.Architectures[arch].architecture)
auFilter{}
end)
end)
end
end end
local function auFilterForArchs(callback, ...) local function auFilterForArchs(callback, ...)
@ -109,7 +119,7 @@ local function auFilterForConfigPlatforms(callback, ...)
auForEach(_auCurrentArchs, function(arch, ...) auForEach(_auCurrentArchs, function(arch, ...)
auForEach(Aurora.Settings.aNamesOfConfigs, function(config, ...) auForEach(Aurora.Settings.aNamesOfConfigs, function(config, ...)
auFilter(auFilterOf({platforms = platform, configs = config})) auFilter(auFilterOf({platforms = platform, configs = config, archs = arch}))
callback(config, platform, arch) callback(config, platform, arch)
auFilter {} auFilter {}
@ -160,14 +170,8 @@ local function auFilterOf(configFilter, ...)
if (not test(config, configFilter.configs, configFilter.notConfigs)) then if (not test(config, configFilter.configs, configFilter.notConfigs)) then
return return
end end
if (not _auExtendedArch) then table.insert(validConfigs, config)
table.insert(validConfigs, config)
else
auForEach(_auCurrentArchs, function(arch)
table.insert(validConfigs, config .. arch)
end)
end
end) end)
auForEach(_auCurrentArchs, function(arch) auForEach(_auCurrentArchs, function(arch)
@ -182,8 +186,14 @@ local function auFilterOf(configFilter, ...)
if (not test(platform, configFilter.platforms, configFilter.notPlatforms)) then if (not test(platform, configFilter.platforms, configFilter.notPlatforms)) then
return return
end end
table.insert(validPlatforms, platform) if (not _auExtendedArch) then
table.insert(validPlatforms, platform)
else
auForEach(_auCurrentArchs, function(arch)
table.insert(validPlatforms, platform .. arch)
end)
end
end) end)
auForEach(configFilter.options, function(option) auForEach(configFilter.options, function(option)
@ -251,5 +261,6 @@ return {
auFilterForConfigs = auFilterForConfigs, auFilterForConfigs = auFilterForConfigs,
auFilterForConfigPlatforms = auFilterForConfigPlatforms, auFilterForConfigPlatforms = auFilterForConfigPlatforms,
auFilterOf = auFilterOf, auFilterOf = auFilterOf,
auFilterForArchs = auFilterForArchs auFilterForArchs = auFilterForArchs,
defineOutputNames = defineOutputNames
} }

View File

@ -6,7 +6,8 @@ local platforms = {
SharedLib = ".dll", SharedLib = ".dll",
WindowedApp = ".exe", WindowedApp = ".exe",
ConsoleApp = ".exe" ConsoleApp = ".exe"
} },
system = "windows"
}, },
freebsd = { freebsd = {
targetLocal = true, targetLocal = true,
@ -19,7 +20,8 @@ local platforms = {
exts = { exts = {
SharedLib = ".so", SharedLib = ".so",
StaticLib = ".a" StaticLib = ".a"
} },
system = "bsd"
}, },
linux = { linux = {
defines = "_LINUX_AURORA_PREPROCESSOR", defines = "_LINUX_AURORA_PREPROCESSOR",
@ -32,7 +34,8 @@ local platforms = {
exts = { exts = {
SharedLib = ".so", SharedLib = ".so",
StaticLib = ".a" StaticLib = ".a"
} },
system = "linux"
}, },
mac = { mac = {
defines = "_APPLE_AURORA_PREPROCESSOR", defines = "_APPLE_AURORA_PREPROCESSOR",
@ -41,12 +44,14 @@ local platforms = {
exts = { exts = {
SharedLib = ".dynlib", SharedLib = ".dynlib",
StaticLib = ".a" StaticLib = ".a"
} },
system = "macosx"
}, },
ios = { ios = {
devChainCoreUtils = true, devChainCoreUtils = true,
stylizedName = "iOS", stylizedName = "iOS",
defines = "_APPLE_MOBILE_AURORA_PREPROCESSOR" defines = "_APPLE_MOBILE_AURORA_PREPROCESSOR",
system = "ios"
}, },
android = { android = {
defines = "_ANDROID_AURORA_PREPROCESSOR", defines = "_ANDROID_AURORA_PREPROCESSOR",
@ -54,7 +59,8 @@ local platforms = {
exts = { exts = {
SharedLib = ".so", SharedLib = ".so",
StaticLib = ".a" StaticLib = ".a"
} },
system = "android"
} }
} }