Build/Boilerplate/buildPostProcess.lua
Reece 615bcb53b9 Initial commit
Publish a collection of boilerplate and an additional json parser.
This meta build chain as-is should replace a lot of the premake5.lua in the AuroraEngine repo
2021-05-20 13:56:44 +01:00

59 lines
2.1 KiB
Lua

local commonFmt = function(name, type, dir, ex, iswin, buildcfg, realName)
local stringPrefix = "";
if iswin then
stringPrefix = "*\"";
else
stringPrefix = "\"";
end
local targetName = string.format("%s.%s.%%{cfg.system}.%%{cfg.architecture}", realName, buildcfg)
local unixName = string.format("%s.%s.%%{cfg.system}.%%{cfg.architecture}", name, buildcfg)
-- ok, shut up. this was an after thought
-- modules were dynamically loaded in scriptability
targetname(targetName)
local outputPath = string.format("%s/%s%s", dir, unixName, ex)
local uglyBuildPath = string.format("%%{cfg.targetdir}/%s%s", unixName, ex)
-- really dont ask what this was for
_G.hack_outputpath = outputPath;
_G.hack_buildoutpath = uglyBuildPath;
--
local fmt = string.format("{COPY} \"%s\" \"%s%s", uglyBuildPath, outputPath, stringPrefix);
return fmt;
end
local LonixFmt1 = function(name, type, dir, ex)
return string.format("mkdir -p \"%s\"", dir);
end
local postBuildCmdsCopyWindows = function(name, type, cfgHack, dir)
if (type == "SharedLib") then
postbuildcommands({commonFmt(name, type, dir, ".dll", true, cfgHack:lower(), name)})
elseif (
(type == "WindowedApp") or
(type == "ConsoleApp")
) then
postbuildcommands({commonFmt(name, type, dir, ".exe", true, cfgHack:lower(), name)})
end
end
local postBuildCmdsCopyLinux = function(name, type, cfgHack, dir)
if (type == "SharedLib") then
postbuildcommands({LonixFmt1("lib" .. name, type, dir, "")})
postbuildcommands({commonFmt("lib" .. name, type, dir, ".so", false, cfgHack:lower(), name)})
elseif (
(type == "WindowedApp") or
(type == "ConsoleApp")
) then
postbuildcommands({LonixFmt1(name, type, dir, "")})
postbuildcommands({commonFmt(name, type, dir, "", false, cfgHack:lower(), name)})
end
end
local handlers = {};
handlers["target-win32"] = postBuildCmdsCopyWindows;
handlers["target-linux"] = postBuildCmdsCopyLinux;
return require("Utils/lookupCmdArgs")(handlers);