[+] Base64 utils
[+] Vala compiler support [+] Improve guess-platform-code [*] Clean up
This commit is contained in:
parent
66b3281934
commit
dd109c82cb
@ -39,7 +39,7 @@ local getPremakeExec = function()
|
|||||||
return premake_exe
|
return premake_exe
|
||||||
end
|
end
|
||||||
|
|
||||||
local addBuildCommand = function(when, scriptType, path, cwdRelToProject)
|
local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
|
||||||
local scriptPath = path
|
local scriptPath = path
|
||||||
local cwd = getroot()
|
local cwd = getroot()
|
||||||
|
|
||||||
@ -49,13 +49,14 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject)
|
|||||||
command = "call "
|
command = "call "
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cur = getProjectInfo(getCurrentProjectName())
|
||||||
command = command .. getPremakeExec()
|
command = command .. getPremakeExec()
|
||||||
command = command .. " --file=\"" .. os.realpath(cwd .. "/Build_Scripts/Actions/buildActionBootstrap.lua") .. "\""
|
command = command .. " --file=\"" .. os.realpath(cwd .. "/Build_Scripts/Actions/buildActionBootstrap.lua") .. "\""
|
||||||
command = command .. " --project_name=\"%{prj.name}\""
|
--command = command .. " --project_name=\"%{prj.name}\""
|
||||||
|
command = command .. " --project_name=\"" .. cur.name .. "\""
|
||||||
command = command .. " --project_arch=\"%{cfg.architecture}\""
|
command = command .. " --project_arch=\"%{cfg.architecture}\""
|
||||||
command = command .. " --project_platform=\"%{cfg.system}\""
|
command = command .. " --project_platform=\"%{cfg.system}\""
|
||||||
|
|
||||||
local cur = getProjectInfo(getCurrentProjectName())
|
|
||||||
if (cwdRelToProject) then
|
if (cwdRelToProject) then
|
||||||
command = command .. " --actualcwd=\"" .. cur.path .. "\""
|
command = command .. " --actualcwd=\"" .. cur.path .. "\""
|
||||||
else
|
else
|
||||||
@ -74,10 +75,23 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject)
|
|||||||
command = command .. postBuildSuffix
|
command = command .. postBuildSuffix
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cliArgs = ""
|
||||||
|
local argsEscaped = ""
|
||||||
|
if (args) then
|
||||||
|
argsEscaped = args:gsub("\"", "\\\"")
|
||||||
|
cliArgs = " " .. argsEscaped
|
||||||
|
end
|
||||||
|
|
||||||
if (scriptType == "lua") then
|
if (scriptType == "lua") then
|
||||||
command = command .. " --luascript=\"" .. path .. "\""
|
if (os.isfile(path) and os.realpath(path) == path) then
|
||||||
|
command = command .. " --luaabsscript=\"" .. path .. "\""
|
||||||
|
else
|
||||||
|
command = command .. " --luascript=\"" .. path .. "\""
|
||||||
|
end
|
||||||
|
|
||||||
|
command = command .. " --additional=\"" .. base64.encode(argsEscaped) .. "\""
|
||||||
elseif (scriptType == "bin") then
|
elseif (scriptType == "bin") then
|
||||||
command = command .. " --binscript=\"" .. path .. "\""
|
command = command .. " --binscript=\"" .. path .. cliArgs .. "\""
|
||||||
end
|
end
|
||||||
|
|
||||||
--command = command:gsub("\\","\\\\")
|
--command = command:gsub("\\","\\\\")
|
||||||
|
@ -54,6 +54,17 @@ newoption
|
|||||||
description = ""
|
description = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption
|
||||||
|
{
|
||||||
|
trigger = "additional",
|
||||||
|
description = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
newoption
|
||||||
|
{
|
||||||
|
trigger = "luaabsscript",
|
||||||
|
description = ""
|
||||||
|
}
|
||||||
|
|
||||||
local cwd =_OPTIONS["actualcwd"]
|
local cwd =_OPTIONS["actualcwd"]
|
||||||
if (cwd) then
|
if (cwd) then
|
||||||
@ -73,12 +84,16 @@ _G["build"] =
|
|||||||
architecture = _OPTIONS["project_arch"],
|
architecture = _OPTIONS["project_arch"],
|
||||||
projectName = _OPTIONS["project_name"],
|
projectName = _OPTIONS["project_name"],
|
||||||
projectRoot = _OPTIONS["project_root"],
|
projectRoot = _OPTIONS["project_root"],
|
||||||
|
args = base64.decode(_OPTIONS["additional"]),
|
||||||
root = _overloadRoot
|
root = _overloadRoot
|
||||||
}
|
}
|
||||||
|
|
||||||
local luaScript = _OPTIONS["luascript"]
|
local luaScript = _OPTIONS["luascript"]
|
||||||
|
local luaAbsScript = _OPTIONS["luaabsscript"]
|
||||||
if (luaScript) then
|
if (luaScript) then
|
||||||
require(os.realpath(build.root .. "/Build_UserScripts/" .. luaScript))
|
requireAbs(os.realpath(build.root .. "/Build_UserScripts/" .. luaScript))
|
||||||
end
|
elseif (luaAbsScript) then
|
||||||
|
requireAbs(luaAbsScript)
|
||||||
|
end
|
||||||
|
|
||||||
os.exit()
|
os.exit()
|
@ -1,4 +1,5 @@
|
|||||||
local auProject = require("project")
|
local auProject = require("project")
|
||||||
|
local valaGo = require("vala")
|
||||||
|
|
||||||
function JsonProcessor(info)
|
function JsonProcessor(info)
|
||||||
local result, err = json.decode(io.readfile(info.jpath))
|
local result, err = json.decode(io.readfile(info.jpath))
|
||||||
@ -13,7 +14,6 @@ function JsonProcessor(info)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local translateDep = function(this, dep)
|
local translateDep = function(this, dep)
|
||||||
|
|
||||||
if (this.info.translations) then
|
if (this.info.translations) then
|
||||||
local override = this.info.translations[dep]
|
local override = this.info.translations[dep]
|
||||||
if (override) then
|
if (override) then
|
||||||
@ -235,7 +235,7 @@ function JsonProcessor(info)
|
|||||||
|
|
||||||
handleInclude(this, false)
|
handleInclude(this, false)
|
||||||
|
|
||||||
defines(("_auhas_" .. this.result.name):upper() .. "=1")
|
defines(("_auhas_" .. this.result.name):upper():gsub("%-", "_") .. "=1")
|
||||||
end
|
end
|
||||||
|
|
||||||
local handleDependsPreemptive = function(dep, this, soft, resolve)
|
local handleDependsPreemptive = function(dep, this, soft, resolve)
|
||||||
@ -418,6 +418,30 @@ function JsonProcessor(info)
|
|||||||
forEach(result.staticImpDefines, defines)
|
forEach(result.staticImpDefines, defines)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (result.valaSrc) then
|
||||||
|
local sources = result.valaSrc
|
||||||
|
local gir = concatArrays(auValaGirs, result.valaGirs)
|
||||||
|
local vapi = concatArrays(auValaDevVApis, result.valaDevVApis)
|
||||||
|
local valIncludes = result.valaInclude
|
||||||
|
local valGirFile = result.valGirFile
|
||||||
|
local header = result.valaHeader
|
||||||
|
local name = result.valaName
|
||||||
|
local extended =
|
||||||
|
{
|
||||||
|
sources = sources,
|
||||||
|
gir = gir,
|
||||||
|
vapi = vapi,
|
||||||
|
vapi = vapi,
|
||||||
|
package = valIncludes,
|
||||||
|
header = header,
|
||||||
|
girFile = valGirFile,
|
||||||
|
name = name
|
||||||
|
}
|
||||||
|
valaGo(extended)
|
||||||
|
end
|
||||||
|
|
||||||
|
forEach(result.events, handleBuildEvent, info.path)
|
||||||
|
|
||||||
_G["_linkingcur"] = nil
|
_G["_linkingcur"] = nil
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
local archMap = {};
|
local archMap = {};
|
||||||
--archMap["target-x86_32"] = "x86_32" unsupported
|
archMap["target-x86_32"] = "x32"
|
||||||
archMap["target-x86_64"] = "x86_64"
|
archMap["target-x86_64"] = "x86_64"
|
||||||
archMap["target-aarch"] = "ARM64"
|
archMap["target-aarch"] = "ARM64"
|
||||||
--archMap["target-arm"] = "ARM" unsupported
|
--archMap["target-arm"] = "ARM" unsupported
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
local triggerPairs = {}
|
local triggerPairs = {}
|
||||||
triggerPairs["target-win32"] = "_WIN32_AURORA_PREPROCESSOR"
|
triggerPairs["target-win32"] = "_WIN32_AURORA_PREPROCESSOR"
|
||||||
triggerPairs["target-linux"] = "_LINUX_AURORA_PREPROCESSOR"
|
triggerPairs["target-linux"] = "_LINUX_AURORA_PREPROCESSOR"
|
||||||
triggerPairs["target-switch"] = "_SWITCH_AURORA_PREPROCESSOR"
|
triggerPairs["target-switch"] = "_SWITCH_AURORA_PREPROCESSOR"
|
||||||
triggerPairs["target-ps4"] = "_PS4_AURORA_PREPROCESSOR"
|
triggerPairs["target-ps4"] = "_PS4_AURORA_PREPROCESSOR"
|
||||||
triggerPairs["target-ps5"] = "_PS5_AURORA_PREPROCESSOR"
|
triggerPairs["target-ps5"] = "_PS5_AURORA_PREPROCESSOR"
|
||||||
|
triggerPairs["target-xbox"] = "_XBOX_GENERIC_AURORA_PREPROCESSOR"
|
||||||
|
triggerPairs["target-mac"] = "_APPLE_AURORA_PREPROCESSOR"
|
||||||
|
triggerPairs["target-ios"] = "_APPLE_MOBILE_AURORA_PREPROCESSOR"
|
||||||
|
triggerPairs["target-android"] = "_ANDROID_AURORA_PREPROCESSOR"
|
||||||
triggerPairs["mm-restricted-platform"] = "_AURORA_MEM_STRICT"
|
triggerPairs["mm-restricted-platform"] = "_AURORA_MEM_STRICT"
|
||||||
|
|
||||||
local userPaths = userRequire("preprocessors")
|
local userPaths = userRequire("preprocessors")
|
||||||
|
@ -67,6 +67,16 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root)
|
|||||||
filter {}
|
filter {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (usingClang or usingGXX) then
|
||||||
|
-- define "_FILE_OFFSET_BITS=64"
|
||||||
|
-- define "_LARGEFILE64_SOURCE"
|
||||||
|
-- -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
|
||||||
|
end
|
||||||
|
|
||||||
|
if (usingClang or usingMSVC) then
|
||||||
|
defines "_AU_HAS_ATOMIC_INTRINS"
|
||||||
|
end
|
||||||
|
|
||||||
kind(projectType)
|
kind(projectType)
|
||||||
|
|
||||||
buildoptions {"-utf-8"}
|
buildoptions {"-utf-8"}
|
||||||
@ -92,6 +102,8 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root)
|
|||||||
if (_G.win32) then
|
if (_G.win32) then
|
||||||
characterset("MBCS")
|
characterset("MBCS")
|
||||||
staticruntime("Off")
|
staticruntime("Off")
|
||||||
|
|
||||||
|
defines "_CRT_SECURE_NO_WARNINGS"
|
||||||
end
|
end
|
||||||
|
|
||||||
objdir(getroot() .. "/Build_CompilerWorkingDirectory/" .. name)
|
objdir(getroot() .. "/Build_CompilerWorkingDirectory/" .. name)
|
||||||
@ -166,7 +178,7 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root)
|
|||||||
path .. "/**.c",
|
path .. "/**.c",
|
||||||
path .. "/**.cc",
|
path .. "/**.cc",
|
||||||
path .. "/**.h",
|
path .. "/**.h",
|
||||||
path .. "/**.masm"
|
path .. "/**.masm" -- explicitly required
|
||||||
}
|
}
|
||||||
end, root)
|
end, root)
|
||||||
end
|
end
|
||||||
|
106
Boilerplate/vala.lua
Normal file
106
Boilerplate/vala.lua
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
local function isWin32()
|
||||||
|
return os.is("Windows")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function findVala()
|
||||||
|
if (isWin32()) then
|
||||||
|
local drive = path.getdrive(getroot())
|
||||||
|
local localDriveClang = drive .. ":\\msys64\\clang64\\bin\\valac.exe"
|
||||||
|
local localDriveMingw = drive .. ":\\msys64\\mingw64\\bin\\valac.exe"
|
||||||
|
local localCClang = "C:\\msys64\\clang64\\bin\\valac.exe"
|
||||||
|
local localCMingw = "C:\\msys64\\mingw64\\bin\\valac.exe"
|
||||||
|
local auValac = _G["auValac"] or getroot() .. "\\Build_Scripts\\ValaWin32\\valac.exe"
|
||||||
|
if (os.isfile(auValac)) then return auValac end
|
||||||
|
if (os.isfile(localDriveClang)) then return localDriveClang end
|
||||||
|
if (os.isfile(localDriveMingw)) then return localDriveMingw end
|
||||||
|
if (os.isfile(localCClang)) then return localCClang end
|
||||||
|
if (os.isfile(localCMingw)) then return localCMingw end
|
||||||
|
else
|
||||||
|
return "vallac"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function addVala(extended)
|
||||||
|
local exec = findVala()
|
||||||
|
|
||||||
|
local args = ""
|
||||||
|
|
||||||
|
local function expandPartialRelDir(partial)
|
||||||
|
return os.realpath(partial) --path.translate(path.join(os.getcwd(), partial), path.getDefaultSeparator())
|
||||||
|
end
|
||||||
|
|
||||||
|
local function expandPartialNonExistsFile(partial)
|
||||||
|
return path.translate(path.join(os.getcwd(), partial), path.getDefaultSeparator())
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onGir(partial)
|
||||||
|
args = args .. " --girdir=\"" .. expandPartialRelDir(partial) .. "\""
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onVApi(partial)
|
||||||
|
args = args .. " --vapidir=\"" .. expandPartialRelDir(partial) .. "\""
|
||||||
|
end
|
||||||
|
|
||||||
|
forEach(extended.gir, onGir)
|
||||||
|
forEach(extended.vapi, onVApi)
|
||||||
|
|
||||||
|
if (extended.girFile) then
|
||||||
|
args = args .. " --gir=" .. extended.girFile
|
||||||
|
end
|
||||||
|
|
||||||
|
local myBrainHurts = false
|
||||||
|
|
||||||
|
local info = getProjectInfo(getCurrentProjectName())
|
||||||
|
if ((info.projectType:lower() == "sharedlib") or (extended.girFile)) then
|
||||||
|
args = args .. " --library=" .. (extended.name or info.name)
|
||||||
|
if (usingClang) then
|
||||||
|
visibility "Default"
|
||||||
|
else
|
||||||
|
args = args .. " --symbols=symbols.CIA"
|
||||||
|
myBrainHurts = true
|
||||||
|
linkoptions {"/def:\"" .. expandPartialNonExistsFile("symbols.def") .. "\""}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onPackage(pkg)
|
||||||
|
args = args .. " --pkg=" .. pkg
|
||||||
|
end
|
||||||
|
|
||||||
|
forEach(extended.package, onPackage)
|
||||||
|
|
||||||
|
args = args .. " --directory=\"" .. os.getcwd() .. "\""
|
||||||
|
|
||||||
|
args = args .. " --ccode"
|
||||||
|
|
||||||
|
if (extended.header) then
|
||||||
|
args = args .. " --header=\"" .. expandPartialNonExistsFile(extended.header) .. "\""
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onSourceFile(partial)
|
||||||
|
local path = expandPartialNonExistsFile(partial)
|
||||||
|
--print("vala source", path)
|
||||||
|
args = args .. " \"".. path .. "\""
|
||||||
|
|
||||||
|
local cfile = path:gsub("%.vala", "") .. ".c"
|
||||||
|
--print("vala c", cfile)
|
||||||
|
files(cfile)
|
||||||
|
if (usingMSVC) then
|
||||||
|
files(path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onSourcePattern(pattern)
|
||||||
|
forEach(os.matchfiles(pattern), onSourceFile)
|
||||||
|
end
|
||||||
|
|
||||||
|
forEach(extended.sources, onSourcePattern)
|
||||||
|
|
||||||
|
--print(exec, args)
|
||||||
|
addBuildAction("pre", "bin", exec, true, args)
|
||||||
|
|
||||||
|
if (myBrainHurts) then
|
||||||
|
addBuildAction("pre", "lua", path.translate(path.join(getroot(), "Build_Scripts", "Boilerplate", "valaSym2Def.lua"), path.getDefaultSeparator()), true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return addVala
|
26
Boilerplate/valaSym2Def.lua
Normal file
26
Boilerplate/valaSym2Def.lua
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
local cia = path.translate(path.join(build.projectRoot, "symbols.CIA"), path.getDefaultSeparator())
|
||||||
|
local def = path.translate(path.join(build.projectRoot, "symbols.def"), path.getDefaultSeparator())
|
||||||
|
|
||||||
|
print("Generating MSVC def file for scuffed gnome vala build", cia, def)
|
||||||
|
|
||||||
|
local ciaData = io.readfile(cia)
|
||||||
|
local exports = {}
|
||||||
|
for s in ciaData:gmatch("[^\r\n]+") do
|
||||||
|
table.insert(exports, s)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- so, we can't pull the target module name until we've actually built the binary
|
||||||
|
-- we'll just have to guess for now
|
||||||
|
local dllName = build.projectName .. "." .. build.platform .. "." .. build.architecture .. ".dll"
|
||||||
|
|
||||||
|
local buffer = ""
|
||||||
|
buffer = buffer .. "LIBRARY " .. dllName .. "\r\n"
|
||||||
|
buffer = buffer .. "EXPORTS"
|
||||||
|
|
||||||
|
local function processExport(export)
|
||||||
|
buffer = buffer .. "\r\n " .. export
|
||||||
|
end
|
||||||
|
|
||||||
|
forEach(exports, processExport)
|
||||||
|
|
||||||
|
io.writefile(def, buffer)
|
@ -23,99 +23,95 @@ print()
|
|||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
local target = require("platform")
|
local target = require("platform")
|
||||||
|
|
||||||
workspace "Aurora Project"
|
function startSolution(name)
|
||||||
configurations { "Debug", "Release", "Ship" }
|
|
||||||
|
|
||||||
platforms(target)
|
workspace(name)
|
||||||
architecture(target[1])
|
configurations { "Debug", "Release", "Ship" }
|
||||||
|
|
||||||
location(getroot() .. "/Build_CompilerWorkingDirectory/")
|
|
||||||
|
|
||||||
symbols "On"
|
|
||||||
staticruntime "On"
|
|
||||||
visibility "Hidden"
|
|
||||||
editandcontinue "Off"
|
|
||||||
|
|
||||||
flags
|
platforms(target)
|
||||||
{
|
architecture(target[1])
|
||||||
"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" }
|
|
||||||
optimize "Speed"
|
|
||||||
|
|
||||||
filter "configurations:Release"
|
|
||||||
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 {}
|
|
||||||
|
|
||||||
|
|
||||||
stringpooling "true"
|
|
||||||
floatingpoint "strict"
|
|
||||||
|
|
||||||
|
location(getroot() .. "/Build_CompilerWorkingDirectory/")
|
||||||
if ((not isWin) or (_G.forceClang)) then
|
|
||||||
usingClang = true
|
symbols "On"
|
||||||
toolset "clang"
|
staticruntime "On"
|
||||||
|
visibility "Hidden"
|
||||||
buildoptions {"-fms-extensions"}
|
editandcontinue "Off"
|
||||||
|
|
||||||
filter {"files:**.cpp or files:**.cc"}
|
flags
|
||||||
buildoptions {"-stdlib=libc++"}
|
{
|
||||||
filter {}
|
"NoPCH",
|
||||||
|
"MultiProcessorCompile"
|
||||||
disablewarnings
|
|
||||||
{
|
|
||||||
-- we live life on the edge
|
|
||||||
"unused-result",
|
|
||||||
-- warning: unused unused enumeration
|
|
||||||
"unused-value",
|
|
||||||
"unknown-warning-option"
|
|
||||||
}
|
}
|
||||||
elseif (isWin) then
|
|
||||||
usingMSVC = true
|
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" }
|
||||||
|
optimize "Speed"
|
||||||
|
|
||||||
|
filter "configurations:Release"
|
||||||
|
defines {"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 {}
|
||||||
|
|
||||||
|
|
||||||
|
stringpooling "true"
|
||||||
|
floatingpoint "strict"
|
||||||
|
|
||||||
disablewarnings
|
|
||||||
{
|
if ((not isWin) or (_G.forceClang)) then
|
||||||
"4996", -- The whiny C99 is no longer supported nag
|
usingClang = true
|
||||||
-- please needlessly use '_s' and '_'d functions __error__
|
toolset "clang"
|
||||||
-- fuck off
|
|
||||||
|
buildoptions {"-fms-extensions"}
|
||||||
"4251", -- MSVC's hurrdurr abis will break if you dynamically link classes
|
|
||||||
-- counter: fuck off again. we have full control of the build process, and we only link against
|
filter {"files:**.cpp or files:**.cc"}
|
||||||
-- dynamic c/stl runtimes. which brainlet thought this was a good idea?
|
buildoptions {"-stdlib=libc++"}
|
||||||
-- even microsofts docs dont state what is guaranteed to be safe.
|
filter {}
|
||||||
-- dont mix optimizations, cookie/security flags, and so on. rtti works so who cares
|
|
||||||
|
disablewarnings
|
||||||
|
{
|
||||||
|
-- we live life on the edge
|
||||||
|
"unused-result",
|
||||||
|
-- warning: unused unused enumeration
|
||||||
|
"unused-value",
|
||||||
|
"unknown-warning-option"
|
||||||
|
}
|
||||||
|
elseif (isWin) then
|
||||||
|
usingMSVC = true
|
||||||
|
|
||||||
|
disablewarnings
|
||||||
|
{
|
||||||
|
"4996", -- The whiny C99 is no longer supported nag
|
||||||
|
-- please needlessly use '_s' and '_'d functions __error__
|
||||||
|
|
||||||
|
|
||||||
|
"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
|
||||||
|
-- dynamic c/stl runtimes. which brainlet thought this was a good idea?
|
||||||
|
-- even microsofts own documentation dont state what is guaranteed to be safe.
|
||||||
|
-- dont mix optimizations, mitigation flags, and so on.
|
||||||
|
-- rtti works; the stl doesn't abuse inline/module specific globals; who cares?
|
||||||
|
|
||||||
|
"4244" -- conversion from 'double' to 'float', possible loss of data
|
||||||
|
-- this warning is extremely important; however, we're developing a game engine and utilities
|
||||||
|
-- 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
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
"4244" -- conversion from 'double' to 'float', possible loss of data
|
end
|
||||||
-- 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
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
if (usingClang or usingMSVC) then
|
|
||||||
defines "_AU_HAS_ATOMIC_INTRINS"
|
|
||||||
end
|
|
||||||
|
|
||||||
if (isWin) then
|
|
||||||
-- yeaaa, no
|
|
||||||
defines "_CRT_SECURE_NO_WARNINGS"
|
|
||||||
end
|
|
@ -1,73 +1,107 @@
|
|||||||
local feature = function()
|
local feature = function()
|
||||||
local readdPattern = function(pattern)
|
|
||||||
files (getProjectInfo(getCurrentProjectName()).path .. "/" .. pattern)
|
local excludeFiles = function(name, noFiles)
|
||||||
end
|
if (not noFiles) then
|
||||||
|
excludes("**/*" .. name .. ".masm")
|
||||||
local readd = function(name)
|
excludes("**/*" .. name .. ".*")
|
||||||
readdPattern("**/*" .. name .. ".cc")
|
|
||||||
readdPattern("**/*" .. name .. ".c")
|
|
||||||
readdPattern("**/*" .. name .. ".h")
|
|
||||||
readdPattern("**/*" .. name .. ".*pp")
|
|
||||||
readdPattern("**/*" .. name .. ".masm")
|
|
||||||
readdPattern("**/*" .. name .. ".inl")
|
|
||||||
end
|
|
||||||
|
|
||||||
if (_G["win32"]) then
|
|
||||||
if (_G["x86_64"]) then
|
|
||||||
readd "win64"
|
|
||||||
end
|
end
|
||||||
readd "win32"
|
excludes("**/" .. name .. "/**")
|
||||||
readd "windows"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["linux"]) then
|
if (not _G["win32"]) then
|
||||||
readd "linux"
|
if (not _G["x86_64"]) then
|
||||||
readd "unix"
|
excludeFiles "win64"
|
||||||
|
end
|
||||||
|
excludeFiles "win32"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not _G["win32"]) then
|
||||||
|
excludeFiles "windows"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not _G["xbox"]) then
|
||||||
|
excludeFiles "xbox"
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["android"]) then
|
if (not _G["uwp"]) then
|
||||||
readd "linux"
|
excludeFiles "uwp"
|
||||||
readd "android"
|
end
|
||||||
readd "unix"
|
|
||||||
|
if (not _G["win32"] and not _G["xbox"]) then
|
||||||
|
excludeFiles "nt"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not _G["android"]) then
|
||||||
|
excludeFiles "android"
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["mac"]) then
|
if (_G["mac"]) then
|
||||||
readd "macos"
|
excludeFiles "macos"
|
||||||
readd "mac"
|
|
||||||
readd "apple"
|
|
||||||
readd "unix"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["ios"]) then
|
local isNotApple = not _G["mac"]
|
||||||
readd "apple"
|
and not _G["ios"]
|
||||||
readd "ios"
|
|
||||||
|
local isNotBsd = not _G["bsd"]
|
||||||
|
and not _G["ps4"]
|
||||||
|
and not _G["ps5"]
|
||||||
|
and isNotApple
|
||||||
|
|
||||||
|
if (not isNotBsd) then
|
||||||
|
excludeFiles "bsd"
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["x86_64"]) then
|
if (isNotApple) then
|
||||||
readd "x64"
|
excludeFiles "apple"
|
||||||
readd "x86_64"
|
excludeFiles "xnu"
|
||||||
readd "amd64"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["x86_32"]) then
|
if (not _G["mac"]) then
|
||||||
readdPattern "**/x86/**"
|
excludeFiles "osx"
|
||||||
readdPattern "**/x86/**.c"
|
|
||||||
readdPattern "**/x86/**.h"
|
|
||||||
readdPattern "**/x86/**.*pp"
|
|
||||||
readdPattern "**/x86/**.masm"
|
|
||||||
readdPattern "**/x86/**.inl"
|
|
||||||
readdPattern "**/x86/**.cpp"
|
|
||||||
readdPattern "**/*.x86.*pp"
|
|
||||||
readd "x86_32"
|
|
||||||
readd "intel"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_G["arm"]) then
|
local isNotLinux = not _G["linux"]
|
||||||
readd "arm"
|
and not _G["android"]
|
||||||
readd "aarch64"
|
|
||||||
readd "aarch"
|
if (isNotBsd and isNotLinux) then
|
||||||
|
excludeFiles "unix"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (isNotLinux) then
|
||||||
|
excludeFiles "linux"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not _G["x86_64"]) then
|
||||||
|
excludeFiles "x64"
|
||||||
|
excludeFiles "x86_64"
|
||||||
|
excludeFiles "amd64"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not _G["x86_32"]) then
|
||||||
|
excludes "**/x86/**"
|
||||||
|
excludes "**/x86/**.c"
|
||||||
|
excludes "**/x86/**.h"
|
||||||
|
excludes "**/x86/**.*pp"
|
||||||
|
excludes "**/x86/**.masm"
|
||||||
|
excludes "**/x86/**.inl"
|
||||||
|
excludes "**/x86/**.cpp"
|
||||||
|
excludes "**/*.x86.*pp"
|
||||||
|
excludeFiles "x86_32"
|
||||||
|
excludeFiles "intel"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not _G["arm"]) then
|
||||||
|
excludeFiles ("arm", true)
|
||||||
|
excludeFiles "aarch64"
|
||||||
|
excludeFiles "aarch"
|
||||||
|
end
|
||||||
|
|
||||||
|
excludeFiles "mips"
|
||||||
|
excludeFiles "mips64"
|
||||||
|
excludeFiles "amiga"
|
||||||
|
excludeFiles "powerpc"
|
||||||
|
excludeFiles "riscv"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return feature
|
return feature
|
36
Utils/base64.lua
Normal file
36
Utils/base64.lua
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -- You will need this for encoding/decoding
|
||||||
|
-- encoding
|
||||||
|
local function enc(data)
|
||||||
|
return ((data:gsub('.', function(x)
|
||||||
|
local r,b='',x:byte()
|
||||||
|
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
|
||||||
|
return r;
|
||||||
|
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
|
||||||
|
if (#x < 6) then return '' end
|
||||||
|
local c=0
|
||||||
|
for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
|
||||||
|
return b:sub(c+1,c+1)
|
||||||
|
end)..({ '', '==', '=' })[#data%3+1])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- decoding
|
||||||
|
local function dec(data)
|
||||||
|
data = string.gsub(data, '[^'..b..'=]', '')
|
||||||
|
return (data:gsub('.', function(x)
|
||||||
|
if (x == '=') then return '' end
|
||||||
|
local r,f='',(b:find(x)-1)
|
||||||
|
for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
|
||||||
|
return r;
|
||||||
|
end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
|
||||||
|
if (#x ~= 8) then return '' end
|
||||||
|
local c=0
|
||||||
|
for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
|
||||||
|
return string.char(c)
|
||||||
|
end))
|
||||||
|
end
|
||||||
|
|
||||||
|
_G["base64"] =
|
||||||
|
{
|
||||||
|
encode = enc,
|
||||||
|
decode = dec
|
||||||
|
}
|
10
Utils/concatArrays.lua
Normal file
10
Utils/concatArrays.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
function concatArrays(...)
|
||||||
|
local ret = {}
|
||||||
|
|
||||||
|
local args = table.pack(...)
|
||||||
|
for i=1,args.n do
|
||||||
|
local tbl = args[i]
|
||||||
|
forEach(tbl, function(re) table.insert(ret, re) end)
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
8
Utils/requireAbs.lua
Normal file
8
Utils/requireAbs.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function requireAbs(path)
|
||||||
|
local absRefPath = os.realpath(getroot() .. "/Build_Scripts/")
|
||||||
|
local relPath = _G.path.getrelative(absRefPath, path)
|
||||||
|
if (os.isfile(relPath)) then
|
||||||
|
fatal("Script not found: ", relPath)
|
||||||
|
end
|
||||||
|
return require(relPath:sub(1, #relPath - 4))
|
||||||
|
end
|
@ -5,4 +5,7 @@ require("userRequire")
|
|||||||
require("lookupCmdArgs")
|
require("lookupCmdArgs")
|
||||||
require("fatal")
|
require("fatal")
|
||||||
require("eval")
|
require("eval")
|
||||||
require("isArray")
|
require("isArray")
|
||||||
|
require("concatArrays")
|
||||||
|
require("base64")
|
||||||
|
require("requireAbs")
|
74
aurora.lua
74
aurora.lua
@ -53,15 +53,6 @@ local extendInfo = function(this)
|
|||||||
this.isWindowed = type == "windowedapp"
|
this.isWindowed = type == "windowedapp"
|
||||||
end
|
end
|
||||||
|
|
||||||
local requireAbs = function(path)
|
|
||||||
local absRefPath = os.realpath(getroot() .. "/Build_Scripts/")
|
|
||||||
local relPath = _G.path.getrelative(absRefPath, path)
|
|
||||||
if (os.isfile(relPath)) then
|
|
||||||
fatal("Script not found: ", relPath)
|
|
||||||
end
|
|
||||||
return require(relPath:sub(1, #relPath - 4))
|
|
||||||
end
|
|
||||||
|
|
||||||
function addVisit(ina)
|
function addVisit(ina)
|
||||||
local args = {
|
local args = {
|
||||||
namespace = ina.namespace,
|
namespace = ina.namespace,
|
||||||
@ -382,6 +373,71 @@ function getCurrentProjectName()
|
|||||||
return current_project
|
return current_project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function importAndLinkProject(dep, soft)
|
||||||
|
local proj = _G["projectsprocessor"][dep]
|
||||||
|
if (not proj) then
|
||||||
|
if (soft) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
fatal("Missing project", dep)
|
||||||
|
end
|
||||||
|
|
||||||
|
local iface = proj.processor
|
||||||
|
if (not isProjectLoaded(dep)) then
|
||||||
|
if (soft) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
fatal("missing project: ", dep)
|
||||||
|
end
|
||||||
|
|
||||||
|
iface:handleReference()
|
||||||
|
iface:handleLink()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function includeAuProject(dep, soft)
|
||||||
|
local proj = _G["projectsprocessor"][dep]
|
||||||
|
if (not proj) then
|
||||||
|
if (soft) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
fatal("Missing project", dep)
|
||||||
|
end
|
||||||
|
|
||||||
|
local iface = proj.processor
|
||||||
|
if (not isProjectLoaded(dep)) then
|
||||||
|
if (soft) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
fatal("missing project: ", dep)
|
||||||
|
end
|
||||||
|
|
||||||
|
iface:handleReference()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function linkAuProject(dep, soft)
|
||||||
|
local proj = _G["projectsprocessor"][dep]
|
||||||
|
if (not proj) then
|
||||||
|
if (soft) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
fatal("Missing project", dep)
|
||||||
|
end
|
||||||
|
|
||||||
|
local iface = proj.processor
|
||||||
|
if (not isProjectLoaded(dep)) then
|
||||||
|
if (soft) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
fatal("missing project: ", dep)
|
||||||
|
end
|
||||||
|
|
||||||
|
iface:handleLink()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- private
|
-- private
|
||||||
local buildAction = require("Actions.buildAction")
|
local buildAction = require("Actions.buildAction")
|
||||||
-- executes inline under iprocessor::process
|
-- executes inline under iprocessor::process
|
||||||
|
Loading…
Reference in New Issue
Block a user