diff --git a/Actions/buildAction.lua b/Actions/buildAction.lua index 9ea5498..ca50d25 100644 --- a/Actions/buildAction.lua +++ b/Actions/buildAction.lua @@ -39,7 +39,7 @@ local getPremakeExec = function() return premake_exe end -local addBuildCommand = function(when, scriptType, path, cwdRelToProject) +local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args) local scriptPath = path local cwd = getroot() @@ -49,13 +49,14 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject) command = "call " end + local cur = getProjectInfo(getCurrentProjectName()) command = command .. getPremakeExec() 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_platform=\"%{cfg.system}\"" - local cur = getProjectInfo(getCurrentProjectName()) if (cwdRelToProject) then command = command .. " --actualcwd=\"" .. cur.path .. "\"" else @@ -74,10 +75,23 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject) command = command .. postBuildSuffix end + local cliArgs = "" + local argsEscaped = "" + if (args) then + argsEscaped = args:gsub("\"", "\\\"") + cliArgs = " " .. argsEscaped + end + 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 - command = command .. " --binscript=\"" .. path .. "\"" + command = command .. " --binscript=\"" .. path .. cliArgs .. "\"" end --command = command:gsub("\\","\\\\") diff --git a/Actions/buildActionBootstrap.lua b/Actions/buildActionBootstrap.lua index 4c88307..4ad00c8 100644 --- a/Actions/buildActionBootstrap.lua +++ b/Actions/buildActionBootstrap.lua @@ -54,6 +54,17 @@ newoption description = "" } +newoption +{ + trigger = "additional", + description = "" +} + +newoption +{ + trigger = "luaabsscript", + description = "" +} local cwd =_OPTIONS["actualcwd"] if (cwd) then @@ -73,12 +84,16 @@ _G["build"] = architecture = _OPTIONS["project_arch"], projectName = _OPTIONS["project_name"], projectRoot = _OPTIONS["project_root"], + args = base64.decode(_OPTIONS["additional"]), root = _overloadRoot } local luaScript = _OPTIONS["luascript"] +local luaAbsScript = _OPTIONS["luaabsscript"] if (luaScript) then - require(os.realpath(build.root .. "/Build_UserScripts/" .. luaScript)) -end + requireAbs(os.realpath(build.root .. "/Build_UserScripts/" .. luaScript)) +elseif (luaAbsScript) then + requireAbs(luaAbsScript) +end os.exit() \ No newline at end of file diff --git a/Boilerplate/jsonProcessor.lua b/Boilerplate/jsonProcessor.lua index f73e2fe..4b46f88 100644 --- a/Boilerplate/jsonProcessor.lua +++ b/Boilerplate/jsonProcessor.lua @@ -1,4 +1,5 @@ local auProject = require("project") +local valaGo = require("vala") function JsonProcessor(info) local result, err = json.decode(io.readfile(info.jpath)) @@ -13,7 +14,6 @@ function JsonProcessor(info) end local translateDep = function(this, dep) - if (this.info.translations) then local override = this.info.translations[dep] if (override) then @@ -235,7 +235,7 @@ function JsonProcessor(info) handleInclude(this, false) - defines(("_auhas_" .. this.result.name):upper() .. "=1") + defines(("_auhas_" .. this.result.name):upper():gsub("%-", "_") .. "=1") end local handleDependsPreemptive = function(dep, this, soft, resolve) @@ -418,6 +418,30 @@ function JsonProcessor(info) forEach(result.staticImpDefines, defines) 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 end diff --git a/Boilerplate/platform.lua b/Boilerplate/platform.lua index 25aba48..ba45057 100644 --- a/Boilerplate/platform.lua +++ b/Boilerplate/platform.lua @@ -1,5 +1,5 @@ local archMap = {}; ---archMap["target-x86_32"] = "x86_32" unsupported +archMap["target-x86_32"] = "x32" archMap["target-x86_64"] = "x86_64" archMap["target-aarch"] = "ARM64" --archMap["target-arm"] = "ARM" unsupported diff --git a/Boilerplate/preprocessors.lua b/Boilerplate/preprocessors.lua index 6b645d8..8a3be06 100644 --- a/Boilerplate/preprocessors.lua +++ b/Boilerplate/preprocessors.lua @@ -1,9 +1,13 @@ local triggerPairs = {} -triggerPairs["target-win32"] = "_WIN32_AURORA_PREPROCESSOR" -triggerPairs["target-linux"] = "_LINUX_AURORA_PREPROCESSOR" -triggerPairs["target-switch"] = "_SWITCH_AURORA_PREPROCESSOR" -triggerPairs["target-ps4"] = "_PS4_AURORA_PREPROCESSOR" -triggerPairs["target-ps5"] = "_PS5_AURORA_PREPROCESSOR" +triggerPairs["target-win32"] = "_WIN32_AURORA_PREPROCESSOR" +triggerPairs["target-linux"] = "_LINUX_AURORA_PREPROCESSOR" +triggerPairs["target-switch"] = "_SWITCH_AURORA_PREPROCESSOR" +triggerPairs["target-ps4"] = "_PS4_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" local userPaths = userRequire("preprocessors") diff --git a/Boilerplate/project.lua b/Boilerplate/project.lua index f21ad60..4c9b985 100644 --- a/Boilerplate/project.lua +++ b/Boilerplate/project.lua @@ -67,6 +67,16 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root) filter {} 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) buildoptions {"-utf-8"} @@ -92,6 +102,8 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root) if (_G.win32) then characterset("MBCS") staticruntime("Off") + + defines "_CRT_SECURE_NO_WARNINGS" end objdir(getroot() .. "/Build_CompilerWorkingDirectory/" .. name) @@ -166,7 +178,7 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root) path .. "/**.c", path .. "/**.cc", path .. "/**.h", - path .. "/**.masm" + path .. "/**.masm" -- explicitly required } end, root) end diff --git a/Boilerplate/vala.lua b/Boilerplate/vala.lua new file mode 100644 index 0000000..06b6dd8 --- /dev/null +++ b/Boilerplate/vala.lua @@ -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 \ No newline at end of file diff --git a/Boilerplate/valaSym2Def.lua b/Boilerplate/valaSym2Def.lua new file mode 100644 index 0000000..0a0870a --- /dev/null +++ b/Boilerplate/valaSym2Def.lua @@ -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) \ No newline at end of file diff --git a/Boilerplate/workspace.lua b/Boilerplate/workspace.lua index 8b0e2d8..8cf4e73 100644 --- a/Boilerplate/workspace.lua +++ b/Boilerplate/workspace.lua @@ -23,99 +23,95 @@ print() ------------------------------------------------------- local target = require("platform") -workspace "Aurora Project" - configurations { "Debug", "Release", "Ship" } +function startSolution(name) - platforms(target) - architecture(target[1]) - - location(getroot() .. "/Build_CompilerWorkingDirectory/") - - symbols "On" - staticruntime "On" - visibility "Hidden" - editandcontinue "Off" + workspace(name) + configurations { "Debug", "Release", "Ship" } - flags - { - "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" + platforms(target) + architecture(target[1]) - - if ((not isWin) or (_G.forceClang)) then - usingClang = true - toolset "clang" - - buildoptions {"-fms-extensions"} - - filter {"files:**.cpp or files:**.cc"} - buildoptions {"-stdlib=libc++"} - filter {} - - disablewarnings - { - -- we live life on the edge - "unused-result", - -- warning: unused unused enumeration - "unused-value", - "unknown-warning-option" + location(getroot() .. "/Build_CompilerWorkingDirectory/") + + symbols "On" + staticruntime "On" + visibility "Hidden" + editandcontinue "Off" + + flags + { + "NoPCH", + "MultiProcessorCompile" } - 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 - { - "4996", -- The whiny C99 is no longer supported nag - -- please needlessly use '_s' and '_'d functions __error__ - -- fuck off - - "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 - -- dynamic c/stl runtimes. which brainlet thought this was a good idea? - -- 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 + + if ((not isWin) or (_G.forceClang)) then + usingClang = true + toolset "clang" + + buildoptions {"-fms-extensions"} + + filter {"files:**.cpp or files:**.cc"} + buildoptions {"-stdlib=libc++"} + filter {} + + 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 - -- 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 \ No newline at end of file +end \ No newline at end of file diff --git a/Features/guess-platform-code.lua b/Features/guess-platform-code.lua index bb7f37c..3cb5984 100644 --- a/Features/guess-platform-code.lua +++ b/Features/guess-platform-code.lua @@ -1,73 +1,107 @@ local feature = function() - local readdPattern = function(pattern) - files (getProjectInfo(getCurrentProjectName()).path .. "/" .. pattern) - end - - local readd = function(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" + + local excludeFiles = function(name, noFiles) + if (not noFiles) then + excludes("**/*" .. name .. ".masm") + excludes("**/*" .. name .. ".*") end - readd "win32" - readd "windows" + excludes("**/" .. name .. "/**") end - if (_G["linux"]) then - readd "linux" - readd "unix" + if (not _G["win32"]) then + if (not _G["x86_64"]) then + excludeFiles "win64" + end + excludeFiles "win32" + end + + if (not _G["win32"]) then + excludeFiles "windows" + end + + if (not _G["xbox"]) then + excludeFiles "xbox" end - if (_G["android"]) then - readd "linux" - readd "android" - readd "unix" + if (not _G["uwp"]) then + excludeFiles "uwp" + end + + if (not _G["win32"] and not _G["xbox"]) then + excludeFiles "nt" + end + + if (not _G["android"]) then + excludeFiles "android" end if (_G["mac"]) then - readd "macos" - readd "mac" - readd "apple" - readd "unix" + excludeFiles "macos" end - if (_G["ios"]) then - readd "apple" - readd "ios" + local isNotApple = not _G["mac"] + and not _G["ios"] + + local isNotBsd = not _G["bsd"] + and not _G["ps4"] + and not _G["ps5"] + and isNotApple + + if (not isNotBsd) then + excludeFiles "bsd" end - if (_G["x86_64"]) then - readd "x64" - readd "x86_64" - readd "amd64" + if (isNotApple) then + excludeFiles "apple" + excludeFiles "xnu" end - if (_G["x86_32"]) then - readdPattern "**/x86/**" - 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" + if (not _G["mac"]) then + excludeFiles "osx" end - if (_G["arm"]) then - readd "arm" - readd "aarch64" - readd "aarch" + local isNotLinux = not _G["linux"] + and not _G["android"] + + if (isNotBsd and isNotLinux) then + excludeFiles "unix" 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 return feature \ No newline at end of file diff --git a/Utils/base64.lua b/Utils/base64.lua new file mode 100644 index 0000000..d465a4a --- /dev/null +++ b/Utils/base64.lua @@ -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 +} diff --git a/Utils/concatArrays.lua b/Utils/concatArrays.lua new file mode 100644 index 0000000..d3d7bcf --- /dev/null +++ b/Utils/concatArrays.lua @@ -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 \ No newline at end of file diff --git a/Utils/requireAbs.lua b/Utils/requireAbs.lua new file mode 100644 index 0000000..7818aa2 --- /dev/null +++ b/Utils/requireAbs.lua @@ -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 \ No newline at end of file diff --git a/Utils/utils.lua b/Utils/utils.lua index 5272e61..1edf366 100644 --- a/Utils/utils.lua +++ b/Utils/utils.lua @@ -5,4 +5,7 @@ require("userRequire") require("lookupCmdArgs") require("fatal") require("eval") -require("isArray") \ No newline at end of file +require("isArray") +require("concatArrays") +require("base64") +require("requireAbs") \ No newline at end of file diff --git a/aurora.lua b/aurora.lua index 9fd5fff..a5f71d1 100644 --- a/aurora.lua +++ b/aurora.lua @@ -53,15 +53,6 @@ local extendInfo = function(this) this.isWindowed = type == "windowedapp" 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) local args = { namespace = ina.namespace, @@ -382,6 +373,71 @@ function getCurrentProjectName() return current_project 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 local buildAction = require("Actions.buildAction") -- executes inline under iprocessor::process