[+] Static dependencies no longer link agasint things they shouldn't
[+] Nonstatic entities [+] Build order is not perserved anymore for UX. Namespaces are ordered more neatly now [*] Bug fixes in platform guess and remove code
This commit is contained in:
parent
ec094a8180
commit
100644b0de
@ -12,6 +12,18 @@ function JsonProcessor(info)
|
||||
info.name = result.name
|
||||
end
|
||||
|
||||
local translateDep = function(this, dep)
|
||||
|
||||
if (this.info.translations) then
|
||||
local override = this.info.translations[dep]
|
||||
if (override) then
|
||||
dep = override
|
||||
end
|
||||
end
|
||||
|
||||
return dep
|
||||
end
|
||||
|
||||
local includeDirEx = function(path, incFiles)
|
||||
includedirs(path)
|
||||
|
||||
@ -86,18 +98,107 @@ function JsonProcessor(info)
|
||||
end
|
||||
end
|
||||
|
||||
local handleDependsShort = function(dep, this, soft)
|
||||
dep = translateDep(this, dep)
|
||||
|
||||
local proj = _G["projectsprocessor"][dep]
|
||||
if (not proj) then
|
||||
if (soft) then
|
||||
print("Not including, ", dep)
|
||||
return
|
||||
end
|
||||
fatal("Missing project", dep)
|
||||
end
|
||||
|
||||
local iface = proj.processor
|
||||
if (isProjectLoaded(dep) and not _G["_linkingcur"][dep]) then
|
||||
iface:handleLink()
|
||||
end
|
||||
end
|
||||
|
||||
local processJsonBlockForLinks = function(object, this)
|
||||
forEach(object.links, links)
|
||||
forEach(object.depends, handleDependsShort, this, false)
|
||||
forEach(object["soft-depends"], handleDependsShort, this, true)
|
||||
end
|
||||
|
||||
function handleEvalForLinks(object, this)
|
||||
if (isArray(object)) then
|
||||
forEach(object, handleEvalForLinks, this)
|
||||
return
|
||||
end
|
||||
|
||||
if (type(object) == "string") then
|
||||
return
|
||||
end
|
||||
|
||||
processJsonBlockForLinks(object, this)
|
||||
end
|
||||
|
||||
local handleActionCommon = function(action, cb, ...)
|
||||
local _if = action["if"]
|
||||
local _then = action["then"]
|
||||
|
||||
_G["info"] = info
|
||||
|
||||
local loadstring = loadstring or load
|
||||
|
||||
if (_if) then
|
||||
local val = eval("return " .. _if)
|
||||
if (not val) then
|
||||
return
|
||||
end
|
||||
|
||||
if (_then) then
|
||||
cb(_then, ...)
|
||||
end
|
||||
else
|
||||
if (action.eval) then
|
||||
cb(action.eval, ...)
|
||||
end
|
||||
end
|
||||
|
||||
_G["info"] = nil
|
||||
end
|
||||
|
||||
local handleActionsForLinks = function(action, this)
|
||||
handleActionCommon(action, handleEvalForLinks, this)
|
||||
end
|
||||
|
||||
local processSubLinks = function(this)
|
||||
processJsonBlockForLinks(result, this)
|
||||
forEach(result.actions, handleActionsForLinks, this)
|
||||
end
|
||||
|
||||
local handleLink = function(this)
|
||||
dependson(this.info.name)
|
||||
dependson (this.info.name)
|
||||
|
||||
local erase = false;
|
||||
if (not _G["_linkingcur"]) then
|
||||
erase = true
|
||||
_G["_linkingcur"] = {}
|
||||
end
|
||||
|
||||
|
||||
_G["_linkingcur"][this.info.name] = true
|
||||
|
||||
local type = this.result.type
|
||||
|
||||
if ((type:lower() == "utility") or (type:lower() == "blank")) then
|
||||
return
|
||||
end
|
||||
|
||||
if (not this.result.noLink) then
|
||||
if ((not this.result.noLink)) then
|
||||
links(this.info.name)
|
||||
end
|
||||
handleDllImportMaybe(this)
|
||||
|
||||
--if (not this.info.isStatic) then
|
||||
processSubLinks(this)
|
||||
--end
|
||||
|
||||
if (erase) then
|
||||
_G["_linkingcur"] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local handleReference = function(this, circular)
|
||||
@ -133,18 +234,6 @@ function JsonProcessor(info)
|
||||
defines(("_auhas_" .. this.result.name):upper() .. "=1")
|
||||
end
|
||||
|
||||
local translateDep = function(this, dep)
|
||||
|
||||
if (this.info.translations) then
|
||||
local override = this.info.translations[dep]
|
||||
if (override) then
|
||||
dep = override
|
||||
end
|
||||
end
|
||||
|
||||
return dep
|
||||
end
|
||||
|
||||
local handleDependsPreemptive = function(dep, this, soft, resolve)
|
||||
dep = translateDep(this, dep)
|
||||
|
||||
@ -199,6 +288,10 @@ function JsonProcessor(info)
|
||||
os.exit()
|
||||
end
|
||||
|
||||
|
||||
_G["_linkingcur"] = {}
|
||||
_G["_linkingcur"][name] = true
|
||||
|
||||
handleInclude(a, true)
|
||||
|
||||
--forEach(result.defines, defines)
|
||||
@ -238,7 +331,9 @@ function JsonProcessor(info)
|
||||
if (isProjectLoaded(dep)) then
|
||||
defines(("_auhas_" .. dep):upper() .. "=1")
|
||||
iface:handleReference()
|
||||
if (not this.info.isStatic) then
|
||||
iface:handleLink()
|
||||
end
|
||||
else
|
||||
defines(("_auhas_" .. dep):upper() .. "=0")
|
||||
if (not soft) then
|
||||
@ -301,29 +396,7 @@ function JsonProcessor(info)
|
||||
end
|
||||
|
||||
local handleAction = function(action)
|
||||
local _if = action["if"]
|
||||
local _then = action["then"]
|
||||
|
||||
_G["info"] = info
|
||||
|
||||
local loadstring = loadstring or load
|
||||
|
||||
if (_if) then
|
||||
local val = eval("return " .. _if)
|
||||
if (not val) then
|
||||
return
|
||||
end
|
||||
|
||||
if (_then) then
|
||||
handleEval(_then)
|
||||
end
|
||||
else
|
||||
if (action.eval) then
|
||||
handleEval(action.eval)
|
||||
end
|
||||
end
|
||||
|
||||
_G["info"] = nil
|
||||
handleActionCommon(action, handleEval)
|
||||
end
|
||||
|
||||
forEach(result.require, handleRequire)
|
||||
@ -344,6 +417,8 @@ function JsonProcessor(info)
|
||||
forEach(result.staticImpDefines, defines)
|
||||
end
|
||||
|
||||
_G["_linkingcur"] = nil
|
||||
|
||||
end
|
||||
|
||||
forEach(result.subprojs, function(subproj)
|
||||
|
@ -38,16 +38,15 @@ workspace "Aurora Project"
|
||||
|
||||
flags
|
||||
{
|
||||
"NoIncrementalLink",
|
||||
"MultiProcessorCompile",
|
||||
"LinkTimeOptimization"--,
|
||||
--"NoEditAndContinue"
|
||||
"NoPCH",
|
||||
"MultiProcessorCompile"
|
||||
}
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG" }
|
||||
targetdir(getroot() .. "/Build_CompilerWorkingDirectory/Bin/Debug")
|
||||
debugdir( getroot() .. "/Build_Develop")
|
||||
flags "NoIncrementalLink"
|
||||
|
||||
filter "configurations:Release or configurations:Ship"
|
||||
defines { "NDEBUG" }
|
||||
@ -57,12 +56,13 @@ workspace "Aurora Project"
|
||||
defines {"INTERNAL", "STAGING"}
|
||||
targetdir(getroot() .. "/Build_CompilerWorkingDirectory/Bin/Release")
|
||||
debugdir(getroot() .. "/Build_Stage")
|
||||
flags "NoIncrementalLink"
|
||||
|
||||
filter "configurations:Ship"
|
||||
defines {"SHIP"}
|
||||
targetdir(getroot() .. "/Build_CompilerWorkingDirectory/Bin/Ship")
|
||||
debugdir(getroot() .. "/Build_Ship")
|
||||
|
||||
flags "LinkTimeOptimization"
|
||||
filter {}
|
||||
|
||||
|
||||
@ -103,18 +103,16 @@ workspace "Aurora Project"
|
||||
-- even microsofts docs dont state what is guaranteed to be safe.
|
||||
-- dont mix optimizations, cookie/security flags, and so on. rtti works so who cares
|
||||
|
||||
"4244", -- conversion from 'double' to 'float', possible loss of data
|
||||
"4244" -- conversion from 'double' to 'float', possible loss of data
|
||||
-- this warning is extremely important; however, we're making a game engine.
|
||||
-- pragma warning push + disable + pop and/or static_casts to hint we expect floating point precision
|
||||
-- loss is extremely annoying and impractical. further, projects including harfbuzz, freetype,
|
||||
-- and v8 don't seem to care about this warning either
|
||||
|
||||
"4267" -- TODO: remove. its not that we dont want this warning - we see spam where clang doesnt care, annoying
|
||||
}
|
||||
end
|
||||
|
||||
if (_G.linux and usingClang) then
|
||||
|
||||
if (usingClang or usingMSVC) then
|
||||
defines "_AU_HAS_ATOMIC_INTRINS"
|
||||
end
|
||||
|
||||
if (isWin) then
|
||||
|
@ -1,52 +1,55 @@
|
||||
local feature = function()
|
||||
local readdPattern = function(pattern)
|
||||
files (getProjectInfo(getCurrentProjectName()).path + "/" + pattern)
|
||||
files (getProjectInfo(getCurrentProjectName()).path .. "/" .. pattern)
|
||||
end
|
||||
|
||||
local readd = function(name)
|
||||
readdPattern "**/" .. name .. "/**.c"
|
||||
readdPattern "**/" .. name .. "/**.*pp"
|
||||
readdPattern "**/" .. name .. "/**.masm"
|
||||
readdPattern "**/" .. name .. "/**.inl"
|
||||
readdPattern "**/" .. name .. "/**.h"
|
||||
readdPattern "**/*." .. name .. ".cc"
|
||||
readdPattern "**/*." .. name .. ".c"
|
||||
readdPattern "**/*." .. name .. ".h"
|
||||
readdPattern "**/*." .. name .. ".*pp"
|
||||
readdPattern "**/*." .. name .. ".masm"
|
||||
readdPattern "**/*." .. name .. ".inl"
|
||||
readdPattern("**/*" .. name .. ".cc")
|
||||
readdPattern("**/*" .. name .. ".c")
|
||||
readdPattern("**/*" .. name .. ".h")
|
||||
readdPattern("**/*" .. name .. ".*pp")
|
||||
readdPattern("**/*" .. name .. ".masm")
|
||||
readdPattern("**/*" .. name .. ".inl")
|
||||
end
|
||||
|
||||
if (_G["target-win32"]) then
|
||||
if (_G["target-x86_64"]) then
|
||||
if (_G["win32"]) then
|
||||
if (_G["x86_64"]) then
|
||||
readd "win64"
|
||||
end
|
||||
readd "win32"
|
||||
readd "windows"
|
||||
end
|
||||
|
||||
if (_G["target-linux"]) then
|
||||
if (_G["linux"]) then
|
||||
readd "linux"
|
||||
readd "unix"
|
||||
end
|
||||
|
||||
if (_G["target-mac"]) then
|
||||
if (_G["android"]) then
|
||||
readd "linux"
|
||||
readd "android"
|
||||
readd "unix"
|
||||
end
|
||||
|
||||
if (_G["mac"]) then
|
||||
readd "macos"
|
||||
readd "mac"
|
||||
readd "apple"
|
||||
readd "unix"
|
||||
end
|
||||
|
||||
if (_G["target-ios"]) then
|
||||
if (_G["ios"]) then
|
||||
readd "apple"
|
||||
readd "ios"
|
||||
end
|
||||
|
||||
if (_G["target-x86_64"]) then
|
||||
if (_G["x86_64"]) then
|
||||
readd "x64"
|
||||
readd "x86_64"
|
||||
readd "amd64"
|
||||
end
|
||||
|
||||
if (_G["target-x86_32"]) then
|
||||
if (_G["x86_32"]) then
|
||||
readdPattern "**/x86/**"
|
||||
readdPattern "**/x86/**.c"
|
||||
readdPattern "**/x86/**.h"
|
||||
@ -59,7 +62,7 @@ local feature = function()
|
||||
readd "intel"
|
||||
end
|
||||
|
||||
if (_G["target-arm"]) then
|
||||
if (_G["arm"]) then
|
||||
readd "arm"
|
||||
readd "aarch64"
|
||||
readd "aarch"
|
||||
|
@ -1,8 +1,9 @@
|
||||
local feature = function()
|
||||
local platforms = {"win32", "linux", "xnu", "mac", "osx", "ios", "x86_64", "x86_32", "aarch", "arm64", "mips", "mips64", "riscv", "intel", "powerpc", "amiga"}
|
||||
local platforms = {"win32", "linux", "xnu", "mac", "osx", "ios", "x86_64", "x86_32", "aarch", "arm64", "mips", "mips64", "riscv", "intel", "powerpc", "amiga", "unix", "android", "apple", "amd64", "freebsd", "bsd"}
|
||||
forEach(platforms, function(platform)
|
||||
if (not _G[platform]) then
|
||||
excludes("**/" .. platform .. "/**");
|
||||
excludes("**/" .. platform .. "/**.*");
|
||||
excludes("**/*" .. platform .. ".*");
|
||||
end
|
||||
end)
|
||||
|
||||
|
85
aurora.lua
85
aurora.lua
@ -147,10 +147,13 @@ function addScript(ina)
|
||||
}
|
||||
|
||||
local procesor = userRequire(args.script)
|
||||
if (not procesor) then
|
||||
processor = requireAbs(args.script)
|
||||
if (not procesor) then
|
||||
print("missing project script:", args.script, path)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
project.processor = procesor(info)
|
||||
if (not project.processor) then
|
||||
@ -166,6 +169,51 @@ local processLocalProject = function(proj)
|
||||
processProject(proj.info.name)
|
||||
end
|
||||
|
||||
-- private
|
||||
local processInit = function(project)
|
||||
if (not project.isInitialized) then
|
||||
if (project.processor.init) then
|
||||
project.processor:init()
|
||||
end
|
||||
project.isInitialized = true
|
||||
end
|
||||
end
|
||||
|
||||
-- private
|
||||
_G["_resolved_dep_res"] = {}
|
||||
_G["_resolved_dep"] = {}
|
||||
function processDepSearch(proj, resolveProject)
|
||||
local name = proj.info.name
|
||||
|
||||
_G["_resolved_dep"][name] = name
|
||||
|
||||
if (not proj.resolvedDeps) then
|
||||
if (proj.processor.resolveDependencies) then
|
||||
proj.processor:resolveDependencies(function(name, soft)
|
||||
|
||||
if (_G["_resolved_dep"][name]) then
|
||||
return
|
||||
end
|
||||
|
||||
local depProj = projectsprocessor[name]
|
||||
if (not depProj) then
|
||||
if (not soft) then
|
||||
fatal("missing dependency: ", name)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
processDepSearch(depProj, true)
|
||||
end)
|
||||
end
|
||||
proj.resolvedDeps = true
|
||||
end
|
||||
|
||||
processInit(proj)
|
||||
end
|
||||
|
||||
-- private
|
||||
local processNS = function(namespace)
|
||||
local projs = {}
|
||||
local projsIdxs = {}
|
||||
@ -185,6 +233,10 @@ local processNS = function(namespace)
|
||||
return a:upper() < b:upper()
|
||||
end)
|
||||
|
||||
forEach(projsIdxs, function(idx)
|
||||
processDepSearch(projs[idx], true)
|
||||
end)
|
||||
|
||||
forEach(projsIdxs, function(idx)
|
||||
processLocalProject(projs[idx])
|
||||
end)
|
||||
@ -232,28 +284,7 @@ function processProject(name, required, noNs)
|
||||
end
|
||||
end
|
||||
|
||||
if (not a.isParsed) then
|
||||
if (a.processor.parse) then
|
||||
a.processor:parse()
|
||||
end
|
||||
a.isParsed = true
|
||||
end
|
||||
|
||||
|
||||
resolved[name] = name
|
||||
|
||||
if (not a.resolvedDeps) then
|
||||
if (a.processor.resolveDependencies) then
|
||||
a.processor:resolveDependencies(function(name, soft)
|
||||
if (resolved[name]) then
|
||||
return
|
||||
end
|
||||
|
||||
processProject(name, not soft, noNs)
|
||||
end)
|
||||
end
|
||||
a.resolvedDeps = true
|
||||
end
|
||||
processInit(a)
|
||||
|
||||
if (projectsblocked[name]) then
|
||||
return true
|
||||
@ -290,7 +321,12 @@ function isWeakCircularReference(name)
|
||||
end
|
||||
|
||||
function isProjectLoaded(name)
|
||||
return projectsemitted[name] and true
|
||||
local a = projectsprocessor[name]
|
||||
if (not a) then
|
||||
return false
|
||||
end
|
||||
|
||||
return a.isInitialized
|
||||
end
|
||||
|
||||
function getProjectInfo(name)
|
||||
@ -317,9 +353,10 @@ end
|
||||
|
||||
-- executes inline under iprocessor::process
|
||||
function addFeature(feature)
|
||||
local script = os.getcwd() .. "/Build_Scripts/Features/" .. feature:lower() .. ".lua"
|
||||
local script = getroot() .. "/Build_Scripts/Features/" .. feature:lower() .. ".lua"
|
||||
|
||||
if (not os.isfile(script)) then
|
||||
fatal("missing feature", feature, script)
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user