diff options
Diffstat (limited to '3rdparty/genie/src/_premake_main.lua')
-rw-r--r-- | 3rdparty/genie/src/_premake_main.lua | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/3rdparty/genie/src/_premake_main.lua b/3rdparty/genie/src/_premake_main.lua index fb3d4a89a3d..a48f2cf6fe7 100644 --- a/3rdparty/genie/src/_premake_main.lua +++ b/3rdparty/genie/src/_premake_main.lua @@ -16,28 +16,28 @@ local function injectplatform(platform) if not platform then return true end platform = premake.checkvalue(platform, premake.fields.platforms.allowed) - + for sln in premake.solution.each() do local platforms = sln.platforms or { } - + -- an empty table is equivalent to a native build if #platforms == 0 then table.insert(platforms, "Native") end - + -- the solution must provide a native build in order to support this feature if not table.contains(platforms, "Native") then return false, sln.name .. " does not target native platform\nNative platform settings are required for the --platform feature." end - + -- add it to the end of the list, if it isn't in there already if not table.contains(platforms, platform) then table.insert(platforms, platform) end - + sln.platforms = platforms end - + return true end @@ -46,22 +46,22 @@ -- function _premake_main(scriptpath) - - -- if running off the disk (in debug mode), load everything + + -- if running off the disk (in debug mode), load everything -- listed in _manifest.lua; the list divisions make sure -- everything gets initialized in the proper order. - + if (scriptpath) then local scripts = dofile(scriptpath .. "/_manifest.lua") for _,v in ipairs(scripts) do dofile(scriptpath .. "/" .. v) end end - + -- Now that the scripts are loaded, I can use path.getabsolute() to properly -- canonicalize the executable path. - + _PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND) @@ -70,15 +70,15 @@ premake.action.set(_ACTION) - + -- Seed the random number generator so actions don't have to do it themselves - + math.randomseed(os.time()) - - + + -- If there is a project script available, run it to get the -- project information, available options and actions, etc. - + if (nil ~= _OPTIONS["file"]) then local fname = _OPTIONS["file"] @@ -96,10 +96,10 @@ end -- Process special options - + if (_OPTIONS["version"] or _OPTIONS["help"] or not _ACTION) then printf("GENie - Project generator tool %s", _GENIE_VERSION_STR) - printf("https://github.com/bkaradzic/genie") + printf("https://github.com/bkaradzic/GENie") if (not _OPTIONS["version"]) then premake.showhelp() end @@ -108,7 +108,7 @@ -- Validate the command-line arguments. This has to happen after the -- script has run to allow for project-specific options - + action = premake.action.current() if (not action) then error("Error: no such action '" .. _ACTION .. "'", 0) @@ -116,28 +116,42 @@ ok, err = premake.option.validate(_OPTIONS) if (not ok) then error("Error: " .. err, 0) end - + -- Sanity check the current project setup ok, err = premake.checktools() if (not ok) then error("Error: " .. err, 0) end - - + + -- If a platform was specified on the command line, inject it now ok, err = injectplatform(_OPTIONS["platform"]) if (not ok) then error("Error: " .. err, 0) end - + local profiler = newProfiler() + if (nil ~= _OPTIONS["debug-profiler"]) then + profiler:start() + end + -- work-in-progress: build the configurations print("Building configurations...") premake.bake.buildconfigs() - + + if (nil ~= _OPTIONS["debug-profiler"]) then + profiler:stop() + + local filePath = path.getabsolute("GENie-profiler-bake.txt") + print("Writing debug-profiler report " .. filePath .. ".") + + local outfile = io.open(filePath, "w+") + profiler:report(outfile) + outfile:close() + end + ok, err = premake.checkprojects() if (not ok) then error("Error: " .. err, 0) end - - + -- Hand over control to the action printf("Running action '%s'...", action.trigger) premake.action.call(action.trigger) @@ -146,4 +160,3 @@ return 0 end - |