Begin work on deprecating jsonProcessor

This commit is contained in:
Reece Wilson 2022-01-17 19:40:31 +00:00
parent 3e3dade158
commit d28d058dd7
16 changed files with 585 additions and 319 deletions

View File

@ -130,7 +130,7 @@ local function postBuildCommands(name, type, config, platformName, arch)
platform.devChainSupportsElfStrip) then platform.devChainSupportsElfStrip) then
debugEx = ".dwarf" debugEx = ".dwarf"
debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".dwarf" debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".dwarf"
postbuildcommands("objcopy --only-keep-debug " .. file .. " " .. debugSymbolPath) postbuildcommands("objcopy --only-keep-debug " .. debugSymbolPath .. " " .. debugSymbolPath)
elseif (isWin) then elseif (isWin) then
debugEx = ".pdb" debugEx = ".pdb"
debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".pdb" debugSymbolPath = normalizeCpyPath(Aurora.Settings.sAbsSymbols) .. "/" .. name .. ".pdb"

View File

@ -1,3 +1,4 @@
return { return {
project = auRequire("Core/JSON/jsonProject") projectHandlers = auRequire("Core/JSON/jsonProjectHandlers"),
projectBase = auRequire("Core/JSON/jsonProjectBase")
} }

View File

@ -1,203 +0,0 @@
local function __pushFilter(obj, key, callback, expandArray)
if (not obj) then
return
end
local function runCallbackFe(value, key, callback, expandArray, isArray)
if (expandArray and isArray) then
auForEach(value, function(val)
__pushFilter(val, key, callback, false)
end)
else
callback(value)
end
end
if (type(obj) == "table") then
local value = nil
local isArray = false
if (auIsArray(obj)) then
value = obj
isArray = true
else
value = obj[key]
if (not value) then
return
end
end
if (obj.filter) then
filter(auFilterOf(obj.filter))
end
runCallbackFe(value, key, callback, expandArray, isArray)
if (obj.filter) then
filter {}
end
else
if (expandArray) then -- fast path. we can skip this, if false. the if and statment doesnt optimize away the auIsArray anymore
runCallbackFe(obj, key, callback, true, auIsArray(obj))
else
callback(obj)
end
end
end
local function __handleIncludeCallback(thisProject, includeProject, callback)
if (type(project) == "table")
auForEachKV(project, function(projectName, soft)
if (type(projectName) == "number") then
projectName = soft
soft = false
end
if (type(projectName) ~= "string") then
auFatal("what is my project name?")
end
callback(projectName, not soft)
end)
else
if (type(project) ~= "string") then
auFatal("what is my project name? [2]")
end
callback(projectName, true)
end
end
local function __translate(project, key)
if (project.info.translations) then
local override = project.info.translations[key]
if (override) then
key = override
end
end
return key
end
local function auBlockProjectKeyDefines(project, value)
__pushFilter(value, "value", defines)
end
local function auBlockProjectKeyIncludes(project, value)
end
local function auBlockProjectKeyFeatures(project, value)
__pushFilter(obj, "feature", auAddFeature, true)
end
local function auBlockProjectKeyExcludes(project, value)
end
local function auBlockProjectKeySources(project, value)
end
local function auBlockProjectKeySourcePaths(project, value)
end
local function auBlockProjectKeyEval(project, value, tasksMask)
tasksMask:remove("eval")
end
local function auBlockProjectKeyImplDefines(project, value)
end
local function auBlockProjectKeyImplIncludes(project, value)
end
local function auBlockProjectKeyClangIgnore(project, value)
end
local function auBlockProjectKeyMSVCIgnore(project, value)
end
local function auBlockProjectKeyDepends(project, value)
end
local function auBlockProjectKeyLinks(obj)
__pushFilter(obj, "value", links)
end
local function auHeaderProjectKeyIncludeDepends(thisProject, includeProject)
__handleIncludeCallback(jsonProcessor, includeProject, function(projectName, hard)
auIncludeProject(__translate(thisProject, projectName), not hard)
end)
end
local function auHeaderProjectKeyLinkDepends(thisProject, includeProject)
__handleIncludeCallback(jsonProcessor, includeProject, function(projectName, hard)
auLinkProject(__translate(thisProject, projectName), not hard)
end)
end
local function auHeaderProjectKeyRequire(project, script)
auUserRequire(script)
end
local auProjectHeaderHandlers =
{
require = auHeaderProjectKeyRequire,
linkDepends = auHeaderProjectKeyLinkDepends
includeDepends = auHeaderProjectKeyIncludeDepends
}
local auProjectBlockHandlers =
{
links = auBlockProjectKeyLinks,
sourcePaths = auBlockProjectKeySourcePaths,
sources = auBlockProjectKeySources,
excludes = auBlockProjectKeyExcludes,
eval = auBlockProjectKeyEval,
impDefines = auBlockProjectKeyImplDefines,
implDefines = auBlockProjectKeyImplDefines,
implementationDefines = auBlockProjectKeyImplDefines,
impInclude = auBlockProjectKeyImplIncludes,
implInclude = auBlockProjectKeyImplIncludes,
clangIgnore = auBlockProjectKeyClangIgnore,
msvcIgnore = auBlockProjectKeyMSVCIgnore,
depends = auBlockProjectKeyDepends
}
local kGenericTasks = {"eval", "features", "sourcePaths", "sources", "excludes",
"impDefines", "implDefines", "implementationDefines",
"impInclude", "implInclude", "implInclude", "clangIgnore",
"msvcIgnore", "depends" }
local function __pRunTasks(object, tasks)
auForEachKV(object, function(key, value)
if (not auContains(tasks, key)) then
return
end
auProjectBlockHandlers[key](object, value, tasks)
end)
end
local function __pRunLinkTasks(object)
__pRunTasks(object, {"eval", "links", "depends"})
end
local function __pRunMainTasks(object)
__pRunTasks(object, kGenericTasks)
end
return auCopyTables(auProjectHeaderHandlers, auProjectBlockHandlers)

View File

View File

@ -0,0 +1,402 @@
local kTargetingCmake = false
local kTargetingWindows = os.host() == "windows"
local kBugHack = kTargetingCmake or kTargetingWindows
local auProjectBlockHandlers = {}
local kGenericTasks = {}
local __pRunTasks = function(processor, object, map, tasks, inc)
end
local function __pushFilter(obj, key, callback, expandArray)
if (not obj) then
return
end
local function runCallbackFe(value, key, callback, expandArray, isArray)
if (expandArray and isArray) then
auForEach(value, function(val)
__pushFilter(val, key, callback, false)
end)
else
callback(value)
end
end
if (type(obj) == "table") then
local value = nil
local isArray = false
if (auIsArray(obj)) then
value = obj
isArray = true
else
if (key) then
value = obj[key]
else
value = obj
end
if (not value) then
return
end
end
if (obj.filter) then
auFilter(auFilterOf(obj.filter))
end
runCallbackFe(value, key, callback, expandArray, isArray)
if (obj.filter) then
auFilter {}
end
else
if (expandArray) then -- fast path. we can skip this, if false. the if and statment doesnt optimize away the auIsArray anymore
runCallbackFe(obj, key, callback, true, auIsArray(obj))
else
callback(obj)
end
end
end
local function __handleIncludeCallback(processor, includeProject, callback)
if (type(processor) == "table") then
auForEachKV(processor, function(processorName, soft)
if (type(processorName) == "number") then
processorName = soft
soft = false
end
if (type(processorName) ~= "string") then
auFatal("what is my processor name?")
end
callback(processorName, not soft)
end)
else
if (type(processor) ~= "string") then
auFatal("what is my processor name? [2]", type(processor))
end
callback(processorName, true)
end
end
local function __translate(processor, key)
return processor:translateDep(key)
end
local function _includeDirectoryEx(path, incFiles)
includedirs(path)
if (not incFiles) then
return
end
files(path .. "/**.h")
files(path .. "/**.hpp")
files(path .. "/**.inl")
end
local function auBlockProjectKeyDefines(processor, value)
-- Required for dependent and current processor // global library configuration
__pushFilter(value, "value", defines)
end
local function auBlockProjectKeyIncludes(processor, value, tasks, inc)
_includeDirectoryEx(processor:getMeta().path .. "/" .. value, not inc)
end
local function auBlockProjectKeyFeatures(processor, value)
-- Runs special features / plugins defined in sAbsScripts/features
__pushFilter(value, "value", auAddFeature, true)
end
local function auBlockProjectKeyExcludes(processor, value)
__pushFilter(value, "value", removefiles)
end
local function auBlockProjectKeySources(processor, value)
--files(value) -- NOTE: this was once path .. / .. value
__pushFilter(value, "value", files)
end
local function auBlockProjectKeySourcePaths(processor, value)
local source = value
local path = processor:getMeta().path
files
{
path .. "/" .. source .. "/**.*pp",
path .. "/" .. source .. "/**.inl",
path .. "/" .. source .. "/**.c",
path .. "/" .. source .. "/**.cc",
path .. "/" .. source .. "/**.h",
path .. "/" .. source .. "/**.masm"
}
end
local function auBlockProjectKeyEval(processor, value, tasksMask)
if (type(object) == "string") then
auEval(object)
return
end
__pushFilter(value, nil, function(value)
__pRunTasks(processor, value, auProjectBlockHandlers, kGenericTasks, true)
end)
end
local function auBlockProjectKeyDefines(processor, value)
__pushFilter(value, "value", defines)
end
local function auBlockProjectKeyImplDefines(processor, value)
__pushFilter(value, "value", defines)
end
local function auBlockProjectKeyStaticImplDefines(processor, value)
if (not processor:getMeta().isStatic) then
return
end
__pushFilter(value, "value", defines)
end
local function auBlockKeyFeature(processor, value)
__pushFilter(value, "value", auAddFeature, true)
end
local function auBlockProjectKeyImplIncludes(processor, value)
__pushFilter(value, "value", _includeDirectoryEx)
end
local function auBlockProjectKeyClangIgnore(processor, value)
if (targetingCmake) then
filter {"toolset:clang"}
end
disablewarnings(value)
filter {}
end
local function auBlockProjectKeyMSVCIgnore(processor, value)
if (targetingCmake) then
filter {"toolset:msc"}
end
disablewarnings(value)
filter {}
end
local function _auBlockProjectKeyLinks(value, processor)
end
local function auBlockProjectKeyLinks(processor, value)
print("LINK?", json.encode(value))
__pushFilter(value, "value", function(val)
links(__translate(processor, val))
end, true)
end
local function auHeaderProjectKeyIncludeDepends(processor, includeProject)
-- Projects that include
__handleIncludeCallback(processor, includeProject, function(processorName, hard)
auIncludeProject(__translate(processor, processorName), not hard)
end)
end
local function auHeaderProjectKeyLinkDepends(processor, includeProject)
__handleIncludeCallback(processor, includeProject, function(processorName, hard)
auLinkProject(__translate(processor, processorName), not hard)
end)
end
local function auBlockProjectKeyBuildEvent(processor, value)
__pushFilter(value, nil, function(value)
local type = ""
if (value.lua) then
type = "lua"
elseif (value.bin) then
type = "bin"
else
return
end
auAddBuildAction(obj.when, type, value[type], value.isCwdProjRoot)
end, processor)
end
local function handleActionCommon(action, cb, ...)
local _if = action["if"]
local _then = action["then"]
print("EVAL?")
--_G["info"] = info
if (_if) then
local val = auEval("return " .. _if)
if (not val) then
return
end
if (_then) then
cb(_then, ...)
end
else
if (not action.eval) then
action.eval = action["then"]
end
print("RUN?", json.encode(action.eval))
if (action.eval) then
cb(action.eval, ...)
end
end
--_G["info"] = nil
end
local function auBlockProjectKeyBuildAction(processor, value, mask)
__pushFilter(value, nil, function(value)
handleActionCommon(value, function(thenblock)
print("eval... ", json.encode(thenblock))
auBlockProjectKeyEval(processor, thenblock, auProjectBlockHandlers)
end)
end, processor)
end
local function handleDepends(processor, dep, soft)
dep = processor:translateDep(dep)
local macro = ("_auhas_" .. dep):upper():gsub("%-", "_");
if (isProjectLoaded(dep)) then
defines(macro .. "=1")
auLinkAndRefProject(dep, soft)
else
defines(macro .. "=0")
if (not soft) then
fatal("missing project: ", dep)
end
end
end
local function auBlockProjectKeyDepends(processor, value)
__pushFilter(value, "value", function(obj)
auForEach(obj, function(re)
handleDepends(processor, re, false)
end)
end, processor)
end
local function auBlockProjectKeyLua(processor, script)
auUserRequire(script)
end
local function auBlockProjectKeyImplNoRootInclude()
-- this is just a stub.
-- set me, the "noRootInclude" key to 'true' if you do not want the processor root to be include in the include dir search path
end
local auProjectHeaderHandlers =
{
linkDepends = auHeaderProjectKeyLinkDepends,
includeDepends = auHeaderProjectKeyIncludeDepends
}
local kAllProjectHeaders =
{
"linkDepends", "includeDepends"
}
auProjectBlockHandlers =
{
links = auBlockProjectKeyLinks,
lua = auBlockProjectKeyLua,
sourcePaths = auBlockProjectKeySourcePaths,
sources = auBlockProjectKeySources,
includes = auBlockProjectKeyIncludes,
include = auBlockProjectKeyIncludes,
excludes = auBlockProjectKeyExcludes,
eval = auBlockProjectKeyEval,
defines = auBlockProjectKeyDefines,
impDefines = auBlockProjectKeyImplDefines,
implDefines = auBlockProjectKeyImplDefines,
implementationDefines = auBlockProjectKeyImplDefines,
staticImpDefines = auBlockProjectKeyStaticImplDefines,
impInclude = auBlockProjectKeyImplIncludes,
implInclude = auBlockProjectKeyImplIncludes,
impIncludes = auBlockProjectKeyImplIncludes,
implIncludes = auBlockProjectKeyImplIncludes,
clangIgnore = auBlockProjectKeyClangIgnore,
msvcIgnore = auBlockProjectKeyMSVCIgnore,
depends = auBlockProjectKeyDepends,
require = auBlockProjectKeyRequire,
noRootInclude = auBlockProjectKeyImplNoRootInclude,
events = auBlockProjectKeyBuildEvent,
actions = auBlockProjectKeyBuildAction,
features = auBlockKeyFeature
}
kGenericTasks = {"sourcePaths", "includes","include", "sources",
"impDefines", "implDefines", "implementationDefines",
"impInclude", "implInclude", "impIncludes", "implIncludes", "clangIgnore",
"msvcIgnore", "excludes", "depends", "require",
"eval", "lua", "events", "actions", "staticImpDefines", "features",
"links"
}
local kReferenceTasks = {"eval", "includes", "include"} --, "features"}
__pRunTasks = function(processor, object, map, tasks, inc)
auForEachKV(tasks, function(na, key)
local value = object[key]
if (not value) then
return
end
map[key](processor, value, tasks, inc)
end)
end
local function __pRunLinkTasks(processor, object)
__pRunTasks(processor, object, auProjectBlockHandlers, { "links", "depends"})
end
local function __pRunIncludeTasks(processor, object, isIncludeLocalProject)
__pRunTasks(processor, object, auProjectBlockHandlers, kReferenceTasks, isIncludeLocalProject)
if (object.type:lower() == "aurora") then
_includeDirectoryEx(processor:getMeta().path .. "/Include")
elseif (object.type:lower() == "lazy_free") then
object.noRootInclude = false
elseif (object.type:lower() == "root") then
_includeDirectoryEx(processor:getMeta().path)
end
end
local function ___pRunIncludeTasks(processor, object, isIncludeLocalProject)
__pRunIncludeTasks(processor, object, isIncludeLocalProject)
if (not object.noRootInclude) then
_includeDirectoryEx(processor:getMeta().path, isIncludeLocalProject)
end
end
local function __pRunMainTasks(processor, object)
__pRunIncludeTasks(processor, object, true)
__pRunTasks(processor, object, auProjectBlockHandlers, kGenericTasks, true)
if (not object.noRootInclude) then
_includeDirectoryEx(processor:getMeta().path, isIncludeLocalProject)
end
end
return auCopyTables(auProjectHeaderHandlers, auProjectBlockHandlers, {
runProjectBlock = __pRunMainTasks,
runProjectLink = __pRunLinkTasks,
runProjectRef = ___pRunIncludeTasks
})

View File

@ -65,6 +65,7 @@ function addVisit(ina)
path = ina.path, path = ina.path,
type = ina.type, type = ina.type,
out = ina.out, out = ina.out,
options = ina.options,
translations = ina.translations -- OPT: dictionary of dependency maps translations = ina.translations -- OPT: dictionary of dependency maps
} }
@ -79,7 +80,8 @@ function addVisit(ina)
projectType = args.type, projectType = args.type,
out = args.out, out = args.out,
name = args.name, name = args.name,
translations = args.translations translations = args.translations,
options = args.options
} }
extendInfo(info) extendInfo(info)
@ -112,6 +114,8 @@ function addVisit(ina)
return return
end end
auRequire("Core").project.expendBaseProcessor(project)
projectsprocessor[info.name] = project projectsprocessor[info.name] = project
end end
@ -121,7 +125,9 @@ function addScript(ina)
script = ina.script, script = ina.script,
path = ina.path, path = ina.path,
type = ina.type, type = ina.type,
out = ina.out out = ina.out,
options = ina.options,
translations = ina.translations
} }
local path = normalizeSourceRoot(args.path) local path = normalizeSourceRoot(args.path)
@ -133,7 +139,9 @@ function addScript(ina)
namespace = args.namespace, namespace = args.namespace,
path = path, path = path,
projectType = args.type, projectType = args.type,
out = args.out out = args.out,
translations = args.translations,
options = args.options
} }
extendInfo(info) extendInfo(info)
@ -395,18 +403,23 @@ function importAndLinkProject(dep, soft)
auFatal("missing project: ", dep) auFatal("missing project: ", dep)
end end
iface:handleReference() local circular = isWeakCircularReference(dep)
iface:handleReference(isWeakCircularReference(dep))
if (getProjectInfo(getCurrentProjectName()).isStatic) then
return true
end
iface:handleLink() iface:handleLink()
return true return true
end end
function includeAuProject(dep, soft) function includeAuProject(dep, soft)
local proj = _G["projectsprocessor"][dep] local proj = _G["projectsprocessor"][dep]
if (not proj) then if (not proj) then
if (soft) then if (soft) then
return false return false
end end
auFatal("Missing project", dep)
end end
local iface = proj.processor local iface = proj.processor
@ -430,7 +443,7 @@ function linkAuProject(dep, soft)
auFatal("Missing project", dep) auFatal("Missing project", dep)
end end
local iface = proj.processor local processor = proj.processor
if (not isProjectLoaded(dep)) then if (not isProjectLoaded(dep)) then
if (soft) then if (soft) then
return false return false
@ -438,13 +451,16 @@ function linkAuProject(dep, soft)
auFatal("missing project: ", dep) auFatal("missing project: ", dep)
end end
iface:handleLink() if (not processor:getMeta().isStatic) then
processor:handleLink()
end
return true return true
end end
-- executes inline under iprocessor::process -- executes inline under iprocessor::process
function addFeature(feature) function addFeature(feature)
print("adding feature ", feature)
local script = auGetRoot() .. "/Build_Scripts/Features/" .. feature:lower() .. ".lua" local script = auGetRoot() .. "/Build_Scripts/Features/" .. feature:lower() .. ".lua"
if (not os.isfile(script)) then if (not os.isfile(script)) then

View File

@ -15,16 +15,10 @@ function JsonProcessor(info)
result.name = info.name result.name = info.name
local translateDep = function(this, dep) local translateDep = function(this, dep)
if (this.info.translations) then return this:translateDep(dep)
local override = this.info.translations[dep]
if (override) then
dep = override
end
end
return dep
end end
-- ported
local includeDirEx = function(path, incFiles) local includeDirEx = function(path, incFiles)
includedirs(path) includedirs(path)
@ -213,11 +207,15 @@ function JsonProcessor(info)
local handleReference = function(this, circular) local handleReference = function(this, circular)
local type = this.result.type local type = this.result.type
--print("handleReference ", this.info.name)
if ((type:lower() == "utility") or (type:lower() == "blank")) then if ((type:lower() == "utility") or (type:lower() == "blank")) then
return return
end end
--print("handleReference function ", this.info.name, getCurrentProjectName())
local cur = nil local cur = nil
if (circular) then if (circular) then
cur = getProjectInfo(getCurrentProjectName()) cur = getProjectInfo(getCurrentProjectName())
@ -297,9 +295,9 @@ function JsonProcessor(info)
} }
if (result.noLink) then if (result.noLink) then
print("noLink is deprecated. Use projectType: None") print("noLink is deprecated. Use projectType: none")
prj_.projectType = "None" prj_.projectType = "none"
info.projectType = "None" info.projectType = "none"
end end
if (result.type:lower() == "aurora") then if (result.type:lower() == "aurora") then
@ -346,20 +344,6 @@ function JsonProcessor(info)
handleInclude(a, true) handleInclude(a, true)
--auForEach(result.defines, defines)
--handleJSONInclude(result) -- include auProject public headers, do not use handleInclude, that could reinclude a header included in `project`
-- that could potentially fuck with #include_next
local handleFeature = function(feature)
addFeature(feature)
end
local handleRequire = function(dep)
dep = translateDep(a, dep)
dependson(dep)
end
local handleDepends = function(dep, this, soft) local handleDepends = function(dep, this, soft)
dep = translateDep(this, dep) dep = translateDep(this, dep)
@ -392,27 +376,6 @@ function JsonProcessor(info)
end end
end end
local handleExcludes = function(excludes, path)
removefiles(excludes)
end
local handleSources = function(source, path)
--files(path .. "/" .. source)
files(source)
end
local handleSourcePaths = function(source, path)
files
{
path .. "/" .. source .. "/**.*pp",
path .. "/" .. source .. "/**.inl",
path .. "/" .. source .. "/**.c",
path .. "/" .. source .. "/**.cc",
path .. "/" .. source .. "/**.h",
path .. "/" .. source .. "/**.masm"
}
end
info.m4_files = {} info.m4_files = {}
local addM4Defines = function(obj) local addM4Defines = function(obj)
@ -428,22 +391,9 @@ function JsonProcessor(info)
end end
local processJsonBlock = function(object) local processJsonBlock = function(object)
auForEach(object.features, handleFeature, info.path) auRequire("Core/JSON/JSON").projectHandlers.runProjectBlock(a, object)
auForEach(object.sourcePaths, handleSourcePaths, info.path)
auForEach(object.excludes, handleExcludes, info.path)
auForEach(object.sources, handleSources, info.path)
auForEach(object.depends, handleDepends, a, false)
auForEach(object["soft-depends"], handleDepends, a, true) auForEach(object["soft-depends"], handleDepends, a, true)
auForEach(object.impDefines, defines)
auForEach(object.links, links)
if (usingMSVC) then
auForEach(object.msvcIgnore, disablewarnings)
end
if (usingClang) then
auForEach(object.clangIgnore, disablewarnings)
end
auForEach(object.impInclude, handleUserJsonInclude, info.path, true)
-- this is ran twice. i dont care
auForEach(object.unpack, runCopies, info.path, info.name) auForEach(object.unpack, runCopies, info.path, info.name)
addM4Defines(object.m4Defines) addM4Defines(object.m4Defines)
end end
@ -466,8 +416,6 @@ function JsonProcessor(info)
handleActionCommon(action, handleEval) handleActionCommon(action, handleEval)
end end
auForEach(result.require, handleRequire)
if (not isUtility) then if (not isUtility) then
processJsonBlock(result) processJsonBlock(result)
@ -476,13 +424,6 @@ function JsonProcessor(info)
end end
end end
auForEach(result.actions, handleAction, info.path)
auForEach(result.events, handleBuildEvent, info.path)
if (info.isStatic) then
auForEach(result.staticImpDefines, defines)
end
if (result.valaSrc) then if (result.valaSrc) then
local sources = result.valaSrc local sources = result.valaSrc
local gir = concatArrays(auValaGirs, result.valaGirs) local gir = concatArrays(auValaGirs, result.valaGirs)

View File

@ -27,9 +27,6 @@ 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)
_auExtendedConfig = #_auCurrentPlatforms > 1
_auExtendedArch = #_auCurrentArchs > 1
end end
local function startProject() local function startProject()
@ -57,6 +54,7 @@ local function startSolution()
end end
configurations(configs) configurations(configs)
platforms(_auCurrentPlatforms)
end end
local function auFilterForArchs(callback, ...) local function auFilterForArchs(callback, ...)
@ -102,6 +100,7 @@ local function auFilterOf(configFilter, ...)
local andOptions = {} local andOptions = {}
local test = function(val, orArray, notArray) local test = function(val, orArray, notArray)
if (orArray) then if (orArray) then
if (type(orArray) == "string") then if (type(orArray) == "string") then
if (orArray ~= val) then if (orArray ~= val) then
@ -129,30 +128,33 @@ local function auFilterOf(configFilter, ...)
return true return true
end end
auForEach(_auCurrentPlatforms, function(platform) -- TODO: clean up
auForEach(_auCurrentArchs, function(arch) local validPlatforms = {}
auForEach(Aurora.Settings.aNamesOfConfigs, function(config) local validArchs = {}
local validConfigs = {}
auForEach(Aurora.Settings.aNamesOfConfigs, function(config)
if (not test(config, configFilter.configs, configFilter.notConfigs)) then if (not test(config, configFilter.configs, configFilter.notConfigs)) then
return return
end end
table.insert(validConfigs, config)
end)
auForEach(_auCurrentArchs, function(arch)
if (not test(arch, configFilter.archs, configFilter.notArchs)) then if (not test(arch, configFilter.archs, configFilter.notArchs)) then
return return
end end
table.insert(validArchs, arch)
end)
auForEach(_auCurrentPlatforms, function(platform)
if (not test(platform, configFilter.platforms, configFilter.notPlatforms)) then if (not test(platform, configFilter.platforms, configFilter.notPlatforms)) then
return return
end end
if (not _auExtendedConfig and not _auExtendedArch) then table.insert(validPlatforms, platform)
table.insert(ret, "configurations:" .. config)
else
table.insert(ret, "configurations:" .. platform .. arch .. config)
end
end)
end)
end) end)
auForEach(configFilter.options, function(option) auForEach(configFilter.options, function(option)
@ -163,7 +165,41 @@ local function auFilterOf(configFilter, ...)
table.insert(andOptions, "not options:" .. option) table.insert(andOptions, "not options:" .. option)
end) end)
return auConcatVararg({table.concat(ret, " or ")}, andOptions, ...) local supportedArchs = {}
auForEach(validArchs, function(arch)
table.insert(supportedArchs, "architecture:" .. auFetchGlobal("Architectures")[arch].architecture)
end)
if (#supportedArchs == 0) then
table.insert(supportedArchs, "platforms:none")
end
ret = table.concat(supportedArchs, " or ")
local supportedPlatforms = {}
auForEach(validPlatforms, function(platform)
table.insert(supportedPlatforms, "platforms:" .. platform)
end)
if (#supportedPlatforms == 0) then
table.insert(supportedPlatforms, "platforms:none")
end
ret = auConcatVararg(ret, {table.concat(supportedPlatforms, " or ")})
local supportedConfigs = {}
auForEach(validConfigs, function(config)
table.insert(supportedConfigs, "configurations:" .. config)
end)
if (#supportedConfigs == 0) then
table.insert(supportedConfigs, "platforms:none")
end
ret = auConcatVararg(ret, {table.concat(supportedConfigs, " or ")})
--local ret = {table.concat(ret, " or ")}
if (#andOptions) then
ret = auConcatVararg(ret, andOptions)
end
--print(json.encode(configFilter), json.encode(ret))
return auConcatArrays(ret, ...)
end end
return { return {

View File

@ -152,7 +152,7 @@ local function configureProjectErrors()
"4251", -- MSVC's hurrdurr abis will break if you dynamically link classes "4251", -- MSVC's hurrdurr abis will break if you dynamically link classes
-- counter: sod off again. we have full control of the build process, and we only link against -- counter: sod off again. we have full control of the build process, and we only link against
-- dynamic c/stl runtimes. which brainlet thought this was a good idea? -- dynamic c/stl runtimes. which brainlet thought this was a good idea?
-- even microsofts own documentation dont state what is guaranteed to be safe. -- even microsofts own documentation doesn't state what is guaranteed to be safe.
-- dont mix optimizations, mitigation flags, and so on. -- dont mix optimizations, mitigation flags, and so on.
-- rtti works; the stl doesn't abuse inline/module specific globals; who cares? -- rtti works; the stl doesn't abuse inline/module specific globals; who cares?
@ -266,6 +266,37 @@ local function configureProjectForLd(prj)
end) end)
end end
local function processorDispatchRun(processor)
processor:process()
-- TODO: m4/protobuf/etc support
end
local function processorTranslateDep(this, dep)
if (not this._info.translations) then
return dep
end
local override = this._info.translations[dep]
if (override) then
return override
end
return dep
end
local function processorGetInfo(this)
return this._info
end
local function expendBaseProcessor(prj)
prj.processor._info = prj.info
prj.processor.dispatch = processorDispatchRun
prj.processor.translateDep = processorTranslateDep
prj.processor.getInfo = processorGetInfo
prj.processor.getMeta = processorGetInfo
end
local function setupProject(prj) local function setupProject(prj)
print("project", prj.name) print("project", prj.name)
@ -377,6 +408,7 @@ end
return return
{ {
expendBaseProcessor = expendBaseProcessor,
setupProjectCompat = setupProjectCompat, setupProjectCompat = setupProjectCompat,
startProject = setupProject startProject = setupProject
} }

View File

@ -30,7 +30,7 @@ end
function auStartProject(project) function auStartProject(project)
auStart() auStart()
auRequire("Core").project.start(project) auRequire("Core").project.startProject(project)
end end
function auFilterForPlatforms(callback, ...) function auFilterForPlatforms(callback, ...)
@ -45,6 +45,10 @@ function auFilterForConfigPlatforms(callback, ...)
target.auFilterForConfigPlatforms(callback, ...) target.auFilterForConfigPlatforms(callback, ...)
end end
function auAddVisit(...)
addVisit(...)
end
-- Returns an array of filter tables where each optional table is checked against the current combination of config/platform/arch -- Returns an array of filter tables where each optional table is checked against the current combination of config/platform/arch
-- Varargs are logical anded with the final filter table -- Varargs are logical anded with the final filter table
-- in object -> defer to objects.lua -- in object -> defer to objects.lua
@ -73,3 +77,31 @@ end
function auGetSetting(name) function auGetSetting(name)
return Aurora.Settings[name] return Aurora.Settings[name]
end end
_G.filterStack = {}
function auFilter(filter)
local tbl = _G.filterStack;
if (not filter or #filter == 0) then
table.remove(tbl, #tbl)
else
table.insert(tbl, filter)
end
--print("FILTERING ", json.encode(tbl), json.encode(filter))
_G.filter(tbl)
end
function auLinkProject(...)
linkAuProject(...)
end
function auIncludeProject(...)
includeAuProject(...)
end
function auLinkAndRefProject(...)
importAndLinkProject(...)
end
function auAddFeature(...)
addFeature(...)
end

View File

@ -1,10 +1,12 @@
-- This file serves as pseudo-documentation for json schemas and internal object requirements
function auEnum(...) function auEnum(...)
return nil return nil
end end
function auBuildActionO() function auBuildActionO()
return { return {
stage = "post" -- pre, post, stage = "post", -- pre, post,
-- filter: ..., -- filter: ...,
-- lua/bin/targetName/command: relative path - lua script; relative path - executable; project name; command line -- lua/bin/targetName/command: relative path - lua script; relative path - executable; project name; command line
-- args: lua private passthrough; binary or target name command args -- args: lua private passthrough; binary or target name command args

View File

@ -18,7 +18,7 @@ Entry -> ./Public/base.lua
# User Scripts # User Scripts
We decided that, instead of gluing together old nasty pipelines, we would write simple JSON files to quickly add We decided that, instead of gluing together old nasty pipelines, we would write simple JSON files to quickly add
and configure a C++ project for the minimum desired outcome. We started writing JSON files around specific project and configure C++ projects for the minimum desired outcome. We started writing JSON files around specific project
requirements. Overtime, we wish to unify everything, and extend these scripts to testing and deployment. For now, requirements. Overtime, we wish to unify everything, and extend these scripts to testing and deployment. For now,
they serve as a simple way to describe a C/C++'s project structure. Advanced users can write user scripts in native they serve as a simple way to describe a C/C++'s project structure. Advanced users can write user scripts in native
lua, using an untouched premake api; however, our experimental clang driver will be limited in its support for your lua, using an untouched premake api; however, our experimental clang driver will be limited in its support for your

View File

@ -12,3 +12,10 @@ require("./requireAbs")
require("./merge") require("./merge")
require("./settings") require("./settings")
require("./contains") require("./contains")
function table.copy(t)
local u = { }
for k, v in pairs(t) do u[k] = v end
--setmetatable(u, getmetatable(t))
return u
end

View File

@ -3,7 +3,7 @@ function auIsArray(table)
local max = 0 local max = 0
local count = 0 local count = 0
if (type(object) ~= "table") then if (type(table) ~= "table") then
return false return false
end end

View File

@ -1,4 +1,4 @@
@echo off @echo off
cd Public cd Public
premake5 vs2019 --target-win32 --target-x86_64 premake5 vs2022 --target-win32 --target-x86_64

View File

@ -1,4 +1,4 @@
@echo off @echo off
cd Public cd Public
premake5 vs2019 --target-win32 --target-x86_32 premake5 vs2022 --target-win32 --target-x86_32