mirror of
https://github.com/holub/mame
synced 2025-04-26 02:07:14 +03:00
put back some genie code (nw)
This commit is contained in:
parent
7099d6eaa2
commit
deac5db4db
11
3rdparty/genie/src/_premake_main.lua
vendored
11
3rdparty/genie/src/_premake_main.lua
vendored
@ -4,6 +4,7 @@
|
||||
-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
_WORKING_DIR = os.getcwd()
|
||||
|
||||
|
||||
@ -151,19 +152,11 @@
|
||||
ok, err = premake.checkprojects()
|
||||
if (not ok) then error("Error: " .. err, 0) end
|
||||
|
||||
premake.stats = { }
|
||||
|
||||
premake.stats.num_generated = 0
|
||||
premake.stats.num_skipped = 0
|
||||
|
||||
-- Hand over control to the action
|
||||
printf("Running action '%s'...", action.trigger)
|
||||
premake.action.call(action.trigger)
|
||||
|
||||
printf("Done. Generated %d/%d projects."
|
||||
, premake.stats.num_generated
|
||||
, premake.stats.num_generated+premake.stats.num_skipped
|
||||
)
|
||||
print("Done.")
|
||||
return 0
|
||||
|
||||
end
|
||||
|
40
3rdparty/genie/src/base/premake.lua
vendored
40
3rdparty/genie/src/base/premake.lua
vendored
@ -22,46 +22,18 @@
|
||||
|
||||
function premake.generate(obj, filename, callback)
|
||||
filename = premake.project.getfilename(obj, filename)
|
||||
printf("Generating %s...", filename)
|
||||
|
||||
io.capture()
|
||||
callback(obj)
|
||||
local new = io.endcapture()
|
||||
|
||||
local delta = false
|
||||
|
||||
local f, err = io.open(filename, "rb")
|
||||
local f, err = io.open(filename, "wb")
|
||||
if (not f) then
|
||||
if string.find(err, "No such file or directory") then
|
||||
delta = true
|
||||
else
|
||||
error(err, 0)
|
||||
end
|
||||
else
|
||||
local existing = f:read("*all")
|
||||
if existing ~= new then
|
||||
delta = true
|
||||
end
|
||||
f:close()
|
||||
error(err, 0)
|
||||
end
|
||||
|
||||
if delta then
|
||||
printf("Generating %s...", filename)
|
||||
local f, err = io.open(filename, "wb")
|
||||
if (not f) then
|
||||
error(err, 0)
|
||||
end
|
||||
|
||||
f:write(new)
|
||||
f:close()
|
||||
|
||||
premake.stats.num_generated = premake.stats.num_generated + 1
|
||||
else
|
||||
-- printf("Skipping %s as its contents would not change.", filename)
|
||||
premake.stats.num_skipped = premake.stats.num_skipped + 1
|
||||
end
|
||||
io.output(f)
|
||||
callback(obj)
|
||||
f:close()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Finds a valid premake build file in the specified directory
|
||||
-- Used by both the main genie process, and include commands
|
||||
|
5
3rdparty/genie/src/host/scripts.c
vendored
5
3rdparty/genie/src/host/scripts.c
vendored
@ -171,8 +171,7 @@ const char* builtin_scripts[] = {
|
||||
"function premake.showhelp()\nprintf(\"\")\nprintf(\"Usage: genie [options] action [arguments]\")\nprintf(\"\")\nprintf(\"OPTIONS\")\nprintf(\"\")\nfor option in premake.option.each() do\nlocal trigger = option.trigger\nlocal description = option.description\nif (option.value) then trigger = trigger .. \"=\" .. option.value end\nif (option.allowed) then description = description .. \"; one of:\" end\nprintf(\" --%-15s %s\", trigger, description)\nif (option.allowed) then\nfor _, value in ipairs(option.allowed) do\nprintf(\" %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor action in premake.action.each() do\nprintf(\" %-17s %s\", action.trigger, action.description)\nend\nprintf(\"\")\nprintf(\"For additional information, see https://github.com/bkaradzic/genie\")\nend\n",
|
||||
|
||||
/* base/premake.lua */
|
||||
"premake._filelevelconfig = false\nfunction premake.generate(obj, filename, callback)\nfilename = premake.project.getfilename(obj, filename)\nio.capture()\ncallback(obj)\nlocal new = io.endcapture()\nlocal delta = false\nlocal f, err = io.open(filename, \"rb\")\nif (not f) then\nif string.find(err, \"No such file or directory\") then\ndelta = true\nelse\nerror(err, 0)\nend\nelse\nlocal existing = f:read(\"*all\")\nif existing ~= new then\ndelta = true\nend\nf:close()\nend\nif delta then\nprintf(\"Generating %s...\", filename)\nlocal f, err = io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nf:write(new)\nf:close()\npremake.stats.num_generated = premake.stats.num_generated + 1\nelse\npremake.stats.num_skipped = premake.stats.num_skipped + 1\nend\nend\nfunction premake.findDefaultScript(dir, search_upwards)\nsearch_upwards = search_upwards or true\nlocal last = \"\"\nwhile dir ~= last do\nfor _, name in ipairs({ \"genie.lua\", \"solution.lua\", \"premake4.lua\" }) do\nlocal script0 = dir .. \"/\" .."
|
||||
" name\nif (os.isfile(script0)) then\nreturn dir, name\nend\nlocal script1 = dir .. \"/scripts/\" .. name\nif (os.isfile(script1)) then\nreturn dir .. \"/scripts/\", name\nend\nend\nlast = dir\ndir = path.getabsolute(dir .. \"/..\")\nif dir == \".\" or not search_upwards then break end\nend\nreturn nil, nil\nend\n",
|
||||
"premake._filelevelconfig = false\nfunction premake.generate(obj, filename, callback)\nfilename = premake.project.getfilename(obj, filename)\nprintf(\"Generating %s...\", filename)\nlocal f, err = io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nio.output(f)\ncallback(obj)\nf:close()\nend\nfunction premake.findDefaultScript(dir, search_upwards)\nsearch_upwards = search_upwards or true\nlocal last = \"\"\nwhile dir ~= last do\nfor _, name in ipairs({ \"genie.lua\", \"solution.lua\", \"premake4.lua\" }) do\nlocal script0 = dir .. \"/\" .. name\nif (os.isfile(script0)) then\nreturn dir, name\nend\nlocal script1 = dir .. \"/scripts/\" .. name\nif (os.isfile(script1)) then\nreturn dir .. \"/scripts/\", name\nend\nend\nlast = dir\ndir = path.getabsolute(dir .. \"/..\")\nif dir == \".\" or not search_upwards then break end\nend\nreturn nil, nil\nend\n",
|
||||
|
||||
/* base/iter.lua */
|
||||
"iter = {}\nfunction iter.sortByKeys(arr, f)\nlocal a = table.keys(arr)\ntable.sort(a, f)\nlocal i = 0\nreturn function()\ni = i + 1\nif a[i] ~= nil then \nreturn a[i], arr[a[i]]\nend\nend\nend\n",
|
||||
@ -454,7 +453,7 @@ const char* builtin_scripts[] = {
|
||||
/* _premake_main.lua */
|
||||
"_WORKING_DIR = os.getcwd()\nlocal function injectplatform(platform)\nif not platform then return true end\nplatform = premake.checkvalue(platform, premake.fields.platforms.allowed)\nfor sln in premake.solution.each() do\nlocal platforms = sln.platforms or { }\nif #platforms == 0 then\ntable.insert(platforms, \"Native\")\nend\nif not table.contains(platforms, \"Native\") then\nreturn false, sln.name .. \" does not target native platform\\nNative platform settings are required for the --platform feature.\"\nend\nif not table.contains(platforms, platform) then\ntable.insert(platforms, platform)\nend\nsln.platforms = platforms\nend\nreturn true\nend\nfunction _premake_main(scriptpath)\nif (scriptpath) then\nlocal scripts = dofile(scriptpath .. \"/_manifest.lua\")\nfor _,v in ipairs(scripts) do\ndofile(scriptpath .. \"/\" .. v)\nend\nend\n_PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND)\npremake.action.set(_ACTION)\nmath.randomseed(os.time())\nif (nil ~= _OPTIONS[\"file\"]) then\nlocal fname = _OPTIONS"
|
||||
"[\"file\"]\nif (os.isfile(fname)) then\ndofile(fname)\nelse\nerror(\"No genie script '\" .. fname .. \"' found!\", 2)\nend\nelse\nlocal dir, name = premake.findDefaultScript(path.getabsolute(\"./\"))\nif dir ~= nil then\nos.chdir(dir)\ndofile(name)\nend\nend\nif (_OPTIONS[\"version\"] or _OPTIONS[\"help\"] or not _ACTION) then\nprintf(\"GENie - Project generator tool %s\", _GENIE_VERSION_STR)\nprintf(\"https://github.com/bkaradzic/GENie\")\nif (not _OPTIONS[\"version\"]) then\npremake.showhelp()\nend\nreturn 1\nend\naction = premake.action.current()\nif (not action) then\nerror(\"Error: no such action '\" .. _ACTION .. \"'\", 0)\nend\nok, err = premake.option.validate(_OPTIONS)\nif (not ok) then error(\"Error: \" .. err, 0) end\nok, err = premake.checktools()\nif (not ok) then error(\"Error: \" .. err, 0) end\nok, err = injectplatform(_OPTIONS[\"platform\"])\nif (not ok) then error(\"Error: \" .. err, 0) end\nlocal profiler = newProfiler()\nif (nil ~= _OPTIONS[\"debug-profiler\"]) then\nprofiler:start()\nend\n"
|
||||
"print(\"Building configurations...\")\npremake.bake.buildconfigs()\nif (nil ~= _OPTIONS[\"debug-profiler\"]) then\nprofiler:stop()\nlocal filePath = path.getabsolute(\"GENie-profiler-bake.txt\")\nprint(\"Writing debug-profiler report \" .. filePath .. \".\")\nlocal outfile = io.open(filePath, \"w+\")\nprofiler:report(outfile)\noutfile:close()\nend\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\npremake.stats = { }\npremake.stats.num_generated = 0\npremake.stats.num_skipped = 0\nprintf(\"Running action '%s'...\", action.trigger)\npremake.action.call(action.trigger)\nprintf(\"Done. Generated %d/%d projects.\"\n, premake.stats.num_generated\n, premake.stats.num_generated+premake.stats.num_skipped\n)\nreturn 0\nend\n",
|
||||
"print(\"Building configurations...\")\npremake.bake.buildconfigs()\nif (nil ~= _OPTIONS[\"debug-profiler\"]) then\nprofiler:stop()\nlocal filePath = path.getabsolute(\"GENie-profiler-bake.txt\")\nprint(\"Writing debug-profiler report \" .. filePath .. \".\")\nlocal outfile = io.open(filePath, \"w+\")\nprofiler:report(outfile)\noutfile:close()\nend\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\nprintf(\"Running action '%s'...\", action.trigger)\npremake.action.call(action.trigger)\nprint(\"Done.\")\nreturn 0\nend\n",
|
||||
|
||||
0
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user