[*] 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 projArch = _OPTIONS["project_arch"]
if (string.ends(projPlatform, projArch)) then
projPlatform = projPlatform:sub(1, - #projArch - 1)
end
if (string.find(projCfg, "|")) then
projCfg = projCfg:match("([^,]+)|([^,]+)")
end
local targetName = string.format("%s.%s.%s.%s", projName, projCfg, projPlatform, projArch)
local fileName = targetName
auRequire("Core/Target").defineOutputNames(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
fileName = fileName .. (platform.exts or {})[projType] or ""
end

View File

@ -23,65 +23,75 @@ local function addTarget(prefix, available, flags)
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()
addTarget("target", Aurora.Platforms, _auCurrentPlatforms)
addTarget("target", Aurora.Architectures, _auCurrentArchs)
addTarget("flag", Aurora.Flags, _auCurrentFlags)
auForEach(_auCurrentPlatforms, function(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)
auForEach(_auCurrentPlatforms, defineOutputNames)
_auExtendedArch = #_auCurrentArchs > 1
end
local function startProject()
auFilterForConfigPlatforms(function(config, platform)
if (not _auExtendedArch) then
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
auFilterForPlatforms(function(platform)
defines(Aurora.Platforms[platform].defines)
end)
end
local function startSolution()
local configs = {}
local platforms = {}
if (not _auExtendedArch) then
auForEach(Aurora.Settings.aNamesOfConfigs, function(config)
table.insert(configs, config)
auForEach(_auCurrentPlatforms, function(platform)
table.insert(platforms, platform)
end)
else
auForEach(_auCurrentArchs, function(arch)
auForEach(Aurora.Settings.aNamesOfConfigs, function(config)
table.insert(configs, config .. arch)
auForEach(_auCurrentPlatforms, function(platform)
table.insert(platforms, platform .. arch)
end)
end)
end
configurations(configs)
platforms(_auCurrentPlatforms)
configurations(Aurora.Settings.aNamesOfConfigs)
_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
local function auFilterForArchs(callback, ...)
@ -109,7 +119,7 @@ local function auFilterForConfigPlatforms(callback, ...)
auForEach(_auCurrentArchs, function(arch, ...)
auForEach(Aurora.Settings.aNamesOfConfigs, function(config, ...)
auFilter(auFilterOf({platforms = platform, configs = config}))
auFilter(auFilterOf({platforms = platform, configs = config, archs = arch}))
callback(config, platform, arch)
auFilter {}
@ -160,14 +170,8 @@ local function auFilterOf(configFilter, ...)
if (not test(config, configFilter.configs, configFilter.notConfigs)) then
return
end
if (not _auExtendedArch) then
table.insert(validConfigs, config)
else
auForEach(_auCurrentArchs, function(arch)
table.insert(validConfigs, config .. arch)
end)
end
table.insert(validConfigs, config)
end)
auForEach(_auCurrentArchs, function(arch)
@ -182,8 +186,14 @@ local function auFilterOf(configFilter, ...)
if (not test(platform, configFilter.platforms, configFilter.notPlatforms)) then
return
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)
auForEach(configFilter.options, function(option)
@ -251,5 +261,6 @@ return {
auFilterForConfigs = auFilterForConfigs,
auFilterForConfigPlatforms = auFilterForConfigPlatforms,
auFilterOf = auFilterOf,
auFilterForArchs = auFilterForArchs
auFilterForArchs = auFilterForArchs,
defineOutputNames = defineOutputNames
}

View File

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