Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstarkos <none@none>2009-06-15 22:36:09 +0400
committerstarkos <none@none>2009-06-15 22:36:09 +0400
commit00c7cc56608d5b4fb2686aae5eede96fc73918b9 (patch)
tree9fbed0854d8e5239191fc3c10af6d1c0a19333d3
parent9dc5530ab6af5a3bec03a392145824d0cd0631de (diff)
Cut some more fat from the embedded scripts
-rw-r--r--premake4.lua32
-rw-r--r--src/host/scripts.c74
2 files changed, 49 insertions, 57 deletions
diff --git a/premake4.lua b/premake4.lua
index 26ada57..f537574 100644
--- a/premake4.lua
+++ b/premake4.lua
@@ -97,42 +97,34 @@ end
-- bytecodes are not portable to different architectures.
--
- local function loadscript(fname)
+ local function embedfile(out, fname)
local f = io.open(fname)
local s = f:read("*a")
f:close()
- -- strip out comments
- s = s:gsub("[\n]%-%-[^\n]*", "")
+ -- strip tabs
+ s = s:gsub("[\t]", "")
-- strip any CRs
s = s:gsub("[\r]", "")
+ -- strip out comments
+ s = s:gsub("\n%-%-[^\n]*", "")
+
-- escape backslashes
s = s:gsub("\\", "\\\\")
+ -- strip duplicate line feeds
+ s = s:gsub("\n+", "\n")
+
+ -- strip out leading comments
+ s = s:gsub("^%-%-\n", "")
+
-- escape line feeds
s = s:gsub("\n", "\\n")
-- escape double quote marks
s = s:gsub("\"", "\\\"")
-
- return s
- end
-
-
- local function embedfile(out, fname)
- local s = loadscript(fname)
-
- -- strip tabs
- s = s:gsub("[\t]", "")
-
- -- strip duplicate line feeds
- local t = s
- repeat
- s = t
- t = s:gsub("\\n\\n", "\\n")
- until s == t
out:write("\t\"")
out:write(s)
diff --git a/src/host/scripts.c b/src/host/scripts.c
index d381342..45911e3 100644
--- a/src/host/scripts.c
+++ b/src/host/scripts.c
@@ -2,42 +2,42 @@
/* To regenerate this file, run: premake4 embed */
const char* builtin_scripts[] = {
- "--\nfunction os.findlib(libname)\nlocal path, formats\n-- assemble a search path, depending on the platform\nif os.is(\"windows\") then\nformats = { \"%s.dll\", \"%s\" }\npath = os.getenv(\"PATH\")\nelse\nif os.is(\"macosx\") then\nformats = { \"lib%s.dylib\", \"%s.dylib\" }\npath = os.getenv(\"DYLD_LIBRARY_PATH\")\nelse\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LD_LIBRARY_PATH\") or \"\"\nlocal f = io.open(\"/etc/ld.so.conf\", \"r\")\nif f then\nfor line in f:lines() do\npath = path .. \":\" .. line\nend\nf:close()\nend\nend\ntable.insert(formats, \"%s\")\npath = (path or \"\") .. \":/lib:/usr/lib:/usr/local/lib\"\nend\nfor _, fmt in ipairs(formats) do\nlocal name = string.format(fmt, libname)\nlocal result = os.pathsearch(name, path)\nif result then return result end\nend\nend\nfunction os.get()\nreturn _OPTIONS.os or _OS\nend\nfunction os.is(id)\nreturn (os.get():lower() == id:lower())\nend\nlocal function domatch(result, mask, wantfiles)\nlocal basedir = path.getdirectory(mask)\nif (basedir == \".\") then basedir = \"\" end\nlocal m = os.matchstart(mask)\nwhile (os.matchnext(m)) do\nlocal fname = os.matchname(m)\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\ntable.insert(result, path.join(basedir, fname))\nend\nend\nos.matchdone(m)\n-- if the mask uses \"**\", recurse subdirectories\nif (mask:find(\"**\", nil, true)) then\nmask = path.getname(mask)\nm = os.matchstart(path.join(basedir, \"*\"))\nwhile (os.matchnext(m)) do\nlocal dirname = os.matchname(m)\nlocal submask = path.join(path.join(basedir, dirname), mask)\ndomatch(result, submask, wantfiles)\nend\nos.matchdone(m)\nend\nend\nfunction os.matchdirs(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, false)\nend\nreturn result\nend\nfunction os.matchfiles(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, true)\nend\nreturn result\nend\nlocal builtin_mkdir = os.mkdir\nfunction os.mkdir(p)\nlocal dir = iif(p:startswith(\"/\"), \"/\", \"\")\nfor part in p:gmatch(\"[^/]+\") do\ndir = dir .. part\nif (part ~= \"\" and not path.isabsolute(part) and not os.isdir(dir)) then\nlocal ok, err = builtin_mkdir(dir)\nif (not ok) then\nreturn nil, err\nend\nend\ndir = dir .. \"/\"\nend\nreturn true\nend\nlocal builtin_rmdir = os.rmdir\nfunction os.rmdir(p)\n-- recursively remove subdirectories\nlocal dirs = os.matchdirs(p .. \"/*\")\nfor _, dname in ipairs(dirs) do\nos.rmdir(dname)\nend\n-- remove any files\nlocal files = os.matchfiles(p .. \"/*\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\n-- remove this directory\nbuiltin_rmdir(p)\nend\n",
- "--\nfunction path.getabsolute(p)\n-- normalize the target path\np = path.translate(p, \"/\")\nif (p == \"\") then p = \".\" end\n-- if the directory is already absolute I don't need to do anything\nlocal result = iif (path.isabsolute(p), nil, os.getcwd())\n-- split up the supplied relative path and tackle it bit by bit\nfor n, part in ipairs(p:explode(\"/\", true)) do\nif (part == \"\" and n == 1) then\nresult = \"/\"\nelseif (part == \"..\") then\nresult = path.getdirectory(result)\nelseif (part ~= \".\") then\nresult = path.join(result, part)\nend\nend\n-- if I end up with a trailing slash remove it\nresult = iif(result:endswith(\"/\"), result:sub(1, -2), result)\nreturn result\nend\nfunction path.getbasename(p)\nlocal name = path.getname(p)\nlocal i = name:findlast(\".\", true)\nif (i) then\nreturn name:sub(1, i - 1)\nelse\nreturn name\nend\nend\nfunction path.getdirectory(p)\nlocal i = p:findlast(\"/\", true)\nif (i) then\nif i > 1 then i = i - 1 end\nreturn p:sub(1, i)\nelse\nreturn \".\"\nend\nend\nfunction path.getdrive(p)\nlocal ch1 = p:sub(1,1)\nlocal ch2 = p:sub(2,2)\nif ch2 == \":\" then\nreturn ch1\nend\nend\nfunction path.getextension(p)\nlocal i = p:findlast(\".\", true)\nif (i) then\nreturn p:sub(i)\nelse\nreturn \"\"\nend\nend\nfunction path.getname(p)\nlocal i = p:findlast(\"[/\\\\]\")\nif (i) then\nreturn p:sub(i + 1)\nelse\nreturn p\nend\nend\nfunction path.getrelative(src, dst)\n-- normalize the two paths\nsrc = path.getabsolute(src)\ndst = path.getabsolute(dst)\n-- same directory?\nif (src == dst) then\nreturn \".\"\nend\n-- different drives? Must use absolute path\nif path.getdrive(src) ~= path.getdrive(dst) then\nreturn dst\nend\nsrc = src .. \"/\"\ndst = dst .. \"/\"\n-- trim off the common directories from the front \nlocal i = src:find(\"/\")\nwhile (i) do\nif (src:sub(1,i) == dst:sub(1,i)) then\nsrc = src:sub(i + 1)\ndst = dst:sub(i + 1)\nelse\nbreak\nend\ni = src:find(\"/\")\nend\n-- back up from dst to get to this common parent\nlocal result = \"\"\ni = src:find(\"/\")\nwhile (i) do\nresult = result .. \"../\"\ni = src:find(\"/\", i + 1)\nend\n-- tack on the path down to the dst from here\nresult = result .. dst\n-- remove the trailing slash\nreturn result:sub(1, -2)\nend\nfunction path.iscfile(fname)\nlocal extensions = { \".c\", \".s\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.iscppfile(fname)\nlocal extensions = { \".cc\", \".cpp\", \".cxx\", \".c\", \".s\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.isresourcefile(fname)\nlocal extensions = { \".rc\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.join(leading, trailing)\nleading = leading or \"\"\nif (not trailing) then\nreturn leading\nend\nif (path.isabsolute(trailing)) then\nreturn trailing\nend\nif (leading == \".\") then\nleading = \"\"\nend\nif (leading:len() > 0 and not leading:endswith(\"/\")) then\nleading = leading .. \"/\"\nend\nreturn leading .. trailing\nend\nfunction path.rebase(p, oldbase, newbase)\np = path.getabsolute(path.join(oldbase, p))\np = path.getrelative(newbase, p)\nreturn p\nend\nfunction path.translate(p, sep)\nif (type(p) == \"table\") then\nlocal result = { }\nfor _, value in ipairs(p) do\ntable.insert(result, path.translate(value))\nend\nreturn result\nelse\nif (not sep) then\nif (os.is(\"windows\")) then\nsep = \"\\\\\"\nelse\nsep = \"/\"\nend\nend\nlocal result = p:gsub(\"[/\\\\]\", sep)\nreturn result\nend\nend\n",
- "--\nfunction string.explode(s, pattern, plain)\nif (pattern == '') then return false end\nlocal pos = 0\nlocal arr = { }\nfor st,sp in function() return s:find(pattern, pos, plain) end do\ntable.insert(arr, s:sub(pos, st-1))\npos = sp + 1\nend\ntable.insert(arr, s:sub(pos))\nreturn arr\nend\nfunction string.findlast(s, pattern, plain)\nlocal curr = 0\nrepeat\nlocal next = s:find(pattern, curr + 1, plain)\nif (next) then curr = next end\nuntil (not next)\nif (curr > 0) then\nreturn curr\nend\nend\nfunction string.startswith(haystack, needle)\nreturn (haystack:find(needle, 1, true) == 1)\nend",
- "--\nfunction table.contains(t, value)\nfor _,v in pairs(t) do\nif (v == value) then\nreturn true\nend\nend\nreturn false\nend\nfunction table.extract(arr, fname)\nlocal result = { }\nfor _,v in ipairs(arr) do\ntable.insert(result, v[fname])\nend\nreturn result\nend\nfunction table.implode(arr, before, after, between)\nlocal result = \"\"\nfor _,v in ipairs(arr) do\nif (result ~= \"\" and between) then\nresult = result .. between\nend\nresult = result .. before .. v .. after\nend\nreturn result\nend\nfunction table.join(...)\nlocal result = { }\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor _,v in ipairs(t) do\ntable.insert(result, v)\nend\nelse\ntable.insert(result, t)\nend\nend\nreturn result\nend\nfunction table.keys(tbl)\nlocal keys = {}\nfor k, _ in pairs(tbl) do\ntable.insert(keys, k)\nend\nreturn keys\nend\nfunction table.translate(arr, translation)\nlocal result = { }\nfor _, value in ipairs(arr) do\nlocal tvalue\nif type(translation) == \"function\" then\ntvalue = translation(value)\nelse\ntvalue = translation[value]\nend\nif (tvalue) then\ntable.insert(result, tvalue)\nend\nend\nreturn result\nend\n",
- "--\nfunction io.capture()\nio.captured = ''\nend\nfunction io.endcapture()\nlocal captured = io.captured\nio.captured = nil\nreturn captured\nend\nlocal builtin_open = io.open\nfunction io.open(fname, mode)\nif (mode) then\nif (mode:find(\"w\")) then\nlocal dir = path.getdirectory(fname)\nok, err = os.mkdir(dir)\nif (not ok) then\nerror(err, 0)\nend\nend\nend\nreturn builtin_open(fname, mode)\nend\nfunction io.printf(msg, ...)\nif (not io.eol) then\nio.eol = \"\\n\"\nend\nlocal s = string.format(msg, unpack(arg))\nif io.captured then\nio.captured = io.captured .. s .. io.eol\nelse\nio.write(s)\nio.write(io.eol)\nend\nend\n_p = io.printf\n",
- "--\n_SOLUTIONS = { }\n_TEMPLATES = { }\npremake = { }\npremake.actions = { }\npremake.options = { }\npremake.platforms = \n{\nNative = \n{ \ncfgsuffix = \"\",\n},\nx32 = \n{ \ncfgsuffix = \"32\",\n},\nx64 = \n{ \ncfgsuffix = \"64\",\n},\nUniversal = \n{ \ncfgsuffix = \"unix\",\n},\nUniversal32 = \n{ \ncfgsuffix = \"univ32\",\n},\nUniversal64 = \n{ \ncfgsuffix = \"univ64\",\n},\nPS3 = \n{ \ncfgsuffix = \"ps3\",\niscrosscompiler = true,\nnosharedlibs = true,\nnamestyle = \"PS3\",\n},\nXbox360 = \n{ \ncfgsuffix = \"xbox360\",\niscrosscompiler = true,\nnamestyle = \"windows\",\n},\n}\nlocal builtin_dofile = dofile\nfunction dofile(fname)\n-- remember the current working directory; I'll restore it shortly\nlocal oldcwd = os.getcwd()\n-- if the file doesn't exist, check the search path\nif (not os.isfile(fname)) then\nlocal path = os.pathsearch(fname, _OPTIONS[\"scripts\"], os.getenv(\"PREMAKE_PATH\"))\nif (path) then\nfname = path..\"/\"..fname\nend\nend\n-- use the absolute path to the script file, to avoid any file name\n-- ambiguity if an error should arise\nfname = path.getabsolute(fname)\n-- switch the working directory to the new script location\nlocal newcwd = path.getdirectory(fname)\nos.chdir(newcwd)\n-- run the chunk. How can I catch variable return values?\nlocal a, b, c, d, e, f = builtin_dofile(fname)\n-- restore the previous working directory when done\nos.chdir(oldcwd)\nreturn a, b, c, d, e, f\nend\nfunction iif(expr, trueval, falseval)\nif (expr) then\nreturn trueval\nelse\nreturn falseval\nend\nend\nfunction include(fname)\nreturn dofile(fname .. \"/premake4.lua\")\nend\nfunction printf(msg, ...)\nprint(string.format(msg, unpack(arg)))\nend\nlocal builtin_type = type\nfunction type(t)\nlocal mt = getmetatable(t)\nif (mt) then\nif (mt.__type) then\nreturn mt.__type\nend\nend\nreturn builtin_type(t)\nend\n",
- "--\nfunction premake.eachconfig(prj, platform)\n-- I probably have the project root config, rather than the actual project\nif prj.project then prj = prj.project end\nlocal cfgs = prj.solution.configurations\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #cfgs then\nreturn premake.getconfig(prj, cfgs[i], platform)\nend\nend\nend\nfunction premake.eachfile(prj)\n-- project root config contains the file config list\nif not prj.project then prj = premake.getconfig(prj) end\nlocal i = 0\nlocal t = prj.files\nreturn function ()\ni = i + 1\nif (i <= #t) then\nreturn prj.__fileconfigs[t[i]]\nend\nend\nend\nfunction premake.eachproject(sln)\nlocal i = 0\nreturn function ()\ni = i + 1\nif (i <= #sln.projects) then\nlocal prj = sln.projects[i]\nlocal cfg = premake.getconfig(prj)\ncfg.name = prj.name\ncfg.blocks = prj.blocks\nreturn cfg\nend\nend\nend\nfunction premake.esc(value)\nif (type(value) == \"table\") then\nlocal result = { }\nfor _,v in ipairs(value) do\ntable.insert(result, premake.esc(v))\nend\nreturn result\nelse\nvalue = value:gsub('&', \"&amp;\")\nvalue = value:gsub('\"', \"&quot;\")\nvalue = value:gsub(\"'\", \"&apos;\")\nvalue = value:gsub('<', \"&lt;\")\nvalue = value:gsub('>', \"&gt;\")\nvalue = value:gsub('\\r', \"&#x0D;\")\nvalue = value:gsub('\\n', \"&#x0A;\")\nreturn value\nend\nend\nfunction premake.filterplatforms(sln, map, default)\nlocal result = { }\nlocal keys = { }\nif sln.platforms then\nfor _, p in ipairs(sln.platforms) do\nif map[p] and not table.contains(keys, map[p]) then\ntable.insert(result, p)\ntable.insert(keys, map[p])\nend\nend\nend\nif #result == 0 and default then\ntable.insert(result, default)\nend\nreturn result\nend\nfunction premake.findproject(name)\nname = name:lower()\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nif (prj.name:lower() == name) then\nreturn prj\nend\nend\nend\nend\nfunction premake.findfile(prj, extension)\nfor _, fname in ipairs(prj.files) do\nif fname:endswith(extension) then return fname end\nend\nend\nfunction premake.getconfig(prj, cfgname, pltname)\n-- might have the root configuration, rather than the actual project\nprj = prj.project or prj\n-- if platform is not included in the solution, use general settings instead\nif pltname == \"Native\" or not table.contains(prj.solution.platforms or {}, pltname) then\npltname = nil\nend\nlocal key = (cfgname or \"\")\nif pltname then key = key .. pltname end\nreturn prj.__configs[key]\nend\nfunction premake.getconfigname(cfgname, platform, useshortname)\nif cfgname then\nlocal name = cfgname\nif platform and platform ~= \"Native\" then\nif useshortname then\nname = name .. premake.platforms[platform].cfgsuffix\nelse\nname = name .. \"|\" .. platform\nend\nend\nreturn iif(useshortname, name:lower(), name)\nend\nend\nfunction premake.getdependencies(prj)\n-- make sure I've got the project and not root config\nprj = prj.project or prj\nlocal results = { }\nfor _, cfg in pairs(prj.__configs) do\nfor _, link in ipairs(cfg.links) do\nlocal dep = premake.findproject(link)\nif dep and not table.contains(results, dep) then\ntable.insert(results, dep)\nend\nend\nend\nreturn results\nend\nfunction premake.getlinks(cfg, kind, part)\n-- if I'm building a list of link directories, include libdirs\nlocal result = iif (part == \"directory\" and kind == \"all\", cfg.libdirs, {})\n-- am I getting links for a configuration or a project?\nlocal cfgname = iif(cfg.name == cfg.project.name, \"\", cfg.name)\n-- how should files be named?\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\nlocal function canlink(source, target)\nif (target.kind ~= \"SharedLib\" and target.kind ~= \"StaticLib\") then \nreturn false\nend\nif premake.iscppproject(source) then\nreturn premake.iscppproject(target)\nelseif premake.isdotnetproject(source) then\nreturn premake.isdotnetproject(target)\nend\nend\nfor _, link in ipairs(cfg.links) do\nlocal item\n-- is this a sibling project?\nlocal prj = premake.findproject(link)\nif prj and kind ~= \"system\" then\nlocal prjcfg = premake.getconfig(prj, cfgname, cfg.platform)\nif kind == \"dependencies\" or canlink(cfg, prjcfg) then\nif (part == \"directory\") then\nitem = path.rebase(prjcfg.linktarget.directory, prjcfg.location, cfg.location)\nelseif (part == \"basename\") then\nitem = prjcfg.linktarget.basename\nelseif (part == \"fullpath\") then\nitem = path.rebase(prjcfg.linktarget.fullpath, prjcfg.location, cfg.location)\nelseif (part == \"object\") then\nitem = prjcfg\nend\nend\nelseif not prj and (kind == \"system\" or kind == \"all\") then\nif (part == \"directory\") then\nlocal dir = path.getdirectory(link)\nif (dir ~= \".\") then\nitem = dir\nend\nelseif (part == \"fullpath\") then\nitem = link\nif namestyle == \"windows\" then\nif premake.iscppproject(cfg) then\nitem = item .. \".lib\"\nelseif premake.isdotnetproject(cfg) then\nitem = item .. \".dll\"\nend\nend\nif item:find(\"/\", nil, true) then\nitem = path.getrelative(cfg.basedir, item)\nend\nelse\nitem = link\nend\nend\nif item then\nif pathstyle == \"windows\" and part ~= \"object\" then\nitem = path.translate(item, \"\\\\\")\nend\nif not table.contains(result, item) then\ntable.insert(result, item)\nend\nend\nend\nreturn result\nend\nfunction premake.getnamestyle(cfg)\nreturn premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or \"posix\"\nend\nfunction premake.getoutputname(this, namespec)\nlocal fname\nif (type(namespec) == \"function\") then\nfname = namespec(this)\nelse\nfname = this.name .. namespec\nend\nreturn path.join(this.location, fname)\nend\nfunction premake.getpathstyle(cfg)\nif premake.actions[_ACTION].os == \"windows\" then\nreturn \"windows\"\nelse\nreturn \"posix\"\nend\nend\nfunction premake.gettarget(cfg, direction, pathstyle, namestyle, system)\nif system == \"bsd\" then system = \"linux\" end\n-- Fix things up based on the current system\nlocal kind = cfg.kind\nif premake.iscppproject(cfg) then\n-- On Windows, shared libraries link against a static import library\nif (namestyle == \"windows\" or system == \"windows\") and kind == \"SharedLib\" and direction == \"link\" then\nkind = \"StaticLib\"\nend\n-- Posix name conventions only apply to static libs on windows (by user request)\nif namestyle == \"posix\" and system == \"windows\" and kind ~= \"StaticLib\" then\nnamestyle = \"windows\"\nend\nend\n-- Initialize the target components\nlocal field = iif(direction == \"build\", \"target\", \"implib\")\nlocal name = cfg[field..\"name\"] or cfg.targetname or cfg.project.name\nlocal dir = cfg[field..\"dir\"] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir)\nlocal prefix = \"\"\nlocal suffix = \"\"\nif namestyle == \"windows\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\nsuffix = \".exe\"\nelseif kind == \"SharedLib\" then\nsuffix = \".dll\"\nelseif kind == \"StaticLib\" then\nsuffix = \".lib\"\nend\nelseif namestyle == \"posix\" then\nif kind == \"WindowedApp\" and system == \"macosx\" then\ndir = path.join(dir, name .. \".app/Contents/MacOS\")\nelseif kind == \"SharedLib\" then\nprefix = \"lib\"\nsuffix = iif(system == \"macosx\", \".dylib\", \".so\")\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\nsuffix = \".a\"\nend\nelseif namestyle == \"PS3\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\nsuffix = \".elf\"\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\nsuffix = \".a\"\nend\nend\nprefix = cfg[field..\"prefix\"] or cfg.targetprefix or prefix\nsuffix = cfg[field..\"extension\"] or cfg.targetextension or suffix\n-- build the results object\nlocal result = { }\nresult.basename = name\nresult.name = prefix .. name .. suffix\nresult.directory = dir\nresult.fullpath = path.join(result.directory, result.name)\nif pathstyle == \"windows\" then\nresult.directory = path.translate(result.directory, \"\\\\\")\nresult.fullpath = path.translate(result.fullpath, \"\\\\\")\nend\nreturn result\nend\nfunction premake.gettool(cfg)\nif premake.iscppproject(cfg) then\nif _OPTIONS.cc then\nreturn premake[_OPTIONS.cc]\nend\nlocal action = premake.actions[_ACTION]\nif action.valid_tools then\nreturn premake[action.valid_tools.cc[1]]\nend\nreturn premake.gcc\nelse\nreturn premake.dotnet\nend\nend\nfunction premake.hascppproject(sln)\nfor prj in premake.eachproject(sln) do\nif premake.iscppproject(prj) then\nreturn true\nend\nend\nend\nfunction premake.hasdotnetproject(sln)\nfor prj in premake.eachproject(sln) do\nif premake.isdotnetproject(prj) then\nreturn true\nend\nend\nend\nfunction premake.iscppproject(prj)\nreturn (prj.language == \"C\" or prj.language == \"C++\")\nend\nfunction premake.isdotnetproject(prj)\nreturn (prj.language == \"C#\")\nend\nlocal function walksources(cfg, fn, group, nestlevel, finished)\nlocal grouplen = group:len()\nlocal gname = iif(group:endswith(\"/\"), group:sub(1, -2), group)\n-- open this new group\nif (nestlevel >= 0) then\nfn(cfg, gname, \"GroupStart\", nestlevel)\nend\n-- scan the list of files for items which belong in this group\nfor _,fname in ipairs(cfg.files) do\nif (fname:startswith(group)) then\n-- is there a subgroup within this item?\nlocal _,split = fname:find(\"[^\\.]/\", grouplen + 1)\nif (split) then\nlocal subgroup = fname:sub(1, split)\nif (not finished[subgroup]) then\nfinished[subgroup] = true\nwalksources(cfg, fn, subgroup, nestlevel + 1, finished)\nend\nend\nend\nend\n-- process all files that belong in this group\nfor _,fname in ipairs(cfg.files) do\nif (fname:startswith(group) and not fname:find(\"[^\\.]/\", grouplen + 1)) then\nfn(cfg, fname, \"GroupItem\", nestlevel + 1)\nend\nend\n-- close the group\nif (nestlevel >= 0) then\nfn(cfg, gname, \"GroupEnd\", nestlevel)\nend\nend\nfunction premake.walksources(cfg, fn)\nwalksources(cfg, fn, \"\", -1, {})\nend\n",
- "--\n-- do not copy these fields into the configurations\nlocal nocopy = \n{\nblocks = true,\nkeywords = true,\nprojects = true,\n__configs = true,\n}\n-- leave these paths as absolute, rather than converting to project relative\nlocal nofixup =\n{\nbasedir = true,\nlocation = true,\n}\nfunction premake.getactiveterms()\nlocal terms = { _ACTION:lower(), os.get() }\n-- add option keys or values\nfor key, value in pairs(_OPTIONS) do\nif value ~= \"\" then\ntable.insert(terms, value:lower())\nelse\ntable.insert(terms, key:lower())\nend\nend\nreturn terms\nend\nfunction premake.escapekeyword(keyword)\nkeyword = keyword:gsub(\"([%.%-%^%$%(%)%%])\", \"%%%1\")\nif keyword:find(\"**\", nil, true) then\nkeyword = keyword:gsub(\"%*%*\", \".*\")\nelse\nkeyword = keyword:gsub(\"%*\", \"[^/]*\")\nend\nreturn keyword:lower()\nend\nfunction premake.iskeywordmatch(keyword, terms)\n-- is it negated?\nif keyword:startswith(\"not \") then\nreturn not premake.iskeywordmatch(keyword:sub(5), terms)\nend\nfor _, word in ipairs(keyword:explode(\" or \")) do\nlocal pattern = \"^\" .. word .. \"$\"\nfor termkey, term in pairs(terms) do\nif term:match(pattern) then\nreturn termkey\nend\nend\nend\nend\nfunction premake.iskeywordsmatch(keywords, terms)\nlocal hasrequired = false\nfor _, keyword in ipairs(keywords) do\nlocal matched = premake.iskeywordmatch(keyword, terms)\nif not matched then\nreturn false\nend\nif matched == \"required\" then\nhasrequired = true\nend\nend\nif terms.required and not hasrequired then\nreturn false\nelse\nreturn true\nend\nend\nlocal function adjustpaths(location, obj)\nfor name, value in pairs(obj) do\nlocal field = premake.fields[name]\nif field and value and not nofixup[name] then\nif field.kind == \"path\" then\nobj[name] = path.getrelative(location, value) \nelseif field.kind == \"dirlist\" or field.kind == \"filelist\" then\nfor i, p in ipairs(value) do \nvalue[i] = path.getrelative(location, p) \nend\nend\nend\nend\nend\nlocal function mergeobject(dest, src)\nif not src then return end\nfor field, value in pairs(src) do\nif not nocopy[field] then\nif type(value) == \"table\" then\ndest[field] = table.join(dest[field] or {}, value)\nelse\ndest[field] = value\nend\nend\nend\nend\nlocal function merge(dest, obj, basis, cfgname, pltname)\npltname = pltname or \"Native\"\nlocal key = cfgname or \"\"\nif pltname ~= \"Native\" then\nkey = key .. pltname\nend\nlocal cfg = {}\nmergeobject(cfg, basis[key])\nadjustpaths(obj.location, cfg)\nmergeobject(cfg, obj)\nlocal terms = premake.getactiveterms()\nterms.config = (cfgname or \"\"):lower()\nterms.platform = pltname:lower()\nfor _, blk in ipairs(obj.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, terms)) then\nmergeobject(cfg, blk)\nend\nend\ncfg.name = cfgname\ncfg.platform = pltname\ncfg.terms = terms\ndest[key] = cfg\nend\nlocal function collapse(obj, basis)\nlocal result = {}\nbasis = basis or {}\n-- find the solution, which contains the configuration and platform lists\nlocal sln = obj.solution or obj\nmerge(result, obj, basis)\nfor _, cfgname in ipairs(sln.configurations) do\nmerge(result, obj, basis, cfgname, \"Native\")\nfor _, pltname in ipairs(sln.platforms or {}) do\nif pltname ~= \"Native\" then\nmerge(result, obj, basis, cfgname, pltname)\nend\nend\nend\nreturn result\nend\nlocal function postprocess(prj, cfg)\ncfg.project = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname = premake.getconfigname(cfg.name, cfg.platform)\n-- set the project location, if not already set\ncfg.location = cfg.location or cfg.basedir\n-- figure out the target system\nlocal platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nelse\ncfg.system = os.get()\nend\n-- adjust the kind as required by the target system\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\n-- remove excluded files from the file list\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\n-- fixup the data\nfor name, field in pairs(premake.fields) do\n-- re-key flag fields for faster lookups\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\n-- build configuration objects for all files\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\n-- add indexed by name and integer\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\nlocal function builduniquedirs()\nlocal num_variations = 4\n-- Start by listing out each possible object directory for each configuration.\n-- Keep a count of how many times each path gets used across the session.\nlocal cfg_dirs = {}\nlocal hit_counts = {}\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dirs = { }\ndirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \"obj\"))\ndirs[2] = path.join(dirs[1], iif(cfg.platform == \"Native\", \"\", cfg.platform))\ndirs[3] = path.join(dirs[2], cfg.name)\ndirs[4] = path.join(dirs[3], cfg.project.name)\ncfg_dirs[cfg] = dirs\nfor v = 1, num_variations do\nlocal d = dirs[v]\nif hit_counts[d] then\nhit_counts[d] = hit_counts[d] + 1\nelse\nhit_counts[d] = 1\nend\nend\nend\nend\nend\n-- Now assign an object directory to each configuration, skipping those\n-- that are in use somewhere else in the session\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nfor v = 1, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\n-- determine which conventions the target should follow for this config\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\n-- build the targets\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\nfunction premake.buildconfigs()\n-- convert project path fields to be relative to project location\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\n-- collapse configuration blocks, so that there is only one block per build\n-- configuration/platform pair, filtered to the current operating environment\nfor _, sln in ipairs(_SOLUTIONS) do\nlocal basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\npostprocess(prj, cfg)\nend\nend\nend\n-- assign unique object directories to each configuration\nbuilduniquedirs()\n-- walk it again and build the targets and unique directories\nbuildtargets(cfg)\nend\n",
- "--\npremake.fields = \n{\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nconfigurations = \n{\nkind = \"list\",\nscope = \"solution\",\n},\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"config\",\nisflags = true,\nallowed = {\n\"ExtraWarnings\",\n\"FatalWarnings\",\n\"Managed\",\n\"NativeWChar\",\n\"No64BitChecks\",\n\"NoEditAndContinue\",\n\"NoExceptions\",\n\"NoFramePointer\",\n\"NoImportLib\",\n\"NoManifest\",\n\"NoNativeWChar\",\n\"NoPCH\",\n\"NoRTTI\",\n\"Optimize\",\n\"OptimizeSize\",\n\"OptimizeSpeed\",\n\"SEH\",\n\"StaticRuntime\",\n\"Symbols\",\n\"Unicode\",\n\"Unsafe\",\n\"WinMain\"\n}\n},\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\n-- if library name contains a '/' then treat it as a path to a local file\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend\n},\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\nplatforms = \n{\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nresoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (not container[fieldname]) then\ncontainer[fieldname] = { }\nend\nlocal function doinsert(value, depth)\nif (type(value) == \"table\") then\nfor _,v in ipairs(value) do\ndoinsert(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, depth)\nend\ntable.insert(container[fieldname], value)\nend\nend\nif (value) then\ndoinsert(value, 5)\nend\nreturn container[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value)\nif (type(value) == \"table\") then\nfor _,item in ipairs(value) do\nmakeabsolute(item)\nend\nelse\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value))\nelse\ntable.insert(result, path.getabsolute(value))\nend\nend\nend\nmakeabsolute(value)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\n-- find the container for this value\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\n-- if a value was provided, set it\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then \nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\" and value) then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nif (kind == \"string\") then\nreturn premake.setstring(scope, name, value, allowed)\nelseif (kind == \"path\") then\nif value then value = path.getabsolute(value) end\nreturn premake.setstring(scope, name, value)\nelseif (kind == \"list\") then\nreturn premake.setarray(scope, name, value, allowed)\nelseif (kind == \"dirlist\") then\nreturn premake.setdirarray(scope, name, value)\nelseif (kind == \"filelist\") then\nreturn premake.setfilearray(scope, name, value)\nend\nend\nfor name,_ in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nend\nfunction configuration(keywords)\nif not keywords then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\n-- create a keyword list using just the indexed keyword items\ncfg.keywords = { }\nfor _, word in ipairs(table.join({}, keywords)) do\ntable.insert(cfg.keywords, premake.escapekeyword(word))\nend\n-- if file patterns are specified, convert them to Lua patterns and add them too\nif keywords.files then\nfor _, pattern in ipairs(table.join({}, keywords.files)) do\npattern = pattern:gsub(\"%.\", \"%%.\")\nif pattern:find(\"**\", nil, true) then\npattern = pattern:gsub(\"%*%*\", \".*\")\nelse\npattern = pattern:gsub(\"%*\", \"[^/]*\")\nend\ntable.insert(cfg.keywords, \"^\" .. pattern .. \"$\")\nend\nend\n-- initialize list-type fields to empty tables\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nfunction project(name)\nif not name then\nreturn iif(type(premake.CurrentContainer) == \"project\", premake.CurrentContainer, nil)\nend\n-- identify the parent solution\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\n-- if this is a new project, create it\npremake.CurrentContainer = sln.projects[name]\nif (not premake.CurrentContainer) then\nlocal prj = { }\npremake.CurrentContainer = prj\n-- add to master list keyed by both name and index\ntable.insert(sln.projects, prj)\nsln.projects[name] = prj\n-- attach a type\nsetmetatable(prj, {\n__type = \"project\",\n})\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.uuid = os.uuid()\nprj.blocks = { }\nend\n-- add an empty, global configuration to the project\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = _SOLUTIONS[name]\nif (not premake.CurrentContainer) then\nlocal sln = { }\npremake.CurrentContainer = sln\n-- add to master list keyed by both name and index\ntable.insert(_SOLUTIONS, sln)\n_SOLUTIONS[name] = sln\n-- attach a type\nsetmetatable(sln, { \n__type=\"solution\"\n})\nsln.name = name\nsln.basedir = os.getcwd()\nsln.projects = { }\nsln.blocks = { }\nsln.configurations = { }\nend\n-- add an empty, global configuration\nconfiguration { }\nreturn premake.CurrentContainer\nend\n",
- "--\nlocal requiredactionfields =\n{\n\"description\",\n\"trigger\",\n}\nlocal requiredoptionfields = \n{\n\"description\",\n\"trigger\"\n}\nfunction newaction(a)\n-- some sanity checking\nlocal missing\nfor _, field in ipairs(requiredactionfields) do\nif (not a[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"action needs a \" .. missing, 2)\nend\n-- add it to the master list\npremake.actions[a.trigger] = a\nend\nfunction newoption(opt)\n-- some sanity checking\nlocal missing\nfor _, field in ipairs(requiredoptionfields) do\nif (not opt[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"action needs a \" .. missing, 2)\nend\n-- add it to the master list\npremake.options[opt.trigger] = opt\nend\nnewoption \n{\ntrigger = \"cc\",\nvalue = \"compiler\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n{ \"ow\", \"OpenWatcom\" },\n}\n}\nnewoption\n{\ntrigger = \"dotnet\",\nvalue = \"value\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\", \"Microsoft .NET (csc)\" },\n{ \"mono\", \"Novell Mono (mcs)\" },\n{ \"pnet\", \"Portable.NET (cscc)\" },\n}\n}\nnewoption\n{\ntrigger = \"file\",\nvalue = \"filename\",\ndescription = \"Process the specified Premake script file\"\n}\nnewoption\n{\ntrigger = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger = \"os\",\nvalue = \"value\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"bsd\", \"OpenBSD, NetBSD, or FreeBSD\" },\n{ \"linux\", \"Linux\" },\n{ \"macosx\", \"Apple Mac OS X\" },\n{ \"windows\", \"Microsoft Windows\" },\n}\n}\nnewoption\n{\ntrigger = \"platform\",\nvalue = \"value\",\ndescription = \"Add target architecture (if supported by action)\",\nallowed = {\n{ \"x32\", \"32-bit\" },\n{ \"x64\", \"64-bit\" },\n{ \"universal\", \"Mac OS X Universal, 32- and 64-bit\" },\n{ \"universal32\", \"Mac OS X Universal, 32-bit only\" },\n{ \"universal64\", \"Mac OS X Universal, 64-bit only\" },\n{ \"ps3\", \"Playstation 3 (experimental)\" },\n{ \"xbox360\", \"Xbox 360 (experimental)\" },\n}\n}\nnewoption\n{\ntrigger = \"scripts\",\nvalue = \"path\",\ndescription = \"Search for additional scripts on the given path\"\n}\nnewoption\n{\ntrigger = \"version\",\ndescription = \"Display version information\"\n}\n",
- "--\npremake.dotnet = { }\npremake.dotnet.namestyle = \"windows\"\nlocal flags =\n{\nFatalWarning = \"/warnaserror\",\nOptimize = \"/optimize\",\nOptimizeSize = \"/optimize\",\nOptimizeSpeed = \"/optimize\",\nSymbols = \"/debug\",\nUnsafe = \"/unsafe\"\n}\nfunction premake.dotnet.getbuildaction(fcfg)\nlocal ext = path.getextension(fcfg.name):lower()\nif fcfg.buildaction == \"Compile\" or ext == \".cs\" then\nreturn \"Compile\"\nelseif fcfg.buildaction == \"Embed\" or ext == \".resx\" then\nreturn \"EmbeddedResource\"\nelseif fcfg.buildaction == \"Copy\" or ext == \".asax\" or ext == \".aspx\" then\nreturn \"Content\"\nelse\nreturn \"None\"\nend\nend\nfunction premake.dotnet.getcompilervar(cfg)\nif (_OPTIONS.dotnet == \"msnet\") then\nreturn \"csc\"\nelseif (_OPTIONS.dotnet == \"mono\") then\nreturn \"gmcs\"\nelse\nreturn \"cscc\"\nend\nend\nfunction premake.dotnet.getflags(cfg)\nlocal result = table.translate(cfg.flags, flags)\nreturn result\nend\nfunction premake.dotnet.getkind(cfg)\nif (cfg.kind == \"ConsoleApp\") then\nreturn \"Exe\"\nelseif (cfg.kind == \"WindowedApp\") then\nreturn \"WinExe\"\nelseif (cfg.kind == \"SharedLib\") then\nreturn \"Library\"\nend\nend",
- "--\npremake.gcc = { }\npremake.gcc.cc = \"gcc\"\npremake.gcc.cxx = \"g++\"\npremake.gcc.ar = \"ar\"\nlocal cflags =\n{\nExtraWarnings = \"-Wall\",\nFatalWarnings = \"-Werror\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\n}\npremake.gcc.platforms = \n{\nNative = { \ncppflags = \"-MMD\", \n},\nx32 = { \ncppflags = \"-MMD\",\nflags = \"-m32\",\nldflags = \"-L/usr/lib32\", \n},\nx64 = { \ncppflags = \"-MMD\",\nflags = \"-m64\",\nldflags = \"-L/usr/lib64\",\n},\nUniversal = { \ncppflags = \"\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\n},\nUniversal32 = { \ncppflags = \"\",\nflags = \"-arch i386 -arch ppc\",\n},\nUniversal64 = { \ncppflags = \"\",\nflags = \"-arch x86_64 -arch ppc64\",\n},\nPS3 = {\ncc = \"ppu-lv2-g++\",\ncxx = \"ppu-lv2-g++\",\nar = \"ppu-lv2-ar\",\ncppflags = \"-MMD\",\n}\n}\nlocal platforms = premake.gcc.platforms\nfunction premake.gcc.getcppflags(cfg)\nlocal result = { }\ntable.insert(result, platforms[cfg.platform].cppflags)\nreturn result\nend\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nif cfg.system ~= \"windows\" and cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-fPIC\")\nend\nreturn result\nend\nfunction premake.gcc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\n-- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html\nif not cfg.flags.Symbols then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-Wl,-x\")\nelse\ntable.insert(result, \"-s\")\nend\nend\nif cfg.kind == \"SharedLib\" then\nif cfg.system == \"macosx\" then\nresult = table.join(result, { \"-dynamiclib\", \"-flat_namespace\" })\nelse\ntable.insert(result, \"-shared\")\nend\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(result, '-Wl,--out-implib=\"' .. cfg.linktarget.fullpath .. '\"')\nend\nend\nif cfg.kind == \"WindowedApp\" then\nif cfg.system == \"windows\" then\ntable.insert(result, \"-mwindows\")\nend\nend\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\ntable.insert(result, platform.ldflags)\nreturn result\nend\nfunction premake.gcc.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.gcc.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\" .. _MAKE.esc(dir))\nend\nreturn result\nend\n",
- "--\npremake.msc = { }\npremake.msc.namestyle = \"windows\"\n",
- "--\npremake.ow = { }\npremake.ow.namestyle = \"windows\"\npremake.ow.cc = \"WCL386\"\npremake.ow.cxx = \"WCL386\"\npremake.ow.ar = \"ar\"\nlocal cflags =\n{\nExtraWarnings = \"-wx\",\nFatalWarning = \"-we\",\nOptimize = \"-ox\",\nOptimizeSize = \"-os\",\nOptimizeSpeed = \"-ot\",\nSymbols = \"-d2\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-xd\",\nNoRTTI = \"-xr\",\n}\npremake.ow.platforms = \n{\nNative = { \nflags = \"\" \n},\n}\nfunction premake.ow.getcppflags(cfg)\nreturn {}\nend\nfunction premake.ow.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\nif (cfg.flags.Symbols) then\ntable.insert(result, \"-hw\") -- Watcom debug format for Watcom debugger\nend\nreturn result\nend\nfunction premake.ow.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.ow.getldflags(cfg)\nlocal result = { }\nif (cfg.flags.Symbols) then\ntable.insert(result, \"op symf\")\nend\nreturn result\nend\nfunction premake.ow.getlinkflags(cfg)\nlocal result = { }\nreturn result\nend\nfunction premake.ow.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.ow.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, '-I \"' .. dir .. '\"')\nend\nreturn result\nend\n",
- "--\nfunction premake.checkoptions()\nfor key, value in pairs(_OPTIONS) do\n-- is this a valid option?\nlocal opt = premake.options[key]\nif (not opt) then\nreturn false, \"invalid option '\" .. key .. \"'\"\nend\n-- does it need a value?\nif (opt.value and value == \"\") then\nreturn false, \"no value specified for option '\" .. key .. \"'\"\nend\n-- is the value allowed?\nif (opt.allowed) then\nfor _, match in ipairs(opt.allowed) do\nif (match[1] == value) then return true end\nend\nreturn false, \"invalid value '\" .. value .. \"' for option '\" .. key .. \"'\"\nend\nend\nreturn true\nend\nfunction premake.checkprojects()\nlocal action = premake.actions[_ACTION]\nfor _, sln in ipairs(_SOLUTIONS) do\n-- every solution must have at least one project\nif (#sln.projects == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs at least one project\"\nend\n-- every solution must provide a list of configurations\nif (#sln.configurations == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs configurations\"\nend\nfor prj in premake.eachproject(sln) do\n-- every project must have a language\nif (not prj.language) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a language\"\nend\n-- and the action must support it\nif (action.valid_languages) then\nif (not table.contains(action.valid_languages, prj.language)) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support \" .. prj.language .. \" projects\"\nend\nend\nfor cfg in premake.eachconfig(prj) do\n-- every config must have a kind\nif (not cfg.kind) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a kind in configuration '\" .. cfg.name .. \"'\"\nend\n-- and the action must support it\nif (action.valid_kinds) then\nif (not table.contains(action.valid_kinds, cfg.kind)) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support \" .. cfg.kind .. \" projects\"\nend\nend\nend\nend\nend\nreturn true\nend\nfunction premake.checktools()\nlocal action = premake.actions[_ACTION]\nif (not action.valid_tools) then \nreturn true \nend\nfor tool, values in pairs(action.valid_tools) do\nif (_OPTIONS[tool]) then\nif (not table.contains(values, _OPTIONS[tool])) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support /\" .. tool .. \"=\" .. _OPTIONS[tool] .. \" (yet)\"\nend\nelse\n_OPTIONS[tool] = values[1]\nend\nend\nreturn true\nend\n",
- "--\nfunction premake.showhelp()\n-- sort the lists of actions and options into alphabetical order\nactions = { }\nfor name,_ in pairs(premake.actions) do table.insert(actions, name) end\ntable.sort(actions)\noptions = { }\nfor name,_ in pairs(premake.options) do table.insert(options, name) end\ntable.sort(options)\n-- display the basic usage\nprintf(\"Premake %s, a build script generator\", _PREMAKE_VERSION)\nprintf(_PREMAKE_COPYRIGHT)\nprintf(\"%s %s\", _VERSION, _COPYRIGHT)\nprintf(\"\")\nprintf(\"Usage: premake4 [options] action [arguments]\")\nprintf(\"\")\n-- display all options\nprintf(\"OPTIONS\")\nprintf(\"\")\nfor _,name in ipairs(options) do\nlocal opt = premake.options[name]\nlocal trigger = opt.trigger\nlocal description = opt.description\nif (opt.value) then trigger = trigger .. \"=\" .. opt.value end\nif (opt.allowed) then description = description .. \"; one of:\" end\nprintf(\" --%-15s %s\", trigger, description) \nif (opt.allowed) then\nfor _, value in ipairs(opt.allowed) do\nprintf(\" %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\n-- display all actions\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor _,name in ipairs(actions) do\nprintf(\" %-17s %s\", name, premake.actions[name].description)\nend\nprintf(\"\")\n-- see more\nprintf(\"For additional information, see http://industriousone.com/premake\")\nend\n",
- "--\nfunction premake.codeblocks_workspace(sln)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>')\n_p('<CodeBlocks_workspace_file>')\n_p('\\t<Workspace title=\"%s\">', sln.name)\nfor prj in premake.eachproject(sln) do\nlocal fname = path.join(path.getrelative(sln.location, prj.location), prj.name)\nlocal active = iif(prj.project == sln.projects[1], ' active=\"1\"', '')\n_p('\\t\\t<Project filename=\"%s.cbp\"%s>', fname, active)\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p('\\t\\t\\t<Depends filename=\"%s.cbp\" />', path.join(path.getrelative(sln.location, dep.location), dep.name))\nend\n_p('\\t\\t</Project>')\nend\n_p('\\t</Workspace>')\n_p('</CodeBlocks_workspace_file>')\nend\n",
- "--\nfunction premake.codeblocks_cbp(prj)\n-- alias the C/C++ compiler interface\nlocal cc = premake.gettool(prj)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>')\n_p('<CodeBlocks_project_file>')\n_p('\\t<FileVersion major=\"1\" minor=\"6\" />')\n-- write project block header\n_p('\\t<Project>')\n_p('\\t\\t<Option title=\"%s\" />', premake.esc(prj.name))\n_p('\\t\\t<Option pch_mode=\"2\" />')\n_p('\\t\\t<Option compiler=\"%s\" />', _OPTIONS.cc)\n-- build a list of supported target platforms; I don't support cross-compiling yet\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \n-- write configuration blocks\n_p('\\t\\t<Build>')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p('\\t\\t\\t<Target title=\"%s\">', premake.esc(cfg.longname))\n_p('\\t\\t\\t\\t<Option output=\"%s\" prefix_auto=\"0\" extension_auto=\"0\" />', premake.esc(cfg.buildtarget.fullpath))\n_p('\\t\\t\\t\\t<Option object_output=\"%s\" />', premake.esc(cfg.objectsdir))\n-- identify the type of binary\nlocal types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }\n_p('\\t\\t\\t\\t<Option type=\"%d\" />', types[cfg.kind])\n_p('\\t\\t\\t\\t<Option compiler=\"%s\" />', _OPTIONS.cc)\nif (cfg.kind == \"SharedLib\") then\n_p('\\t\\t\\t\\t<Option createDefFile=\"0\" />')\n_p('\\t\\t\\t\\t<Option createStaticLib=\"%s\" />', iif(cfg.flags.NoImportLib, 0, 1))\nend\n-- begin compiler block --\n_p('\\t\\t\\t\\t<Compiler>')\nfor _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do\n_p('\\t\\t\\t\\t\\t<Add option=\"%s\" />', premake.esc(flag))\nend\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p('\\t\\t\\t\\t\\t<Add option=\"-Winvalid-pch\" />')\n_p('\\t\\t\\t\\t\\t<Add option=\"-include &quot;%s&quot;\" />', premake.esc(cfg.pchheader))\nend\nfor _,v in ipairs(cfg.includedirs) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</Compiler>')\n-- end compiler block --\n-- begin linker block --\n_p('\\t\\t\\t\\t<Linker>')\nfor _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do\n_p('\\t\\t\\t\\t\\t<Add option=\"%s\" />', premake.esc(flag))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\n_p('\\t\\t\\t\\t\\t<Add library=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</Linker>')\n-- end linker block --\n-- begin resource compiler block --\nif premake.findfile(cfg, \".rc\") then\n_p('\\t\\t\\t\\t<ResourceCompiler>')\nfor _,v in ipairs(cfg.includedirs) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(cfg.resincludedirs) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</ResourceCompiler>')\nend\n-- end resource compiler block --\n-- begin build steps --\nif #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then\n_p('\\t\\t\\t\\t<ExtraCommands>')\nfor _,v in ipairs(cfg.prebuildcommands) do\n_p('\\t\\t\\t\\t\\t<Add before=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(cfg.postbuildcommands) do\n_p('\\t\\t\\t\\t\\t<Add after=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</ExtraCommands>')\nend\n-- end build steps --\n_p('\\t\\t\\t</Target>')\nend\nend\n_p('\\t\\t</Build>')\n-- begin files block --\nlocal pchheader\nif (prj.pchheader) then\npchheader = path.getrelative(prj.location, prj.pchheader)\nend\nfor _,fname in ipairs(prj.files) do\n_p('\\t\\t<Unit filename=\"%s\">', premake.esc(fname))\nif path.isresourcefile(fname) then\n_p('\\t\\t\\t<Option compilerVar=\"WINDRES\" />')\nelseif path.iscppfile(fname) then\n_p('\\t\\t\\t<Option compilerVar=\"%s\" />', iif(prj.language == \"C\", \"CC\", \"CPP\"))\nend\nif not prj.flags.NoPCH and fname == pchheader then\n_p('\\t\\t\\t<Option compilerVar=\"%s\" />', iif(prj.language == \"C\", \"CC\", \"CPP\"))\n_p('\\t\\t\\t<Option compile=\"1\" />')\n_p('\\t\\t\\t<Option weight=\"0\" />')\n_p('\\t\\t\\t<Add option=\"-x c++-header\" />')\nend\n_p('\\t\\t</Unit>')\nend\n-- end files block --\n_p('\\t\\t<Extensions />')\n_p('\\t</Project>')\n_p('</CodeBlocks_project_file>')\n_p('')\nend\n",
- "--\nfunction premake.codelite_workspace(sln)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<CodeLite_Workspace Name=\"%s\" Database=\"./%s.tags\">', premake.esc(sln.name), premake.esc(sln.name))\nfor i,prj in ipairs(sln.projects) do\nlocal name = premake.esc(prj.name)\nlocal fname = path.join(path.getrelative(sln.location, prj.location), prj.name)\nlocal active = iif(i==1, \"Yes\", \"No\")\n_p(' <Project Name=\"%s\" Path=\"%s.project\" Active=\"%s\" />', name, fname, active)\nend\n-- build a list of supported target platforms; I don't support cross-compiling yet\nlocal platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \n_p(' <BuildMatrix>')\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\nlocal name = premake.getconfigname(cfgname, platform)\n_p(' <WorkspaceConfiguration Name=\"%s\" Selected=\"yes\">', name)\nfor _,prj in ipairs(sln.projects) do\n_p(' <Project Name=\"%s\" ConfigName=\"%s\"/>', prj.name, name)\nend\n_p(' </WorkspaceConfiguration>')\nend\nend\n_p(' </BuildMatrix>')\n_p('</CodeLite_Workspace>')\nend\n",
- "--\nfunction premake.codelite_project(prj)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<CodeLite_Project Name=\"%s\">', premake.esc(prj.name))\npremake.walksources(prj, premake.codelite_files)\nlocal types = { \nConsoleApp = \"Executable\", \nWindowedApp = \"Executable\", \nStaticLib = \"Static Library\",\nSharedLib = \"Dynamic Library\",\n}\n_p(' <Settings Type=\"%s\">', types[prj.kind])\n-- build a list of supported target platforms; I don't support cross-compiling yet\nlocal platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nlocal name = premake.esc(cfg.longname)\nlocal compiler = iif(cfg.language == \"C\", \"gcc\", \"g++\")\n_p(' <Configuration Name=\"%s\" CompilerType=\"gnu %s\" DebuggerType=\"GNU gdb debugger\" Type=\"%s\">', name, compiler, types[cfg.kind])\nlocal fname = premake.esc(cfg.buildtarget.fullpath)\nlocal objdir = premake.esc(cfg.objectsdir)\nlocal runcmd = cfg.buildtarget.name\nlocal rundir = cfg.buildtarget.directory\nlocal pause = iif(cfg.kind == \"WindowedApp\", \"no\", \"yes\")\n_p(' <General OutputFile=\"%s\" IntermediateDirectory=\"%s\" Command=\"./%s\" CommandArguments=\"\" WorkingDirectory=\"%s\" PauseExecWhenProcTerminates=\"%s\"/>', fname, objdir, runcmd, rundir, pause)\n-- begin compiler block --\nlocal flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions))\n_p(' <Compiler Required=\"yes\" Options=\"%s\">', table.concat(flags, \";\"))\nfor _,v in ipairs(cfg.includedirs) do\n_p(' <IncludePath Value=\"%s\"/>', premake.esc(v))\nend\nfor _,v in ipairs(cfg.defines) do\n_p(' <Preprocessor Value=\"%s\"/>', premake.esc(v))\nend\n_p(' </Compiler>')\n-- end compiler block --\n-- begin linker block --\nflags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions))\n_p(' <Linker Required=\"yes\" Options=\"%s\">', table.concat(flags, \";\"))\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\n_p(' <LibraryPath Value=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\n_p(' <Library Value=\"%s\" />', premake.esc(v))\nend\n_p(' </Linker>')\n-- end linker block --\n-- begin resource compiler block --\nif premake.findfile(cfg, \".rc\") then\nlocal defines = table.implode(table.join(cfg.defines, cfg.resdefines), \"-D\", \";\", \"\")\nlocal options = table.concat(cfg.resoptions, \";\")\n_p(' <ResourceCompiler Required=\"yes\" Options=\"%s%s\">', defines, options)\nfor _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do\n_p(' <IncludePath Value=\"%s\"/>', premake.esc(v))\nend\n_p(' </ResourceCompiler>')\nelse\n_p(' <ResourceCompiler Required=\"no\" Options=\"\"/>')\nend\n-- end resource compiler block --\n-- begin build steps --\nif #cfg.prebuildcommands > 0 then\n_p(' <PreBuild>')\nfor _,v in ipairs(cfg.prebuildcommands) do\n_p(' <Command Enabled=\"yes\">%s</Command>', premake.esc(v))\nend\n_p(' </PreBuild>')\nend\nif #cfg.postbuildcommands > 0 then\n_p(' <PostBuild>')\nfor _,v in ipairs(cfg.postbuildcommands) do\n_p(' <Command Enabled=\"yes\">%s</Command>', premake.esc(v))\nend\n_p(' </PostBuild>')\nend\n-- end build steps --\n_p(' <CustomBuild Enabled=\"no\">')\n_p(' <CleanCommand></CleanCommand>')\n_p(' <BuildCommand></BuildCommand>')\n_p(' <SingleFileCommand></SingleFileCommand>')\n_p(' <MakefileGenerationCommand></MakefileGenerationCommand>')\n_p(' <ThirdPartyToolName>None</ThirdPartyToolName>')\n_p(' <WorkingDirectory></WorkingDirectory>')\n_p(' </CustomBuild>')\n_p(' <AdditionalRules>')\n_p(' <CustomPostBuild></CustomPostBuild>')\n_p(' <CustomPreBuild></CustomPreBuild>')\n_p(' </AdditionalRules>')\n_p(' </Configuration>')\nend\nend\n_p(' </Settings>')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p(' <Dependencies name=\"%s\">', cfg.longname)\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p(' <Project Name=\"%s\"/>', dep.name)\nend\n_p(' </Dependencies>')\nend\nend\n_p('</CodeLite_Project>')\nend\nfunction premake.codelite_files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\" \", nestlevel + 1)\nif (state == \"GroupStart\") then\nio.write(indent .. '<VirtualDirectory Name=\"' .. path.getname(fname) .. '\">\\n')\nelseif (state == \"GroupEnd\") then\nio.write(indent .. '</VirtualDirectory>\\n')\nelse\nio.write(indent .. '<File Name=\"' .. fname .. '\"/>\\n')\nend\nend\n",
- "--\nfunction premake.make_solution(sln)\n-- create a shortcut to the compiler interface\nlocal cc = premake[_OPTIONS.cc]\n-- build a list of supported target platforms that also includes a generic build\nlocal platforms = premake.filterplatforms(sln, cc.platforms, \"Native\")\n-- write a header showing the build options\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\ntable.insert(cfgpairs, premake.getconfigname(cfgname, platform, true))\nend\nend\n_p('# %s solution makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n_p('# Usage: make [ config=config_name ]')\n_p('# Where {config_name} is one of: %s.', table.implode(cfgpairs, '\"', '\"', ', '))\n_p('')\n-- set a default configuration\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true)))\n_p('endif')\n_p('export config')\n_p('')\n-- list the projects included in the solution\n_p('PROJECTS := %s', table.concat(_MAKE.esc(table.extract(sln.projects, \"name\")), \" \"))\n_p('')\n_p('.PHONY: all clean $(PROJECTS)')\n_p('')\n_p('all: $(PROJECTS)')\n_p('')\n-- write the project build rules\nfor _, prj in ipairs(sln.projects) do\n_p('%s: %s', _MAKE.esc(prj.name), table.concat(_MAKE.esc(table.extract(premake.getdependencies(prj), \"name\")), \" \"))\n_p('\\t@echo ==== Building %s ====', prj.name)\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\n_p('')\nend\n-- clean rules\n_p('clean:')\nfor _ ,prj in ipairs(sln.projects) do\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\nend\n_p('')\nend\n",
- "--\nfunction premake.make_cpp(prj)\n-- create a shortcut to the compiler interface\nlocal cc = premake.gettool(prj)\n-- build a list of supported target platforms that also includes a generic build\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\npremake.gmake_cpp_header(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(cfg, cc)\nend\nend\n-- list intermediate files\n_p('OBJECTS := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\n_p('\\t$(OBJDIR)/%s.o \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n \n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n \n-- identify the shell type\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n-- main build rule(s)\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\nelse\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')\nend\n_p('')\n-- target build rule\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')\n_p('\\t@echo Linking %s', prj.name)\n_p('\\t$(SILENT) $(LINKCMD)')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n-- Create destination directories. Can't use $@ for this because it loses the\n-- escaping, causing issues with spaces and parenthesis\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIR):')\npremake.make_mkdirrule(\"$(OBJDIR)\")\n-- Mac OS X specific targets\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n-- clean target\n_p('clean:')\n_p('\\t@echo Cleaning %s', prj.name)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n-- custom build step targets\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n-- precompiler header rule\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nif prj.language == \"C\" then\n_p('\\t$(SILENT) $(CC) $(CFLAGS) -o $@ -c $<')\nelse\n_p('\\t$(SILENT) $(CXX) $(CXXFLAGS) -o $@ -c $<')\nend\n_p('endif')\n_p('')\n-- per-file rules\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\n_p('\\t@echo $(notdir $<)')\nif (path.iscfile(file)) then\n_p('\\t$(SILENT) $(CC) $(CFLAGS) -o $@ -c $<')\nelse\n_p('\\t$(SILENT) $(CXX) $(CXXFLAGS) -o $@ -c $<')\nend\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\n_p('\\t@echo $(notdir $<)')\n_p('\\t$(SILENT) windres $< -O coff -o $@ $(RESFLAGS)')\nend\nend\n_p('')\n-- include the dependencies, built by GCC (with the -MMD flag)\n_p('-include $(OBJECTS:%%.o=%%.d)')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n-- set up the environment\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('ifndef CC')\n_p(' CC = %s', cc.cc)\n_p('endif')\n_p('')\n_p('ifndef CXX')\n_p(' CXX = %s', cc.cxx)\n_p('endif')\n_p('')\n_p('ifndef AR')\n_p(' AR = %s', cc.ar)\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\n-- if this platform requires a special compiler or linker, list it now\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES += %s', table.concat(cc.getdefines(cfg.defines), \" \"))\n_p(' INCLUDES += %s', table.concat(cc.getincludedirs(cfg.includedirs), \" \"))\n_p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n-- set up precompiled headers\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p(' PCH = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader)))\n_p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader))) \n_p(' CPPFLAGS += -I$(OBJDIR) -include $(PCH)')\nend\n_p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), \" \"))\n_p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), \" \"))\n_p(' LDFLAGS += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), \" \"))\n_p(' LIBS += %s', table.concat(cc.getlinkflags(cfg), \" \"))\n_p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), \" \"))\n_p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\")), \" \"))\nif cfg.kind == \"StaticLib\" then\n_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')\nelse\n_p(' LINKCMD = $(%s) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == \"C\", \"CC\", \"CXX\"))\nend\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p('endif')\n_p('')\nend\n",
- "--\nlocal function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n local name = cfg.buildtarget.basename .. \".\"\n local dir = path.getdirectory(fname)\n if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\n-- Do some processing up front: build a list of configuration-dependent libraries.\n-- Libraries that are built to a location other than $(TARGETDIR) will need to\n-- be copied so they can be found at runtime.\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\n-- sort the files into categories, based on their build action\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Compile\" then\ntable.insert(sources, fcfg.name)\nelseif action == \"EmbeddedResource\" then\ntable.insert(embedded, fcfg.name)\nelseif action == \"Content\" then\ncopypairs[\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name)\nelseif path.getname(fcfg.name):lower() == \"app.config\" then\ncopypairs[\"$(TARGET).config\"] = _MAKE.esc(fcfg.name)\nend\nend\n-- Any assemblies that are on the library search paths should be copied\n-- to $(TARGETDIR) so they can be found at runtime\nlocal paths = table.translate(prj.libdirs, function(v) return path.join(prj.basedir, v) end)\npaths = table.join({prj.basedir}, paths)\nfor _, libname in ipairs(premake.getlinks(prj, \"system\", \"fullpath\")) do\nlocal libdir = os.pathsearch(libname..\".dll\", unpack(paths))\nif (libdir) then\nlocal target = \"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(libname))\nlocal source = path.getrelative(prj.basedir, path.join(libdir, libname))..\".dll\"\ncopypairs[target] = _MAKE.esc(source)\nend\nend\n-- end of preprocessing --\n-- set up the environment\n_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n_p('')\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(prj.configurations[1]:lower()))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('ifndef CSC')\n_p(' CSC=%s', csc.getcompilervar(prj))\n_p('endif')\n_p('')\n_p('ifndef RESGEN')\n_p(' RESGEN=resgen')\n_p('endif')\n_p('')\n-- Platforms aren't support for .NET projects, but I need the ability to match\n-- the buildcfg:platform identifiers with a block of settings. So enumerate the\n-- pairs the same way I do for C/C++ projects, but always use the generic settings\nlocal platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms)\ntable.insert(platforms, 1, \"\")\n-- write the configuration blocks\nfor cfg in premake.eachconfig(prj) do\n_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\n_p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir))\n_p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \"dependencies\", \"fullpath\")), \" \"))\n_p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), \"/r:\", \"\", \" \"))\n_p(' FLAGS += %s %s', table.concat(csc.getflags(cfg), \" \"), table.implode(cfg.defines, \"/d:\", \"\", \" \"))\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p('endif')\n_p('')\nend\n-- set project level values\n_p('# To maintain compatibility with VS.NET, these values must be set at the project level')\n_p('TARGET := $(TARGETDIR)/%s', _MAKE.esc(prj.buildtarget.name))\n_p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), \"/lib:\", \"\", \" \"))\n_p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, \"system\", \"basename\")), \"/r:\", \".dll\", \" \"))\n_p('')\n-- list source files\n_p('SOURCES := \\\\')\nfor _, fname in ipairs(sources) do\n_p('\\t%s \\\\', _MAKE.esc(path.translate(fname)))\nend\n_p('')\n_p('EMBEDFILES := \\\\')\nfor _, fname in ipairs(embedded) do\n_p('\\t%s \\\\', getresourcefilename(prj, fname))\nend\n_p('')\n_p('COPYFILES += \\\\')\nfor target, source in pairs(cfgpairs[anycfg]) do\n_p('\\t%s \\\\', target)\nend\nfor target, source in pairs(copypairs) do\n_p('\\t%s \\\\', target)\nend\n_p('')\n-- identify the shell type\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n-- main build rule(s)\n_p('.PHONY: clean prebuild prelink')\n_p('')\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')\n_p('')\n_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)')\n_p('\\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n-- Create destination directories. Can't use $@ for this because it loses the\n-- escaping, causing issues with spaces and parenthesis\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIR):')\npremake.make_mkdirrule(\"$(OBJDIR)\")\n-- clean target\n_p('clean:')\n_p('\\t@echo Cleaning %s', prj.name)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGETDIR)/%s.* $(COPYFILES)', prj.buildtarget.basename)\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGETDIR)/%s.*) del $(subst /,\\\\\\\\,$(TARGETDIR)/%s.*)', prj.buildtarget.basename, prj.buildtarget.basename)\nfor target, source in pairs(cfgpairs[anycfg]) do\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,%s) del $(subst /,\\\\\\\\,%s)', target, target)\nend\nfor target, source in pairs(copypairs) do\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,%s) del $(subst /,\\\\\\\\,%s)', target, target)\nend\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n-- custom build step targets\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n-- per-file rules\n_p('# Per-configuration copied file rules')\nfor cfg in premake.eachconfig(prj) do\n_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\nfor target, source in pairs(cfgpairs[cfg]) do\npremake.make_copyrule(source, target)\nend\n_p('endif')\n_p('')\nend\n_p('# Copied file rules')\nfor target, source in pairs(copypairs) do\npremake.make_copyrule(source, target)\nend\n_p('# Embedded file rules')\nfor _, fname in ipairs(embedded) do \nif path.getextension(fname) == \".resx\" then\n_p('%s: %s', getresourcefilename(prj, fname), _MAKE.esc(fname))\n_p('\\t$(SILENT) $(RESGEN) $^ $@')\nend\n_p('')\nend\nend\n",
- "--\nfunction premake.vs2002_solution(sln)\nio.eol = '\\r\\n'\n_p('Microsoft Visual Studio Solution File, Format Version 7.00')\n-- Write out the list of project entries\nfor prj in premake.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\n_p('EndProject')\nend\n_p('Global')\n_p('\\tGlobalSection(SolutionConfiguration) = preSolution')\nfor i, cfgname in ipairs(sln.configurations) do\n_p('\\t\\tConfigName.%d = %s', i - 1, cfgname)\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectDependencies) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectConfiguration) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\n_p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\nend\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityGlobals) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityAddIns) = postSolution')\n_p('\\tEndGlobalSection')\n_p('EndGlobal')\nend\n",
- "--\n--\n-- Figure out what elements a particular file need in its item block,\n-- based on its build action and any related files in the project.\n-- \nlocal function getelements(prj, action, fname)\nif action == \"Compile\" and fname:endswith(\".cs\") then\nreturn \"SubTypeCode\"\nend\nif action == \"EmbeddedResource\" and fname:endswith(\".resx\") then\n-- is there a matching *.cs file?\nlocal basename = fname:sub(1, -6)\nlocal testname = path.getname(basename .. \".cs\")\nif premake.findfile(prj, testname) then\nreturn \"Dependency\", testname\nend\nend\nreturn \"None\"\nend\nfunction premake.vs2002_csproj(prj)\nio.eol = \"\\r\\n\"\n_p('<VisualStudioProject>')\n_p('\\t<CSHARP')\n_p('\\t\\tProjectType = \"Local\"')\n_p('\\t\\tProductVersion = \"%s\"', iif(_ACTION == \"vs2002\", \"7.0.9254\", \"7.10.3077\"))\n_p('\\t\\tSchemaVersion = \"%s\"', iif(_ACTION == \"vs2002\", \"1.0\", \"2.0\"))\n_p('\\t\\tProjectGuid = \"{%s}\"', prj.uuid)\n_p('\\t>')\n_p('\\t\\t<Build>')\n-- Write out project-wide settings\n_p('\\t\\t\\t<Settings')\n_p('\\t\\t\\t\\tApplicationIcon = \"\"')\n_p('\\t\\t\\t\\tAssemblyKeyContainerName = \"\"')\n_p('\\t\\t\\t\\tAssemblyName = \"%s\"', prj.buildtarget.basename)\n_p('\\t\\t\\t\\tAssemblyOriginatorKeyFile = \"\"')\n_p('\\t\\t\\t\\tDefaultClientScript = \"JScript\"')\n_p('\\t\\t\\t\\tDefaultHTMLPageLayout = \"Grid\"')\n_p('\\t\\t\\t\\tDefaultTargetSchema = \"IE50\"')\n_p('\\t\\t\\t\\tDelaySign = \"false\"')\nif _ACTION == \"vs2002\" then\n_p('\\t\\t\\t\\tNoStandardLibraries = \"false\"')\nend\n_p('\\t\\t\\t\\tOutputType = \"%s\"', premake.dotnet.getkind(prj))\nif _ACTION == \"vs2003\" then\n_p('\\t\\t\\t\\tPreBuildEvent = \"\"')\n_p('\\t\\t\\t\\tPostBuildEvent = \"\"')\nend\n_p('\\t\\t\\t\\tRootNamespace = \"%s\"', prj.buildtarget.basename)\nif _ACTION == \"vs2003\" then\n_p('\\t\\t\\t\\tRunPostBuildEvent = \"OnBuildSuccess\"')\nend\n_p('\\t\\t\\t\\tStartupObject = \"\"')\n_p('\\t\\t\\t>')\n-- Write out configuration blocks\nfor cfg in premake.eachconfig(prj) do\n_p('\\t\\t\\t\\t<Config')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', premake.esc(cfg.name))\n_p('\\t\\t\\t\\t\\tAllowUnsafeBlocks = \"%s\"', iif(cfg.flags.Unsafe, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tBaseAddress = \"285212672\"')\n_p('\\t\\t\\t\\t\\tCheckForOverflowUnderflow = \"false\"')\n_p('\\t\\t\\t\\t\\tConfigurationOverrideFile = \"\"')\n_p('\\t\\t\\t\\t\\tDefineConstants = \"%s\"', premake.esc(table.concat(cfg.defines, \";\")))\n_p('\\t\\t\\t\\t\\tDocumentationFile = \"\"')\n_p('\\t\\t\\t\\t\\tDebugSymbols = \"%s\"', iif(cfg.flags.Symbols, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tFileAlignment = \"4096\"')\n_p('\\t\\t\\t\\t\\tIncrementalBuild = \"false\"')\nif _ACTION == \"vs2003\" then\n_p('\\t\\t\\t\\t\\tNoStdLib = \"false\"')\n_p('\\t\\t\\t\\t\\tNoWarn = \"\"')\nend\n_p('\\t\\t\\t\\t\\tOptimize = \"%s\"', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tOutputPath = \"%s\"', premake.esc(cfg.buildtarget.directory))\n_p('\\t\\t\\t\\t\\tRegisterForComInterop = \"false\"')\n_p('\\t\\t\\t\\t\\tRemoveIntegerChecks = \"false\"')\n_p('\\t\\t\\t\\t\\tTreatWarningsAsErrors = \"%s\"', iif(cfg.flags.FatalWarnings, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tWarningLevel = \"4\"')\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</Settings>')\n-- List assembly references\n_p('\\t\\t\\t<References>')\nfor _, ref in ipairs(premake.getlinks(prj, \"siblings\", \"object\")) do\n_p('\\t\\t\\t\\t<Reference')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', ref.buildtarget.basename)\n_p('\\t\\t\\t\\t\\tProject = \"{%s}\"', ref.uuid)\n_p('\\t\\t\\t\\t\\tPackage = \"{%s}\"', _VS.tool(ref))\n_p('\\t\\t\\t\\t/>')\nend\nfor _, linkname in ipairs(premake.getlinks(prj, \"system\", \"fullpath\")) do\n_p('\\t\\t\\t\\t<Reference')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', path.getbasename(linkname))\n_p('\\t\\t\\t\\t\\tAssemblyName = \"%s\"', path.getname(linkname))\nif path.getdirectory(linkname) ~= \".\" then\n_p('\\t\\t\\t\\t\\tHintPath = \"%s\"', path.translate(linkname, \"\\\\\"))\nend\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</References>')\n_p('\\t\\t</Build>')\n-- List source files\n_p('\\t\\t<Files>')\n_p('\\t\\t\\t<Include>')\nfor fcfg in premake.eachfile(prj) do\nlocal action = premake.dotnet.getbuildaction(fcfg)\nlocal fname = path.translate(premake.esc(fcfg.name), \"\\\\\")\nlocal elements, dependency = getelements(prj, action, fcfg.name)\n_p('\\t\\t\\t\\t<File')\n_p('\\t\\t\\t\\t\\tRelPath = \"%s\"', premake.esc(fname))\n_p('\\t\\t\\t\\t\\tBuildAction = \"%s\"', action)\nif dependency then\n_p('\\t\\t\\t\\t\\tDependentUpon = \"%s\"', premake.esc(path.translate(dependency, \"\\\\\")))\nend\nif elements == \"SubTypeCode\" then\n_p('\\t\\t\\t\\t\\tSubType = \"Code\"')\nend\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</Include>')\n_p('\\t\\t</Files>')\n_p('\\t</CSHARP>')\n_p('</VisualStudioProject>')\nend\n",
- "--\nfunction premake.vs2002_csproj_user(prj)\nio.eol = \"\\r\\n\"\n_p('<VisualStudioProject>')\n_p('\\t<CSHARP>')\n_p('\\t\\t<Build>')\n-- Visual Studio wants absolute paths\nlocal refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. \"/\" .. v) end)\n_p('\\t\\t\\t<Settings ReferencePath = \"%s\">', path.translate(table.concat(refpaths, \";\"), \"\\\\\"))\nfor cfg in premake.eachconfig(prj) do\n_p('\\t\\t\\t\\t<Config')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', premake.esc(cfg.name))\n_p('\\t\\t\\t\\t\\tEnableASPDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tEnableASPXDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tEnableUnmanagedDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tEnableSQLServerDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tRemoteDebugEnabled = \"false\"')\n_p('\\t\\t\\t\\t\\tRemoteDebugMachine = \"\"')\n_p('\\t\\t\\t\\t\\tStartAction = \"Project\"')\n_p('\\t\\t\\t\\t\\tStartArguments = \"\"')\n_p('\\t\\t\\t\\t\\tStartPage = \"\"')\n_p('\\t\\t\\t\\t\\tStartProgram = \"\"')\n_p('\\t\\t\\t\\t\\tStartURL = \"\"')\n_p('\\t\\t\\t\\t\\tStartWorkingDirectory = \"\"')\n_p('\\t\\t\\t\\t\\tStartWithIE = \"false\"')\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</Settings>')\n_p('\\t\\t</Build>')\n_p('\\t\\t<OtherProjectSettings')\n_p('\\t\\t\\tCopyProjectDestinationFolder = \"\"')\n_p('\\t\\t\\tCopyProjectUncPath = \"\"')\n_p('\\t\\t\\tCopyProjectOption = \"0\"')\n_p('\\t\\t\\tProjectView = \"ProjectFiles\"')\n_p('\\t\\t\\tProjectTrust = \"0\"')\n_p('\\t\\t/>')\n_p('\\t</CSHARP>')\n_p('</VisualStudioProject>')\nend\n",
- "--\nfunction premake.vs200x_vcproj_platforms(prj)\nlocal used = { }\n_p('\\t<Platforms>')\nfor _, cfg in ipairs(prj.solution.vstudio_configs) do\nif cfg.isreal and not table.contains(used, cfg.platform) then\ntable.insert(used, cfg.platform)\n_p('\\t\\t<Platform')\n_p('\\t\\t\\tName=\"%s\"', cfg.platform)\n_p('\\t\\t/>')\nend\nend\n_p('\\t</Platforms>')\nend\nfunction premake.vs200x_vcproj_symbols(cfg)\nif (not cfg.flags.Symbols) then\nreturn 0\nelse\n-- Edit-and-continue does't work for some configurations\nif cfg.flags.NoEditAndContinue or \n _VS.optimization(cfg) ~= 0 or \n cfg.flags.Managed or \n cfg.platform == \"x64\" then\nreturn 3\nelse\nreturn 4\nend\nend\nend\nfunction premake.vs200x_vcproj_VCCLCompilerTool(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"%s\"', iif(cfg.platform ~= \"Xbox360\", \"VCCLCompilerTool\", \"VCCLX360CompilerTool\"))\nif #cfg.buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', table.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p('\\t\\t\\t\\tOptimization=\"%s\"', _VS.optimization(cfg))\nif cfg.flags.NoFramePointer then\n_p('\\t\\t\\t\\tOmitFramePointers=\"%s\"', _VS.bool(true))\nend\nif #cfg.includedirs > 0 then\n_p('\\t\\t\\t\\tAdditionalIncludeDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nif #cfg.defines > 0 then\n_p('\\t\\t\\t\\tPreprocessorDefinitions=\"%s\"', premake.esc(table.concat(cfg.defines, \";\")))\nend\nif cfg.flags.Symbols and not cfg.flags.Managed then\n_p('\\t\\t\\t\\tMinimalRebuild=\"%s\"', _VS.bool(true))\nend\nif cfg.flags.NoExceptions then\n_p('\\t\\t\\t\\tExceptionHandling=\"%s\"', iif(_ACTION < \"vs2005\", \"FALSE\", 0))\nelseif cfg.flags.SEH and _ACTION > \"vs2003\" then\n_p('\\t\\t\\t\\tExceptionHandling=\"2\"')\nend\nif _VS.optimization(cfg) == 0 and not cfg.flags.Managed then\n_p('\\t\\t\\t\\tBasicRuntimeChecks=\"3\"')\nend\nif _VS.optimization(cfg) ~= 0 then\n_p('\\t\\t\\t\\tStringPooling=\"%s\"', _VS.bool(true))\nend\n_p('\\t\\t\\t\\tRuntimeLibrary=\"%s\"', _VS.runtime(cfg))\n_p('\\t\\t\\t\\tEnableFunctionLevelLinking=\"%s\"', _VS.bool(true))\nif _ACTION < \"vs2005\" and not cfg.flags.NoRTTI then\n_p('\\t\\t\\t\\tRuntimeTypeInfo=\"%s\"', _VS.bool(true))\nelseif _ACTION > \"vs2003\" and cfg.flags.NoRTTI then\n_p('\\t\\t\\t\\tRuntimeTypeInfo=\"%s\"', _VS.bool(false))\nend\nif cfg.flags.NativeWChar then\n_p('\\t\\t\\t\\tTreatWChar_tAsBuiltInType=\"%s\"', _VS.bool(true))\nelseif cfg.flags.NoNativeWChar then\n_p('\\t\\t\\t\\tTreatWChar_tAsBuiltInType=\"%s\"', _VS.bool(false))\nend\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p('\\t\\t\\t\\tUsePrecompiledHeader=\"%s\"', iif(_ACTION < \"vs2005\", 3, 2))\n_p('\\t\\t\\t\\tPrecompiledHeaderThrough=\"%s\"', cfg.pchheader)\nelse\n_p('\\t\\t\\t\\tUsePrecompiledHeader=\"%s\"', iif(_ACTION > \"vs2003\" or cfg.flags.NoPCH, 0, 2))\nend\n_p('\\t\\t\\t\\tWarningLevel=\"%s\"', iif(cfg.flags.ExtraWarnings, 4, 3))\nif cfg.flags.FatalWarnings then\n_p('\\t\\t\\t\\tWarnAsError=\"%s\"', _VS.bool(true))\nend\nif _ACTION < \"vs2008\" and not cfg.flags.Managed then\n_p('\\t\\t\\t\\tDetect64BitPortabilityProblems=\"%s\"', _VS.bool(not cfg.flags.No64BitChecks))\nend\n_p('\\t\\t\\t\\tProgramDataBaseFileName=\"$(OutDir)\\\\$(ProjectName).pdb\"')\n_p('\\t\\t\\t\\tDebugInformationFormat=\"%s\"', premake.vs200x_vcproj_symbols(cfg))\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCLinkerTool(cfg)\n_p('\\t\\t\\t<Tool')\nif cfg.kind ~= \"StaticLib\" then\n_p('\\t\\t\\t\\tName=\"%s\"', iif(cfg.platform ~= \"Xbox360\", \"VCLinkerTool\", \"VCX360LinkerTool\"))\nif cfg.flags.NoImportLib then\n_p('\\t\\t\\t\\tIgnoreImportLibrary=\"%s\"', _VS.bool(true))\nend\nif #cfg.linkoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', table.concat(premake.esc(cfg.linkoptions), \" \"))\nend\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\n_p('\\t\\t\\t\\tLinkIncremental=\"%s\"', iif(_VS.optimization(cfg) == 0, 2, 1))\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"))\nlocal deffile = premake.findfile(cfg, \".def\")\nif deffile then\n_p('\\t\\t\\t\\tModuleDefinitionFile=\"%s\"', deffile)\nend\nif cfg.flags.NoManifest then\n_p('\\t\\t\\t\\tGenerateManifest=\"%s\"', _VS.bool(false))\nend\n_p('\\t\\t\\t\\tGenerateDebugInformation=\"%s\"', _VS.bool(premake.vs200x_vcproj_symbols(cfg) ~= 0))\nif premake.vs200x_vcproj_symbols(cfg) ~= 0 then\n_p('\\t\\t\\t\\tProgramDatabaseFile=\"$(OutDir)\\\\$(ProjectName).pdb\"')\nend\n_p('\\t\\t\\t\\tSubSystem=\"%s\"', iif(cfg.kind == \"ConsoleApp\", 1, 2))\nif _VS.optimization(cfg) ~= 0 then\n_p('\\t\\t\\t\\tOptimizeReferences=\"2\"')\n_p('\\t\\t\\t\\tEnableCOMDATFolding=\"2\"')\nend\nif (cfg.kind == \"ConsoleApp\" or cfg.kind == \"WindowedApp\") and not cfg.flags.WinMain then\n_p('\\t\\t\\t\\tEntryPointSymbol=\"mainCRTStartup\"')\nend\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p('\\t\\t\\t\\tImportLibrary=\"%s\"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\n_p('\\t\\t\\t\\tTargetMachine=\"%d\"', iif(cfg.platform == \"x64\", 17, 1))\nelse\n_p('\\t\\t\\t\\tName=\"VCLibrarianTool\"')\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\nif #cfg.libdirs > 0 then\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.libdirs , \";\"))))\nend\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCCLCompilerTool_GCC(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCCLCompilerTool\"')\nlocal buildoptions = table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions)\nif #buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', premake.esc(table.concat(buildoptions, \" \")))\nend\nif #cfg.includedirs > 0 then\n_p('\\t\\t\\t\\tAdditionalIncludeDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nif #cfg.defines > 0 then\n_p('\\t\\t\\t\\tPreprocessorDefinitions=\"%s\"', table.concat(premake.esc(cfg.defines), \";\"))\nend\n_p('\\t\\t\\t\\tProgramDataBaseFileName=\"$(OutDir)\\\\$(ProjectName).pdb\"')\n_p('\\t\\t\\t\\tDebugInformationFormat=\"0\"')\n_p('\\t\\t\\t\\tCompileAs=\"0\"')\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCLinkerTool_GCC(cfg)\n_p('\\t\\t\\t<Tool')\nif cfg.kind ~= \"StaticLib\" then\n_p('\\t\\t\\t\\tName=\"VCLinkerTool\"')\nlocal buildoptions = table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)\nif #buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', premake.esc(table.concat(buildoptions, \" \")))\nend\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\n_p('\\t\\t\\t\\tLinkIncremental=\"0\"')\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"))\n_p('\\t\\t\\t\\tGenerateManifest=\"%s\"', _VS.bool(false))\n_p('\\t\\t\\t\\tProgramDatabaseFile=\"\"')\n_p('\\t\\t\\t\\tRandomizedBaseAddress=\"1\"')\n_p('\\t\\t\\t\\tDataExecutionPrevention=\"0\"')\nelse\n_p('\\t\\t\\t\\tName=\"VCLibrarianTool\"')\nlocal buildoptions = table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)\nif #buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', premake.esc(table.concat(buildoptions, \" \")))\nend\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\nif #cfg.libdirs > 0 then\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.libdirs , \";\"))))\nend\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCResourceCompilerTool(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCResourceCompilerTool\"')\nif #cfg.resoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', table.concat(premake.esc(cfg.resoptions), \" \"))\nend\nif #cfg.defines > 0 or #cfg.resdefines > 0 then\n_p('\\t\\t\\t\\tPreprocessorDefinitions=\"%s\"', table.concat(premake.esc(table.join(cfg.defines, cfg.resdefines)), \";\"))\nend\nif #cfg.includedirs > 0 or #cfg.resincludedirs > 0 then\nlocal dirs = table.join(cfg.includedirs, cfg.resincludedirs)\n_p('\\t\\t\\t\\tAdditionalIncludeDirectories=\"%s\"', premake.esc(path.translate(table.concat(dirs, \";\"), '\\\\')))\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCManifestTool(cfg)\n-- locate all manifest files\nlocal manifests = { }\nfor _, fname in ipairs(cfg.files) do\nif path.getextension(fname) == \".manifest\" then\ntable.insert(manifests, fname)\nend\nend\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCManifestTool\"')\nif #manifests > 0 then\n_p('\\t\\t\\t\\tAdditionalManifestFiles=\"%s\"', premake.esc(table.concat(manifests, \";\")))\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCMIDLTool(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCMIDLTool\"')\nif cfg.platform == \"x64\" then\n_p('\\t\\t\\t\\tTargetEnvironment=\"3\"')\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_buildstepsblock(name, steps)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"%s\"', name)\nif #steps > 0 then\n_p('\\t\\t\\t\\tCommandLine=\"%s\"', premake.esc(table.implode(steps, \"\", \"\", \"\\r\\n\")))\nend\n_p('\\t\\t\\t/>')\nend\nlocal blockmap = \n{\nVCCLCompilerTool = premake.vs200x_vcproj_VCCLCompilerTool,\nVCCLCompilerTool_GCC = premake.vs200x_vcproj_VCCLCompilerTool_GCC,\nVCLinkerTool = premake.vs200x_vcproj_VCLinkerTool,\nVCLinkerTool_GCC = premake.vs200x_vcproj_VCLinkerTool_GCC,\nVCManifestTool = premake.vs200x_vcproj_VCManifestTool,\nVCMIDLTool = premake.vs200x_vcproj_VCMIDLTool,\nVCResourceCompilerTool = premake.vs200x_vcproj_VCResourceCompilerTool,\n}\nlocal function getsections(version, platform)\nif version == \"vs2002\" then\nreturn {\n\"VCCLCompilerTool\",\n\"VCCustomBuildTool\",\n\"VCLinkerTool\",\n\"VCMIDLTool\",\n\"VCPostBuildEventTool\",\n\"VCPreBuildEventTool\",\n\"VCPreLinkEventTool\",\n\"VCResourceCompilerTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCWebDeploymentTool\"\n}\nend\nif version == \"vs2003\" then\nreturn {\n\"VCCLCompilerTool\",\n\"VCCustomBuildTool\",\n\"VCLinkerTool\",\n\"VCMIDLTool\",\n\"VCPostBuildEventTool\",\n\"VCPreBuildEventTool\",\n\"VCPreLinkEventTool\",\n\"VCResourceCompilerTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebDeploymentTool\",\n\"VCManagedWrapperGeneratorTool\",\n\"VCAuxiliaryManagedWrapperGeneratorTool\"\n}\nend\nif platform == \"Xbox360\" then\nreturn {\n\"VCPreBuildEventTool\",\n\"VCCustomBuildTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCMIDLTool\",\n\"VCCLCompilerTool\",\n\"VCManagedResourceCompilerTool\",\n\"VCResourceCompilerTool\",\n\"VCPreLinkEventTool\",\n\"VCX360LinkerTool\",\n\"VCALinkTool\",\n\"VCX360ImageTool\",\n\"VCBscMakeTool\",\n\"VCX360DeploymentTool\",\n\"VCPostBuildEventTool\",\n\"DebuggerTool\",\n}\nend\nif platform == \"PS3\" then\nreturn {\n\"VCPreBuildEventTool\",\n\"VCCustomBuildTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCMIDLTool\",\n\"VCCLCompilerTool_GCC\",\n\"VCManagedResourceCompilerTool\",\n\"VCResourceCompilerTool\",\n\"VCPreLinkEventTool\",\n\"VCLinkerTool_GCC\",\n\"VCALinkTool\",\n\"VCManifestTool\",\n\"VCXDCMakeTool\",\n\"VCBscMakeTool\",\n\"VCFxCopTool\",\n\"VCAppVerifierTool\",\n\"VCWebDeploymentTool\",\n\"VCPostBuildEventTool\"\n}\nelse\nreturn {\n\"VCPreBuildEventTool\",\n\"VCCustomBuildTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCMIDLTool\",\n\"VCCLCompilerTool\",\n\"VCManagedResourceCompilerTool\",\n\"VCResourceCompilerTool\",\n\"VCPreLinkEventTool\",\n\"VCLinkerTool\",\n\"VCALinkTool\",\n\"VCManifestTool\",\n\"VCXDCMakeTool\",\n\"VCBscMakeTool\",\n\"VCFxCopTool\",\n\"VCAppVerifierTool\",\n\"VCWebDeploymentTool\",\n\"VCPostBuildEventTool\"\n}\nend\nend\nfunction premake.vs200x_vcproj(prj)\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"Windows-1252\"?>')\n-- Write opening project block\n_p('<VisualStudioProject')\n_p('\\tProjectType=\"Visual C++\"')\nif _ACTION == \"vs2002\" then\n_p('\\tVersion=\"7.00\"')\nelseif _ACTION == \"vs2003\" then\n_p('\\tVersion=\"7.10\"')\nelseif _ACTION == \"vs2005\" then\n_p('\\tVersion=\"8.00\"')\nelseif _ACTION == \"vs2008\" then\n_p('\\tVersion=\"9.00\"')\nend\n_p('\\tName=\"%s\"', premake.esc(prj.name))\n_p('\\tProjectGUID=\"{%s}\"', prj.uuid)\nif _ACTION > \"vs2003\" then\n_p('\\tRootNamespace=\"%s\"', prj.name)\nend\n_p('\\tKeyword=\"%s\"', iif(prj.flags.Managed, \"ManagedCProj\", \"Win32Proj\"))\n_p('\\t>')\n-- list the target platforms\npremake.vs200x_vcproj_platforms(prj)\nif _ACTION > \"vs2003\" then\n_p('\\t<ToolFiles>')\n_p('\\t</ToolFiles>')\nend\n_p('\\t<Configurations>')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nif cfginfo.isreal then\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n-- Start a configuration\n_p('\\t\\t<Configuration')\n_p('\\t\\t\\tName=\"%s\"', premake.esc(cfginfo.name))\n_p('\\t\\t\\tOutputDirectory=\"%s\"', premake.esc(cfg.buildtarget.directory))\n_p('\\t\\t\\tIntermediateDirectory=\"%s\"', premake.esc(cfg.objectsdir))\n_p('\\t\\t\\tConfigurationType=\"%s\"', _VS.cfgtype(cfg))\n_p('\\t\\t\\tCharacterSet=\"%s\"', iif(cfg.flags.Unicode, 1, 2))\nif cfg.flags.Managed then\n_p('\\t\\t\\tManagedExtensions=\"true\"')\nend\n_p('\\t\\t\\t>')\nfor _, block in ipairs(getsections(_ACTION, cfginfo.src_platform)) do\nif blockmap[block] then\nblockmap[block](cfg)\n-- Build event blocks --\nelseif block == \"VCPreBuildEventTool\" then\npremake.vs200x_vcproj_buildstepsblock(\"VCPreBuildEventTool\", cfg.prebuildcommands)\nelseif block == \"VCPreLinkEventTool\" then\npremake.vs200x_vcproj_buildstepsblock(\"VCPreLinkEventTool\", cfg.prelinkcommands)\nelseif block == \"VCPostBuildEventTool\" then\npremake.vs200x_vcproj_buildstepsblock(\"VCPostBuildEventTool\", cfg.postbuildcommands)\n-- End build event blocks --\n-- Xbox 360 custom sections --\nelseif block == \"VCX360DeploymentTool\" then\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCX360DeploymentTool\"')\n_p('\\t\\t\\t\\tDeploymentType=\"0\"')\n_p('\\t\\t\\t/>')\nelseif block == \"DebuggerTool\" then\n_p('\\t\\t\\t<DebuggerTool')\n_p('\\t\\t\\t/>')\n-- End Xbox 360 custom sections --\nelse\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"%s\"', block)\n_p('\\t\\t\\t/>')\nend\nend\n_p('\\t\\t</Configuration>')\nend\nend\n_p('\\t</Configurations>')\n_p('\\t<References>')\n_p('\\t</References>')\n_p('\\t<Files>')\npremake.walksources(prj, _VS.files)\n_p('\\t</Files>')\n_p('\\t<Globals>')\n_p('\\t</Globals>')\n_p('</VisualStudioProject>')\nend\n",
- "--\nfunction premake.vs2003_solution(sln)\nio.eol = '\\r\\n'\n_p('Microsoft Visual Studio Solution File, Format Version 8.00')\n-- Write out the list of project entries\nfor prj in premake.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\n_p('\\tProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p('\\t\\t{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p('\\tEndProjectSection')\nend\n_p('EndProject')\nend\n_p('Global')\n_p('\\tGlobalSection(SolutionConfiguration) = preSolution')\nfor _, cfgname in ipairs(sln.configurations) do\n_p('\\t\\t%s = %s', cfgname, cfgname)\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectDependencies) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectConfiguration) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\n_p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\nend\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityGlobals) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityAddIns) = postSolution')\n_p('\\tEndGlobalSection')\n_p('EndGlobal')\nend\n",
- "--\nfunction premake.vs2005_solution(sln)\nio.eol = '\\r\\n'\n-- Precompute Visual Studio configurations\nsln.vstudio_configs = premake.vstudio_buildconfigs(sln)\n-- Mark the file as Unicode\n_p('\\239\\187\\191')\n-- Write the solution file version header\n_p('Microsoft Visual Studio Solution File, Format Version %s', iif(_ACTION == 'vs2005', '9.00', '10.00'))\n_p('# Visual Studio %s', iif(_ACTION == 'vs2005', '2005', '2008'))\n-- Write out the list of project entries\nfor prj in premake.eachproject(sln) do\n-- Build a relative path from the solution file to the project file\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)), \"\\\\\")\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\n_p('\\tProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p('\\t\\t{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p('\\tEndProjectSection')\nend\n_p('EndProject')\nend\n_p('Global')\npremake.vs2005_solution_platforms(sln)\npremake.vs2005_solution_project_platforms(sln)\npremake.vs2005_solution_properties(sln)\n_p('EndGlobal')\nend\nfunction premake.vs2005_solution_platforms(sln)\n_p('\\tGlobalSection(SolutionConfigurationPlatforms) = preSolution')\nfor _, cfg in ipairs(sln.vstudio_configs) do\n_p('\\t\\t%s = %s', cfg.name, cfg.name)\nend\n_p('\\tEndGlobalSection')\nend\nfunction premake.vs2005_solution_project_platforms(sln)\n_p('\\tGlobalSection(ProjectConfigurationPlatforms) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfg in ipairs(sln.vstudio_configs) do\n-- .NET projects always map to the \"Any CPU\" platform (for now, at \n-- least). For C++, \"Any CPU\" and \"Mixed Platforms\" map to the first\n-- C++ compatible target platform in the solution list.\nlocal mapped\nif premake.isdotnetproject(prj) then\nmapped = \"Any CPU\"\nelse\nif cfg.platform == \"Any CPU\" or cfg.platform == \"Mixed Platforms\" then\nmapped = sln.vstudio_configs[3].platform\nelse\nmapped = cfg.platform\nend\nend\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\nif mapped == cfg.platform or cfg.platform == \"Mixed Platforms\" then\n_p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\nend\nend\nend\n_p('\\tEndGlobalSection')\nend\nfunction premake.vs2005_solution_properties(sln)\n_p('\\tGlobalSection(SolutionProperties) = preSolution')\n_p('\\t\\tHideSolutionNode = FALSE')\n_p('\\tEndGlobalSection')\nend\n",
- "--\n--\n-- Figure out what elements a particular source code file need in its item\n-- block, based on its build action and any related files in the project.\n-- \nlocal function getelements(prj, action, fname)\nif action == \"Compile\" and fname:endswith(\".cs\") then\nif fname:endswith(\".Designer.cs\") then\n-- is there a matching *.cs file?\nlocal basename = fname:sub(1, -13)\nlocal testname = basename .. \".cs\"\nif premake.findfile(prj, testname) then\nreturn \"Dependency\", testname\nend\n-- is there a matching *.resx file?\ntestname = basename .. \".resx\"\nif premake.findfile(prj, testname) then\nreturn \"AutoGen\", testname\nend\nelse\n-- is there a *.Designer.cs file?\nlocal basename = fname:sub(1, -4)\nlocal testname = basename .. \".Designer.cs\"\nif premake.findfile(prj, testname) then\nreturn \"SubTypeForm\"\nend\nend\nend\nif action == \"EmbeddedResource\" and fname:endswith(\".resx\") then\n-- is there a matching *.cs file?\nlocal basename = fname:sub(1, -6)\nlocal testname = path.getname(basename .. \".cs\")\nif premake.findfile(prj, testname) then\nif premake.findfile(prj, basename .. \".Designer.cs\") then\nreturn \"DesignerType\", testname\nelse\nreturn \"Dependency\", testname\nend\nelse\n-- is there a matching *.Designer.cs?\ntestname = path.getname(basename .. \".Designer.cs\")\nif premake.findfile(prj, testname) then\nreturn \"AutoGenerated\"\nend\nend\nend\nif action == \"Content\" then\nreturn \"CopyNewest\"\nend\nreturn \"None\"\nend\nfunction premake.vs2005_csproj(prj)\nio.eol = \"\\r\\n\"\nlocal vsversion, toolversion\nif _ACTION == \"vs2005\" then\nvsversion = \"8.0.50727\"\ntoolversion = nil\nelseif _ACTION == \"vs2008\" then\nvsversion = \"9.0.21022\"\ntoolversion = \"3.5\"\nend\nif toolversion then\n_p('<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"%s\">', toolversion)\nelse\n_p('<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nend\n_p(' <PropertyGroup>')\n_p(' <Configuration Condition=\" \\'$(Configuration)\\' == \\'\\' \">%s</Configuration>', premake.esc(prj.solution.configurations[1]))\n_p(' <Platform Condition=\" \\'$(Platform)\\' == \\'\\' \">AnyCPU</Platform>')\n_p(' <ProductVersion>%s</ProductVersion>', vsversion)\n_p(' <SchemaVersion>2.0</SchemaVersion>')\n_p(' <ProjectGuid>{%s}</ProjectGuid>', prj.uuid)\n_p(' <OutputType>%s</OutputType>', premake.dotnet.getkind(prj))\n_p(' <AppDesignerFolder>Properties</AppDesignerFolder>')\n_p(' <RootNamespace>%s</RootNamespace>', prj.buildtarget.basename)\n_p(' <AssemblyName>%s</AssemblyName>', prj.buildtarget.basename)\n_p(' </PropertyGroup>')\nfor cfg in premake.eachconfig(prj) do\n_p(' <PropertyGroup Condition=\" \\'$(Configuration)|$(Platform)\\' == \\'%s|AnyCPU\\' \">', premake.esc(cfg.name))\nif cfg.flags.Symbols then\n_p(' <DebugSymbols>true</DebugSymbols>')\n_p(' <DebugType>full</DebugType>')\nelse\n_p(' <DebugType>pdbonly</DebugType>')\nend\n_p(' <Optimize>%s</Optimize>', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, \"true\", \"false\"))\n_p(' <OutputPath>%s</OutputPath>', cfg.buildtarget.directory)\n_p(' <DefineConstants>%s</DefineConstants>', table.concat(premake.esc(cfg.defines), \";\"))\n_p(' <ErrorReport>prompt</ErrorReport>')\n_p(' <WarningLevel>4</WarningLevel>')\nif cfg.flags.Unsafe then\n_p(' <AllowUnsafeBlocks>true</AllowUnsafeBlocks>')\nend\nif cfg.flags.FatalWarnings then\n_p(' <TreatWarningsAsErrors>true</TreatWarningsAsErrors>')\nend\n_p(' </PropertyGroup>')\nend\n_p(' <ItemGroup>')\nfor _, ref in ipairs(premake.getlinks(prj, \"siblings\", \"object\")) do\n_p(' <ProjectReference Include=\"%s\">', path.translate(path.getrelative(prj.location, _VS.projectfile(ref)), \"\\\\\"))\n_p(' <Project>{%s}</Project>', ref.uuid)\n_p(' <Name>%s</Name>', premake.esc(ref.name))\n_p(' </ProjectReference>')\nend\nfor _, linkname in ipairs(premake.getlinks(prj, \"system\", \"basename\")) do\n_p(' <Reference Include=\"%s\" />', premake.esc(linkname))\nend\n_p(' </ItemGroup>')\n_p(' <ItemGroup>')\nfor fcfg in premake.eachfile(prj) do\nlocal action = premake.dotnet.getbuildaction(fcfg)\nlocal fname = path.translate(premake.esc(fcfg.name), \"\\\\\")\nlocal elements, dependency = getelements(prj, action, fcfg.name)\nif elements == \"None\" then\n_p(' <%s Include=\"%s\" />', action, fname)\nelse\n_p(' <%s Include=\"%s\">', action, fname)\nif elements == \"AutoGen\" then\n_p(' <AutoGen>True</AutoGen>')\nelseif elements == \"AutoGenerated\" then\n_p(' <SubType>Designer</SubType>')\n_p(' <Generator>ResXFileCodeGenerator</Generator>')\n_p(' <LastGenOutput>%s.Designer.cs</LastGenOutput>', premake.esc(path.getbasename(fcfg.name)))\nelseif elements == \"SubTypeDesigner\" then\n_p(' <SubType>Designer</SubType>')\nelseif elements == \"SubTypeForm\" then\n_p(' <SubType>Form</SubType>')\nelseif elements == \"PreserveNewest\" then\n_p(' <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>')\nend\nif dependency then\n_p(' <DependentUpon>%s</DependentUpon>', path.translate(premake.esc(dependency), \"\\\\\"))\nend\n_p(' </%s>', action)\nend\nend\n_p(' </ItemGroup>')\n_p(' <Import Project=\"$(MSBuildBinPath)\\\\Microsoft.CSharp.targets\" />')\n_p(' <!-- To modify your build process, add your task inside one of the targets below and uncomment it.')\n_p(' Other similar extension points exist, see Microsoft.Common.targets.')\n_p(' <Target Name=\"BeforeBuild\">')\n_p(' </Target>')\n_p(' <Target Name=\"AfterBuild\">')\n_p(' </Target>')\n_p(' -->')\n_p('</Project>')\nend\n",
- "--\nfunction premake.vs2005_csproj_user(prj)\nio.eol = \"\\r\\n\"\n_p('<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\n_p(' <PropertyGroup>')\nlocal refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. \"/\" .. v) end)\n_p(' <ReferencePath>%s</ReferencePath>', path.translate(table.concat(refpaths, \";\"), \"\\\\\"))\n_p(' </PropertyGroup>')\n_p('</Project>')\nend\n",
- "--\nlocal function cleantemplatefiles(this, templates)\nif (templates) then\nfor _,tmpl in ipairs(templates) do\nlocal fname = premake.getoutputname(this, tmpl[1])\nos.remove(fname)\nend\nend\nend\nnewaction {\ntrigger = \"clean\",\ndescription = \"Remove all binaries and generated files\",\nexecute = function()\nlocal solutions = { }\nlocal projects = { }\nlocal targets = { }\nlocal cwd = os.getcwd()\nlocal function rebase(parent, dir)\nreturn path.rebase(dir, parent.location, cwd)\nend\n-- Walk the tree. Build a list of object names to pass to the cleaners,\n-- and delete any toolset agnostic files along the way.\nfor _,sln in ipairs(_SOLUTIONS) do\ntable.insert(solutions, path.join(sln.location, sln.name))\nfor prj in premake.eachproject(sln) do\ntable.insert(projects, path.join(prj.location, prj.name))\nif (prj.objectsdir) then\nos.rmdir(rebase(prj, prj.objectsdir))\nend\nfor cfg in premake.eachconfig(prj) do\ntable.insert(targets, path.join(rebase(cfg, cfg.buildtarget.directory), cfg.buildtarget.basename))\n-- remove all possible permutations of the target binary\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"windows\", \"windows\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"macosx\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"PS3\", \"windows\").fullpath))\nif (cfg.kind == \"WindowedApp\") then\nos.rmdir(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath .. \".app\"))\nend\n-- if there is an import library, remove that too\nos.remove(rebase(cfg, premake.gettarget(cfg, \"link\", \"windows\", \"windows\", \"windows\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"link\", \"posix\", \"posix\", \"linux\").fullpath))\nos.rmdir(rebase(cfg, cfg.objectsdir))\nend\nend\nend\n-- Walk the tree again. Delete templated and toolset-specific files\nfor _,action in pairs(premake.actions) do\nfor _,sln in ipairs(_SOLUTIONS) do\ncleantemplatefiles(sln, action.solutiontemplates)\nfor prj in premake.eachproject(sln) do\ncleantemplatefiles(prj, action.projecttemplates)\nend\nend\nif (type(action.onclean) == \"function\") then\naction.onclean(solutions, projects, targets)\nend\nend\nend,\n}\n",
- "--\nnewaction {\ntrigger = \"codeblocks\",\nshortname = \"Code::Blocks\",\ndescription = \"Code::Blocks Studio\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\", \"ow\" },\n},\nsolutiontemplates = {\n{ \".workspace\", premake.codeblocks_workspace },\n},\nprojecttemplates = {\n{ \".cbp\", premake.codeblocks_cbp },\n},\nonclean = function(solutions, projects, targets)\nfor _,name in ipairs(projects) do\nos.remove(name .. \".depend\")\nos.remove(name .. \".layout\")\nend\nend\n}\n",
- "--\nnewaction {\ntrigger = \"codelite\",\nshortname = \"CodeLite\",\ndescription = \"CodeLite\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nsolutiontemplates = {\n{ \".workspace\", premake.codelite_workspace },\n},\nprojecttemplates = {\n{ \".project\", premake.codelite_project },\n},\nonclean = function(solutions, projects, targets)\nfor _,name in ipairs(solutions) do\nos.remove(name .. \"_wsp.mk\")\nos.remove(name .. \".tags\")\nend\nfor _,name in ipairs(projects) do\nos.remove(name .. \".mk\")\nos.remove(name .. \".list\")\nos.remove(name .. \".out\")\nend\nend\n}\n",
- "--\n_MAKE = { }\nfunction _MAKE.esc(value)\nif (type(value) == \"table\") then\nlocal result = { }\nfor _,v in ipairs(value) do\ntable.insert(result, _MAKE.esc(v))\nend\nreturn result\nelse\nlocal result\nresult = value:gsub(\"\\\\\", \"\\\\\\\\\")\nresult = result:gsub(\" \", \"\\\\ \")\nresult = result:gsub(\"%(\", \"\\\\%(\")\nresult = result:gsub(\"%)\", \"\\\\%)\")\nreturn result\nend\nend\nfunction premake.make_copyrule(source, target)\n_p('%s: %s', target, source)\n_p('\\t@echo Copying $(notdir %s)', target)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) cp -fR %s %s', source, target)\n_p('else')\n_p('\\t$(SILENT) copy /Y $(subst /,\\\\\\\\,%s) $(subst /,\\\\\\\\,%s)', source, target)\n_p('endif')\nend\nfunction premake.make_mkdirrule(var)\n_p('\\t@echo Creating %s', var)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) mkdir -p %s', var)\n_p('else')\n_p('\\t$(SILENT) mkdir $(subst /,\\\\\\\\,%s)', var)\n_p('endif')\n_p('')\nend\nfunction _MAKE.getmakefilename(this, searchprjs)\n-- how many projects/solutions use this location?\nlocal count = 0\nfor _,sln in ipairs(_SOLUTIONS) do\nif (sln.location == this.location) then count = count + 1 end\nif (searchprjs) then\nfor _,prj in ipairs(sln.projects) do\nif (prj.location == this.location) then count = count + 1 end\nend\nend\nend\nif (count == 1) then\nreturn \"Makefile\"\nelse\nreturn this.name .. \".make\"\nend\nend\nfunction _MAKE.getnames(tbl)\nlocal result = table.extract(tbl, \"name\")\nfor k,v in pairs(result) do\nresult[k] = _MAKE.esc(v)\nend\nreturn result\nend\nnewaction {\ntrigger = \"gmake\",\nshortname = \"GNU Make\",\ndescription = \"GNU makefiles for POSIX, MinGW, and Cygwin\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"gcc\" },\ndotnet = { \"mono\", \"msnet\", \"pnet\" },\n},\nsolutiontemplates = {\n{\nfunction(this) return _MAKE.getmakefilename(this, false) end, \npremake.make_solution\n},\n},\nprojecttemplates = {\n{ \nfunction(this) return _MAKE.getmakefilename(this, true) end, \npremake.make_cpp,\nfunction(this) return this.language == \"C\" or this.language == \"C++\" end\n},\n{\nfunction(this) return _MAKE.getmakefilename(this, true) end,\npremake.make_csharp,\nfunction(this) return this.language == \"C#\" end\n},\n},\n}\n",
- "--\n_VS = { }\npremake.vstudio_platforms = { \nany = \"Any CPU\", \nmixed = \"Mixed Platforms\", \nNative = \"Win32\",\nx32 = \"Win32\", \nx64 = \"x64\",\nPS3 = \"PS3\",\nXbox360 = \"Xbox 360\",\n}\nfunction _VS.arch(prj)\nif (prj.language == \"C#\") then\nif (_ACTION < \"vs2005\") then\nreturn \".NET\"\nelse\nreturn \"Any CPU\"\nend\nelse\nreturn \"Win32\"\nend\nend\nfunction _VS.bool(value)\nif (_ACTION < \"vs2005\") then\nreturn iif(value, \"TRUE\", \"FALSE\")\nelse\nreturn iif(value, \"true\", \"false\")\nend\nend\nfunction premake.vstudio_buildconfigs(sln)\nlocal cfgs = { }\nlocal platforms = premake.filterplatforms(sln, premake.vstudio_platforms, \"Native\")\n-- .NET projects add \"Any CPU\", mixed mode solutions add \"Mixed Platforms\"\nlocal hascpp = premake.hascppproject(sln)\nlocal hasdotnet = premake.hasdotnetproject(sln)\nif hasdotnet then\ntable.insert(platforms, 1, \"any\")\nend\nif hasdotnet and hascpp then\ntable.insert(platforms, 2, \"mixed\")\nend\nfor _, buildcfg in ipairs(sln.configurations) do\nfor _, platform in ipairs(platforms) do\nlocal entry = { }\nentry.src_buildcfg = buildcfg\nentry.src_platform = platform\n-- PS3 is funky and needs special handling; it's more of a build\n-- configuration than a platform from Visual Studio's point of view\nif platform ~= \"PS3\" then\nentry.buildcfg = buildcfg\nentry.platform = premake.vstudio_platforms[platform]\nelse\nentry.buildcfg = platform .. \" \" .. buildcfg\nentry.platform = \"Win32\"\nend\n-- create a name the way VS likes it\nentry.name = entry.buildcfg .. \"|\" .. entry.platform\n-- flag the \"fake\" platforms added for .NET\nentry.isreal = (platform ~= \"any\" and platform ~= \"mixed\")\ntable.insert(cfgs, entry)\nend\nend\nreturn cfgs\nend\nfunction _VS.cfgtype(cfg)\nif (cfg.kind == \"SharedLib\") then\nreturn 2\nelseif (cfg.kind == \"StaticLib\") then\nreturn 4\nelse\nreturn 1\nend\nend\nfunction premake.vstudio_clean(solutions, projects, targets)\nfor _,name in ipairs(solutions) do\nos.remove(name .. \".suo\")\nos.remove(name .. \".ncb\")\nos.remove(name .. \".userprefs\") -- MonoDevelop files\nos.remove(name .. \".usertasks\")\nend\nfor _,name in ipairs(projects) do\nos.remove(name .. \".csproj.user\")\nos.remove(name .. \".csproj.webinfo\")\nlocal files = os.matchfiles(name .. \".vcproj.*.user\", name .. \".csproj.*.user\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nend\nfor _,name in ipairs(targets) do\nos.remove(name .. \".pdb\")\nos.remove(name .. \".idb\")\nos.remove(name .. \".ilk\")\nos.remove(name .. \".vshost.exe\")\nos.remove(name .. \".exe.manifest\")\nend\nend\nlocal function output(indent, value)\nio.write(indent .. value .. \"\\r\\n\")\nend\nlocal function attrib(indent, name, value)\nio.write(indent .. \"\\t\" .. name .. '=\"' .. value .. '\"\\r\\n')\nend\nfunction _VS.files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\"\\t\", nestlevel + 2)\nif (state == \"GroupStart\") then\noutput(indent, \"<Filter\")\nattrib(indent, \"Name\", path.getname(fname))\nattrib(indent, \"Filter\", \"\")\noutput(indent, \"\\t>\")\nelseif (state == \"GroupEnd\") then\noutput(indent, \"</Filter>\")\nelse\noutput(indent, \"<File\")\nattrib(indent, \"RelativePath\", path.translate(fname, \"\\\\\"))\noutput(indent, \"\\t>\")\nif (not prj.flags.NoPCH and prj.pchsource == fname) then\nfor _, cfgname in ipairs(prj.configurations) do\noutput(indent, \"\\t<FileConfiguration\")\nattrib(indent, \"\\tName\", cfgname .. \"|Win32\")\noutput(indent, \"\\t\\t>\")\noutput(indent, \"\\t\\t<Tool\")\nattrib(indent, \"\\t\\tName\", \"VCCLCompilerTool\")\nattrib(indent, \"\\t\\tUsePrecompiledHeader\", \"1\")\noutput(indent, \"\\t\\t/>\")\noutput(indent, \"\\t</FileConfiguration>\")\nend\nend\noutput(indent, \"</File>\")\nend\nend\nfunction _VS.optimization(cfg)\nlocal result = 0\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nresult = 3\nelseif (value == \"OptimizeSize\") then\nresult = 1\nelseif (value == \"OptimizeSpeed\") then\nresult = 2\nend\nend\nreturn result\nend\nfunction _VS.projectfile(prj)\nlocal extension\nif (prj.language == \"C#\") then\nextension = \".csproj\"\nelse\nextension = \".vcproj\"\nend\nlocal fname = path.join(prj.location, prj.name)\nreturn fname..extension\nend\nfunction _VS.runtime(cfg)\nlocal debugbuild = (_VS.optimization(cfg) == 0)\nif (cfg.flags.StaticRuntime) then\nreturn iif(debugbuild, 1, 0)\nelse\nreturn iif(debugbuild, 3, 2)\nend\nend\nfunction _VS.tool(prj)\nif (prj.language == \"C#\") then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelse\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\nnewaction {\ntrigger = \"vs2002\",\nshortname = \"Visual Studio 2002\",\ndescription = \"Microsoft Visual Studio 2002\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2002_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2002_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2002_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\nnewaction {\ntrigger = \"vs2003\",\nshortname = \"Visual Studio 2003\",\ndescription = \"Microsoft Visual Studio 2003\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2003_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2002_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2002_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\nnewaction {\ntrigger = \"vs2005\",\nshortname = \"Visual Studio 2005\",\ndescription = \"Microsoft Visual Studio 2005 (SharpDevelop, MonoDevelop)\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2005_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2005_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2005_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\nnewaction {\ntrigger = \"vs2008\",\nshortname = \"Visual Studio 2008\",\ndescription = \"Microsoft Visual Studio 2008\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2005_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2005_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2005_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\n",
- "--\nlocal scriptfile = \"premake4.lua\"\nlocal shorthelp = \"Type 'premake4 --help' for help\"\nlocal versionhelp = \"premake4 (Premake Build Script Generator) %s\"\nlocal function doaction(name)\nlocal action = premake.actions[name]\n-- walk the session objects and generate files from the templates\nlocal function generatefiles(this, templates)\nif (not templates) then return end\nfor _,tmpl in ipairs(templates) do\nlocal output = true\nif (tmpl[3]) then\noutput = tmpl[3](this)\nend\nif (output) then\nlocal fname = path.getrelative(os.getcwd(), premake.getoutputname(this, tmpl[1]))\nprintf(\"Generating %s...\", fname)\nlocal f, err = io.open(fname, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nio.output(f)\n-- call the template function to generate the output\ntmpl[2](this)\nio.output():close()\nend\nend\nend\nfor _,sln in ipairs(_SOLUTIONS) do\ngeneratefiles(sln, action.solutiontemplates)\nfor prj in premake.eachproject(sln) do\ngeneratefiles(prj, action.projecttemplates)\nend\nend\nif (action.execute) then\naction.execute()\nend\nend\nlocal function injectplatform(platform)\nif not platform then return true end\nplatform = premake.checkvalue(platform, premake.fields.platforms.allowed)\nfor _, sln in ipairs(_SOLUTIONS) do\nlocal platforms = sln.platforms or { }\n-- an empty table is equivalent to a native build\nif #platforms == 0 then\ntable.insert(platforms, \"Native\")\nend\n-- the solution must provide a native build in order to support this feature\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\n-- add it to the end of the list, if it isn't in there already\nif not table.contains(platforms, platform) then\ntable.insert(platforms, platform)\nend\nsln.platforms = platforms\nend\nreturn true\nend\nfunction _premake_main(scriptpath)\n-- if running off the disk (in debug mode), load everything \n-- listed in _manifest.lua; the list divisions make sure\n-- everything gets initialized in the proper order.\nif (scriptpath) then\nlocal scripts = dofile(scriptpath .. \"/_manifest.lua\")\nfor _,v in ipairs(scripts) do\ndofile(scriptpath .. \"/\" .. v)\nend\nend\n-- Some actions imply a particular operating system. Set it early so\n-- it can be picked up by the scripts.\nif (_ACTION and premake.actions[_ACTION]) then\n_OS = premake.actions[_ACTION].os or _OS\nend\n-- If there is a project script available, run it to get the\n-- project information, available options and actions, etc.\nlocal fname = _OPTIONS[\"file\"] or scriptfile\nif (os.isfile(fname)) then\ndofile(fname)\nend\n-- Process special options\nif (_OPTIONS[\"version\"]) then\nprintf(versionhelp, _PREMAKE_VERSION)\nreturn 1\nend\nif (_OPTIONS[\"help\"]) then\npremake.showhelp()\nreturn 1\nend\n-- If no action was specified, show a short help message\nif (not _ACTION) then\nprint(shorthelp)\nreturn 1\nend\n-- If there wasn't a project script I've got to bail now\nif (not os.isfile(fname)) then\nerror(\"No Premake script (\"..scriptfile..\") found!\", 2)\nend\n-- Validate the command-line arguments. This has to happen after the\n-- script has run to allow for project-specific options\nif (not premake.actions[_ACTION]) then\nerror(\"Error: no such action '\".._ACTION..\"'\", 0)\nend\nok, err = premake.checkoptions()\nif (not ok) then error(\"Error: \" .. err, 0) end\n-- Sanity check the current project setup\nok, err = premake.checktools()\nif (not ok) then error(\"Error: \" .. err, 0) end\n-- If a platform was specified on the command line, inject it now\nok, err = injectplatform(_OPTIONS[\"platform\"])\nif (not ok) then error(\"Error: \" .. err, 0) end\n-- work-in-progress: build the configurations\nprint(\"Building configurations...\")\npremake.buildconfigs()\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\n-- Hand over control to the action\nprintf(\"Running action '%s'...\", _ACTION)\ndoaction(_ACTION)\nprint(\"Done.\")\nreturn 0\nend\n",
+ "function os.findlib(libname)\nlocal path, formats\nif os.is(\"windows\") then\nformats = { \"%s.dll\", \"%s\" }\npath = os.getenv(\"PATH\")\nelse\nif os.is(\"macosx\") then\nformats = { \"lib%s.dylib\", \"%s.dylib\" }\npath = os.getenv(\"DYLD_LIBRARY_PATH\")\nelse\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LD_LIBRARY_PATH\") or \"\"\nlocal f = io.open(\"/etc/ld.so.conf\", \"r\")\nif f then\nfor line in f:lines() do\npath = path .. \":\" .. line\nend\nf:close()\nend\nend\ntable.insert(formats, \"%s\")\npath = (path or \"\") .. \":/lib:/usr/lib:/usr/local/lib\"\nend\nfor _, fmt in ipairs(formats) do\nlocal name = string.format(fmt, libname)\nlocal result = os.pathsearch(name, path)\nif result then return result end\nend\nend\nfunction os.get()\nreturn _OPTIONS.os or _OS\nend\nfunction os.is(id)\nreturn (os.get():lower() == id:lower())\nend\nlocal function domatch(result, mask, wantfiles)\nlocal basedir = path.getdirectory(mask)\nif (basedir == \".\") then basedir = \"\" end\nlocal m = os.matchstart(mask)\nwhile (os.matchnext(m)) do\nlocal fname = os.matchname(m)\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\ntable.insert(result, path.join(basedir, fname))\nend\nend\nos.matchdone(m)\nif (mask:find(\"**\", nil, true)) then\nmask = path.getname(mask)\nm = os.matchstart(path.join(basedir, \"*\"))\nwhile (os.matchnext(m)) do\nlocal dirname = os.matchname(m)\nlocal submask = path.join(path.join(basedir, dirname), mask)\ndomatch(result, submask, wantfiles)\nend\nos.matchdone(m)\nend\nend\nfunction os.matchdirs(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, false)\nend\nreturn result\nend\nfunction os.matchfiles(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, true)\nend\nreturn result\nend\nlocal builtin_mkdir = os.mkdir\nfunction os.mkdir(p)\nlocal dir = iif(p:startswith(\"/\"), \"/\", \"\")\nfor part in p:gmatch(\"[^/]+\") do\ndir = dir .. part\nif (part ~= \"\" and not path.isabsolute(part) and not os.isdir(dir)) then\nlocal ok, err = builtin_mkdir(dir)\nif (not ok) then\nreturn nil, err\nend\nend\ndir = dir .. \"/\"\nend\nreturn true\nend\nlocal builtin_rmdir = os.rmdir\nfunction os.rmdir(p)\nlocal dirs = os.matchdirs(p .. \"/*\")\nfor _, dname in ipairs(dirs) do\nos.rmdir(dname)\nend\nlocal files = os.matchfiles(p .. \"/*\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nbuiltin_rmdir(p)\nend\n",
+ "function path.getabsolute(p)\np = path.translate(p, \"/\")\nif (p == \"\") then p = \".\" end\nlocal result = iif (path.isabsolute(p), nil, os.getcwd())\nfor n, part in ipairs(p:explode(\"/\", true)) do\nif (part == \"\" and n == 1) then\nresult = \"/\"\nelseif (part == \"..\") then\nresult = path.getdirectory(result)\nelseif (part ~= \".\") then\nresult = path.join(result, part)\nend\nend\nresult = iif(result:endswith(\"/\"), result:sub(1, -2), result)\nreturn result\nend\nfunction path.getbasename(p)\nlocal name = path.getname(p)\nlocal i = name:findlast(\".\", true)\nif (i) then\nreturn name:sub(1, i - 1)\nelse\nreturn name\nend\nend\nfunction path.getdirectory(p)\nlocal i = p:findlast(\"/\", true)\nif (i) then\nif i > 1 then i = i - 1 end\nreturn p:sub(1, i)\nelse\nreturn \".\"\nend\nend\nfunction path.getdrive(p)\nlocal ch1 = p:sub(1,1)\nlocal ch2 = p:sub(2,2)\nif ch2 == \":\" then\nreturn ch1\nend\nend\nfunction path.getextension(p)\nlocal i = p:findlast(\".\", true)\nif (i) then\nreturn p:sub(i)\nelse\nreturn \"\"\nend\nend\nfunction path.getname(p)\nlocal i = p:findlast(\"[/\\\\]\")\nif (i) then\nreturn p:sub(i + 1)\nelse\nreturn p\nend\nend\nfunction path.getrelative(src, dst)\nsrc = path.getabsolute(src)\ndst = path.getabsolute(dst)\nif (src == dst) then\nreturn \".\"\nend\nif path.getdrive(src) ~= path.getdrive(dst) then\nreturn dst\nend\nsrc = src .. \"/\"\ndst = dst .. \"/\"\nlocal i = src:find(\"/\")\nwhile (i) do\nif (src:sub(1,i) == dst:sub(1,i)) then\nsrc = src:sub(i + 1)\ndst = dst:sub(i + 1)\nelse\nbreak\nend\ni = src:find(\"/\")\nend\nlocal result = \"\"\ni = src:find(\"/\")\nwhile (i) do\nresult = result .. \"../\"\ni = src:find(\"/\", i + 1)\nend\nresult = result .. dst\nreturn result:sub(1, -2)\nend\nfunction path.iscfile(fname)\nlocal extensions = { \".c\", \".s\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.iscppfile(fname)\nlocal extensions = { \".cc\", \".cpp\", \".cxx\", \".c\", \".s\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.isresourcefile(fname)\nlocal extensions = { \".rc\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.join(leading, trailing)\nleading = leading or \"\"\nif (not trailing) then\nreturn leading\nend\nif (path.isabsolute(trailing)) then\nreturn trailing\nend\nif (leading == \".\") then\nleading = \"\"\nend\nif (leading:len() > 0 and not leading:endswith(\"/\")) then\nleading = leading .. \"/\"\nend\nreturn leading .. trailing\nend\nfunction path.rebase(p, oldbase, newbase)\np = path.getabsolute(path.join(oldbase, p))\np = path.getrelative(newbase, p)\nreturn p\nend\nfunction path.translate(p, sep)\nif (type(p) == \"table\") then\nlocal result = { }\nfor _, value in ipairs(p) do\ntable.insert(result, path.translate(value))\nend\nreturn result\nelse\nif (not sep) then\nif (os.is(\"windows\")) then\nsep = \"\\\\\"\nelse\nsep = \"/\"\nend\nend\nlocal result = p:gsub(\"[/\\\\]\", sep)\nreturn result\nend\nend\n",
+ "function string.explode(s, pattern, plain)\nif (pattern == '') then return false end\nlocal pos = 0\nlocal arr = { }\nfor st,sp in function() return s:find(pattern, pos, plain) end do\ntable.insert(arr, s:sub(pos, st-1))\npos = sp + 1\nend\ntable.insert(arr, s:sub(pos))\nreturn arr\nend\nfunction string.findlast(s, pattern, plain)\nlocal curr = 0\nrepeat\nlocal next = s:find(pattern, curr + 1, plain)\nif (next) then curr = next end\nuntil (not next)\nif (curr > 0) then\nreturn curr\nend\nend\nfunction string.startswith(haystack, needle)\nreturn (haystack:find(needle, 1, true) == 1)\nend",
+ "function table.contains(t, value)\nfor _,v in pairs(t) do\nif (v == value) then\nreturn true\nend\nend\nreturn false\nend\nfunction table.extract(arr, fname)\nlocal result = { }\nfor _,v in ipairs(arr) do\ntable.insert(result, v[fname])\nend\nreturn result\nend\nfunction table.implode(arr, before, after, between)\nlocal result = \"\"\nfor _,v in ipairs(arr) do\nif (result ~= \"\" and between) then\nresult = result .. between\nend\nresult = result .. before .. v .. after\nend\nreturn result\nend\nfunction table.join(...)\nlocal result = { }\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor _,v in ipairs(t) do\ntable.insert(result, v)\nend\nelse\ntable.insert(result, t)\nend\nend\nreturn result\nend\nfunction table.keys(tbl)\nlocal keys = {}\nfor k, _ in pairs(tbl) do\ntable.insert(keys, k)\nend\nreturn keys\nend\nfunction table.translate(arr, translation)\nlocal result = { }\nfor _, value in ipairs(arr) do\nlocal tvalue\nif type(translation) == \"function\" then\ntvalue = translation(value)\nelse\ntvalue = translation[value]\nend\nif (tvalue) then\ntable.insert(result, tvalue)\nend\nend\nreturn result\nend\n",
+ "function io.capture()\nio.captured = ''\nend\nfunction io.endcapture()\nlocal captured = io.captured\nio.captured = nil\nreturn captured\nend\nlocal builtin_open = io.open\nfunction io.open(fname, mode)\nif (mode) then\nif (mode:find(\"w\")) then\nlocal dir = path.getdirectory(fname)\nok, err = os.mkdir(dir)\nif (not ok) then\nerror(err, 0)\nend\nend\nend\nreturn builtin_open(fname, mode)\nend\nfunction io.printf(msg, ...)\nif (not io.eol) then\nio.eol = \"\\n\"\nend\nlocal s = string.format(msg, unpack(arg))\nif io.captured then\nio.captured = io.captured .. s .. io.eol\nelse\nio.write(s)\nio.write(io.eol)\nend\nend\n_p = io.printf\n",
+ "_SOLUTIONS = { }\n_TEMPLATES = { }\npremake = { }\npremake.actions = { }\npremake.options = { }\npremake.platforms = \n{\nNative = \n{ \ncfgsuffix = \"\",\n},\nx32 = \n{ \ncfgsuffix = \"32\",\n},\nx64 = \n{ \ncfgsuffix = \"64\",\n},\nUniversal = \n{ \ncfgsuffix = \"unix\",\n},\nUniversal32 = \n{ \ncfgsuffix = \"univ32\",\n},\nUniversal64 = \n{ \ncfgsuffix = \"univ64\",\n},\nPS3 = \n{ \ncfgsuffix = \"ps3\",\niscrosscompiler = true,\nnosharedlibs = true,\nnamestyle = \"PS3\",\n},\nXbox360 = \n{ \ncfgsuffix = \"xbox360\",\niscrosscompiler = true,\nnamestyle = \"windows\",\n},\n}\nlocal builtin_dofile = dofile\nfunction dofile(fname)\nlocal oldcwd = os.getcwd()\nif (not os.isfile(fname)) then\nlocal path = os.pathsearch(fname, _OPTIONS[\"scripts\"], os.getenv(\"PREMAKE_PATH\"))\nif (path) then\nfname = path..\"/\"..fname\nend\nend\nfname = path.getabsolute(fname)\nlocal newcwd = path.getdirectory(fname)\nos.chdir(newcwd)\nlocal a, b, c, d, e, f = builtin_dofile(fname)\nos.chdir(oldcwd)\nreturn a, b, c, d, e, f\nend\nfunction iif(expr, trueval, falseval)\nif (expr) then\nreturn trueval\nelse\nreturn falseval\nend\nend\nfunction include(fname)\nreturn dofile(fname .. \"/premake4.lua\")\nend\nfunction printf(msg, ...)\nprint(string.format(msg, unpack(arg)))\nend\nlocal builtin_type = type\nfunction type(t)\nlocal mt = getmetatable(t)\nif (mt) then\nif (mt.__type) then\nreturn mt.__type\nend\nend\nreturn builtin_type(t)\nend\n",
+ "function premake.eachconfig(prj, platform)\nif prj.project then prj = prj.project end\nlocal cfgs = prj.solution.configurations\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #cfgs then\nreturn premake.getconfig(prj, cfgs[i], platform)\nend\nend\nend\nfunction premake.eachfile(prj)\nif not prj.project then prj = premake.getconfig(prj) end\nlocal i = 0\nlocal t = prj.files\nreturn function ()\ni = i + 1\nif (i <= #t) then\nreturn prj.__fileconfigs[t[i]]\nend\nend\nend\nfunction premake.eachproject(sln)\nlocal i = 0\nreturn function ()\ni = i + 1\nif (i <= #sln.projects) then\nlocal prj = sln.projects[i]\nlocal cfg = premake.getconfig(prj)\ncfg.name = prj.name\ncfg.blocks = prj.blocks\nreturn cfg\nend\nend\nend\nfunction premake.esc(value)\nif (type(value) == \"table\") then\nlocal result = { }\nfor _,v in ipairs(value) do\ntable.insert(result, premake.esc(v))\nend\nreturn result\nelse\nvalue = value:gsub('&', \"&amp;\")\nvalue = value:gsub('\"', \"&quot;\")\nvalue = value:gsub(\"'\", \"&apos;\")\nvalue = value:gsub('<', \"&lt;\")\nvalue = value:gsub('>', \"&gt;\")\nvalue = value:gsub('\\r', \"&#x0D;\")\nvalue = value:gsub('\\n', \"&#x0A;\")\nreturn value\nend\nend\nfunction premake.filterplatforms(sln, map, default)\nlocal result = { }\nlocal keys = { }\nif sln.platforms then\nfor _, p in ipairs(sln.platforms) do\nif map[p] and not table.contains(keys, map[p]) then\ntable.insert(result, p)\ntable.insert(keys, map[p])\nend\nend\nend\nif #result == 0 and default then\ntable.insert(result, default)\nend\nreturn result\nend\nfunction premake.findproject(name)\nname = name:lower()\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nif (prj.name:lower() == name) then\nreturn prj\nend\nend\nend\nend\nfunction premake.findfile(prj, extension)\nfor _, fname in ipairs(prj.files) do\nif fname:endswith(extension) then return fname end\nend\nend\nfunction premake.getconfig(prj, cfgname, pltname)\nprj = prj.project or prj\nif pltname == \"Native\" or not table.contains(prj.solution.platforms or {}, pltname) then\npltname = nil\nend\nlocal key = (cfgname or \"\")\nif pltname then key = key .. pltname end\nreturn prj.__configs[key]\nend\nfunction premake.getconfigname(cfgname, platform, useshortname)\nif cfgname then\nlocal name = cfgname\nif platform and platform ~= \"Native\" then\nif useshortname then\nname = name .. premake.platforms[platform].cfgsuffix\nelse\nname = name .. \"|\" .. platform\nend\nend\nreturn iif(useshortname, name:lower(), name)\nend\nend\nfunction premake.getdependencies(prj)\nprj = prj.project or prj\nlocal results = { }\nfor _, cfg in pairs(prj.__configs) do\nfor _, link in ipairs(cfg.links) do\nlocal dep = premake.findproject(link)\nif dep and not table.contains(results, dep) then\ntable.insert(results, dep)\nend\nend\nend\nreturn results\nend\nfunction premake.getlinks(cfg, kind, part)\nlocal result = iif (part == \"directory\" and kind == \"all\", cfg.libdirs, {})\nlocal cfgname = iif(cfg.name == cfg.project.name, \"\", cfg.name)\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\nlocal function canlink(source, target)\nif (target.kind ~= \"SharedLib\" and target.kind ~= \"StaticLib\") then \nreturn false\nend\nif premake.iscppproject(source) then\nreturn premake.iscppproject(target)\nelseif premake.isdotnetproject(source) then\nreturn premake.isdotnetproject(target)\nend\nend\nfor _, link in ipairs(cfg.links) do\nlocal item\nlocal prj = premake.findproject(link)\nif prj and kind ~= \"system\" then\nlocal prjcfg = premake.getconfig(prj, cfgname, cfg.platform)\nif kind == \"dependencies\" or canlink(cfg, prjcfg) then\nif (part == \"directory\") then\nitem = path.rebase(prjcfg.linktarget.directory, prjcfg.location, cfg.location)\nelseif (part == \"basename\") then\nitem = prjcfg.linktarget.basename\nelseif (part == \"fullpath\") then\nitem = path.rebase(prjcfg.linktarget.fullpath, prjcfg.location, cfg.location)\nelseif (part == \"object\") then\nitem = prjcfg\nend\nend\nelseif not prj and (kind == \"system\" or kind == \"all\") then\nif (part == \"directory\") then\nlocal dir = path.getdirectory(link)\nif (dir ~= \".\") then\nitem = dir\nend\nelseif (part == \"fullpath\") then\nitem = link\nif namestyle == \"windows\" then\nif premake.iscppproject(cfg) then\nitem = item .. \".lib\"\nelseif premake.isdotnetproject(cfg) then\nitem = item .. \".dll\"\nend\nend\nif item:find(\"/\", nil, true) then\nitem = path.getrelative(cfg.basedir, item)\nend\nelse\nitem = link\nend\nend\nif item then\nif pathstyle == \"windows\" and part ~= \"object\" then\nitem = path.translate(item, \"\\\\\")\nend\nif not table.contains(result, item) then\ntable.insert(result, item)\nend\nend\nend\nreturn result\nend\nfunction premake.getnamestyle(cfg)\nreturn premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or \"posix\"\nend\nfunction premake.getoutputname(this, namespec)\nlocal fname\nif (type(namespec) == \"function\") then\nfname = namespec(this)\nelse\nfname = this.name .. namespec\nend\nreturn path.join(this.location, fname)\nend\nfunction premake.getpathstyle(cfg)\nif premake.actions[_ACTION].os == \"windows\" then\nreturn \"windows\"\nelse\nreturn \"posix\"\nend\nend\nfunction premake.gettarget(cfg, direction, pathstyle, namestyle, system)\nif system == \"bsd\" then system = \"linux\" end\nlocal kind = cfg.kind\nif premake.iscppproject(cfg) then\nif (namestyle == \"windows\" or system == \"windows\") and kind == \"SharedLib\" and direction == \"link\" then\nkind = \"StaticLib\"\nend\nif namestyle == \"posix\" and system == \"windows\" and kind ~= \"StaticLib\" then\nnamestyle = \"windows\"\nend\nend\nlocal field = iif(direction == \"build\", \"target\", \"implib\")\nlocal name = cfg[field..\"name\"] or cfg.targetname or cfg.project.name\nlocal dir = cfg[field..\"dir\"] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir)\nlocal prefix = \"\"\nlocal suffix = \"\"\nif namestyle == \"windows\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\nsuffix = \".exe\"\nelseif kind == \"SharedLib\" then\nsuffix = \".dll\"\nelseif kind == \"StaticLib\" then\nsuffix = \".lib\"\nend\nelseif namestyle == \"posix\" then\nif kind == \"WindowedApp\" and system == \"macosx\" then\ndir = path.join(dir, name .. \".app/Contents/MacOS\")\nelseif kind == \"SharedLib\" then\nprefix = \"lib\"\nsuffix = iif(system == \"macosx\", \".dylib\", \".so\")\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\nsuffix = \".a\"\nend\nelseif namestyle == \"PS3\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\nsuffix = \".elf\"\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\nsuffix = \".a\"\nend\nend\nprefix = cfg[field..\"prefix\"] or cfg.targetprefix or prefix\nsuffix = cfg[field..\"extension\"] or cfg.targetextension or suffix\nlocal result = { }\nresult.basename = name\nresult.name = prefix .. name .. suffix\nresult.directory = dir\nresult.fullpath = path.join(result.directory, result.name)\nif pathstyle == \"windows\" then\nresult.directory = path.translate(result.directory, \"\\\\\")\nresult.fullpath = path.translate(result.fullpath, \"\\\\\")\nend\nreturn result\nend\nfunction premake.gettool(cfg)\nif premake.iscppproject(cfg) then\nif _OPTIONS.cc then\nreturn premake[_OPTIONS.cc]\nend\nlocal action = premake.actions[_ACTION]\nif action.valid_tools then\nreturn premake[action.valid_tools.cc[1]]\nend\nreturn premake.gcc\nelse\nreturn premake.dotnet\nend\nend\nfunction premake.hascppproject(sln)\nfor prj in premake.eachproject(sln) do\nif premake.iscppproject(prj) then\nreturn true\nend\nend\nend\nfunction premake.hasdotnetproject(sln)\nfor prj in premake.eachproject(sln) do\nif premake.isdotnetproject(prj) then\nreturn true\nend\nend\nend\nfunction premake.iscppproject(prj)\nreturn (prj.language == \"C\" or prj.language == \"C++\")\nend\nfunction premake.isdotnetproject(prj)\nreturn (prj.language == \"C#\")\nend\nlocal function walksources(cfg, fn, group, nestlevel, finished)\nlocal grouplen = group:len()\nlocal gname = iif(group:endswith(\"/\"), group:sub(1, -2), group)\nif (nestlevel >= 0) then\nfn(cfg, gname, \"GroupStart\", nestlevel)\nend\nfor _,fname in ipairs(cfg.files) do\nif (fname:startswith(group)) then\nlocal _,split = fname:find(\"[^\\.]/\", grouplen + 1)\nif (split) then\nlocal subgroup = fname:sub(1, split)\nif (not finished[subgroup]) then\nfinished[subgroup] = true\nwalksources(cfg, fn, subgroup, nestlevel + 1, finished)\nend\nend\nend\nend\nfor _,fname in ipairs(cfg.files) do\nif (fname:startswith(group) and not fname:find(\"[^\\.]/\", grouplen + 1)) then\nfn(cfg, fname, \"GroupItem\", nestlevel + 1)\nend\nend\nif (nestlevel >= 0) then\nfn(cfg, gname, \"GroupEnd\", nestlevel)\nend\nend\nfunction premake.walksources(cfg, fn)\nwalksources(cfg, fn, \"\", -1, {})\nend\n",
+ "local nocopy = \n{\nblocks = true,\nkeywords = true,\nprojects = true,\n__configs = true,\n}\nlocal nofixup =\n{\nbasedir = true,\nlocation = true,\n}\nfunction premake.getactiveterms()\nlocal terms = { _ACTION:lower(), os.get() }\nfor key, value in pairs(_OPTIONS) do\nif value ~= \"\" then\ntable.insert(terms, value:lower())\nelse\ntable.insert(terms, key:lower())\nend\nend\nreturn terms\nend\nfunction premake.escapekeyword(keyword)\nkeyword = keyword:gsub(\"([%.%-%^%$%(%)%%])\", \"%%%1\")\nif keyword:find(\"**\", nil, true) then\nkeyword = keyword:gsub(\"%*%*\", \".*\")\nelse\nkeyword = keyword:gsub(\"%*\", \"[^/]*\")\nend\nreturn keyword:lower()\nend\nfunction premake.iskeywordmatch(keyword, terms)\nif keyword:startswith(\"not \") then\nreturn not premake.iskeywordmatch(keyword:sub(5), terms)\nend\nfor _, word in ipairs(keyword:explode(\" or \")) do\nlocal pattern = \"^\" .. word .. \"$\"\nfor termkey, term in pairs(terms) do\nif term:match(pattern) then\nreturn termkey\nend\nend\nend\nend\nfunction premake.iskeywordsmatch(keywords, terms)\nlocal hasrequired = false\nfor _, keyword in ipairs(keywords) do\nlocal matched = premake.iskeywordmatch(keyword, terms)\nif not matched then\nreturn false\nend\nif matched == \"required\" then\nhasrequired = true\nend\nend\nif terms.required and not hasrequired then\nreturn false\nelse\nreturn true\nend\nend\nlocal function adjustpaths(location, obj)\nfor name, value in pairs(obj) do\nlocal field = premake.fields[name]\nif field and value and not nofixup[name] then\nif field.kind == \"path\" then\nobj[name] = path.getrelative(location, value) \nelseif field.kind == \"dirlist\" or field.kind == \"filelist\" then\nfor i, p in ipairs(value) do \nvalue[i] = path.getrelative(location, p) \nend\nend\nend\nend\nend\nlocal function mergeobject(dest, src)\nif not src then return end\nfor field, value in pairs(src) do\nif not nocopy[field] then\nif type(value) == \"table\" then\ndest[field] = table.join(dest[field] or {}, value)\nelse\ndest[field] = value\nend\nend\nend\nend\nlocal function merge(dest, obj, basis, cfgname, pltname)\npltname = pltname or \"Native\"\nlocal key = cfgname or \"\"\nif pltname ~= \"Native\" then\nkey = key .. pltname\nend\nlocal cfg = {}\nmergeobject(cfg, basis[key])\nadjustpaths(obj.location, cfg)\nmergeobject(cfg, obj)\nlocal terms = premake.getactiveterms()\nterms.config = (cfgname or \"\"):lower()\nterms.platform = pltname:lower()\nfor _, blk in ipairs(obj.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, terms)) then\nmergeobject(cfg, blk)\nend\nend\ncfg.name = cfgname\ncfg.platform = pltname\ncfg.terms = terms\ndest[key] = cfg\nend\nlocal function collapse(obj, basis)\nlocal result = {}\nbasis = basis or {}\nlocal sln = obj.solution or obj\nmerge(result, obj, basis)\nfor _, cfgname in ipairs(sln.configurations) do\nmerge(result, obj, basis, cfgname, \"Native\")\nfor _, pltname in ipairs(sln.platforms or {}) do\nif pltname ~= \"Native\" then\nmerge(result, obj, basis, cfgname, pltname)\nend\nend\nend\nreturn result\nend\nlocal function postprocess(prj, cfg)\ncfg.project = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nlocal platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nelse\ncfg.system = os.get()\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\nlocal function builduniquedirs()\nlocal num_variations = 4\nlocal cfg_dirs = {}\nlocal hit_counts = {}\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dirs = { }\ndirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \"obj\"))\ndirs[2] = path.join(dirs[1], iif(cfg.platform == \"Native\", \"\", cfg.platform))\ndirs[3] = path.join(dirs[2], cfg.name)\ndirs[4] = path.join(dirs[3], cfg.project.name)\ncfg_dirs[cfg] = dirs\nfor v = 1, num_variations do\nlocal d = dirs[v]\nif hit_counts[d] then\nhit_counts[d] = hit_counts[d] + 1\nelse\nhit_counts[d] = 1\nend\nend\nend\nend\nend\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nfor v = 1, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\nfunction premake.buildconfigs()\nfor _, sln in ipairs(_SOLUTIONS) do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor _, sln in ipairs(_SOLUTIONS) do\nlocal basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\npostprocess(prj, cfg)\nend\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\n",
+ "premake.fields = \n{\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nconfigurations = \n{\nkind = \"list\",\nscope = \"solution\",\n},\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"config\",\nisflags = true,\nallowed = {\n\"ExtraWarnings\",\n\"FatalWarnings\",\n\"Managed\",\n\"NativeWChar\",\n\"No64BitChecks\",\n\"NoEditAndContinue\",\n\"NoExceptions\",\n\"NoFramePointer\",\n\"NoImportLib\",\n\"NoManifest\",\n\"NoNativeWChar\",\n\"NoPCH\",\n\"NoRTTI\",\n\"Optimize\",\n\"OptimizeSize\",\n\"OptimizeSpeed\",\n\"SEH\",\n\"StaticRuntime\",\n\"Symbols\",\n\"Unicode\",\n\"Unsafe\",\n\"WinMain\"\n}\n},\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend\n},\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\nplatforms = \n{\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nresoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (not container[fieldname]) then\ncontainer[fieldname] = { }\nend\nlocal function doinsert(value, depth)\nif (type(value) == \"table\") then\nfor _,v in ipairs(value) do\ndoinsert(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, depth)\nend\ntable.insert(container[fieldname], value)\nend\nend\nif (value) then\ndoinsert(value, 5)\nend\nreturn container[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value)\nif (type(value) == \"table\") then\nfor _,item in ipairs(value) do\nmakeabsolute(item)\nend\nelse\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value))\nelse\ntable.insert(result, path.getabsolute(value))\nend\nend\nend\nmakeabsolute(value)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then \nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\" and value) then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nif (kind == \"string\") then\nreturn premake.setstring(scope, name, value, allowed)\nelseif (kind == \"path\") then\nif value then value = path.getabsolute(value) end\nreturn premake.setstring(scope, name, value)\nelseif (kind == \"list\") then\nreturn premake.setarray(scope, name, value, allowed)\nelseif (kind == \"dirlist\") then\nreturn premake.setdirarray(scope, name, value)\nelseif (kind == \"filelist\") then\nreturn premake.setfilearray(scope, name, value)\nend\nend\nfor name,_ in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nend\nfunction configuration(keywords)\nif not keywords then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords = { }\nfor _, word in ipairs(table.join({}, keywords)) do\ntable.insert(cfg.keywords, premake.escapekeyword(word))\nend\nif keywords.files then\nfor _, pattern in ipairs(table.join({}, keywords.files)) do\npattern = pattern:gsub(\"%.\", \"%%.\")\nif pattern:find(\"**\", nil, true) then\npattern = pattern:gsub(\"%*%*\", \".*\")\nelse\npattern = pattern:gsub(\"%*\", \"[^/]*\")\nend\ntable.insert(cfg.keywords, \"^\" .. pattern .. \"$\")\nend\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nfunction project(name)\nif not name then\nreturn iif(type(premake.CurrentContainer) == \"project\", premake.CurrentContainer, nil)\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\npremake.CurrentContainer = sln.projects[name]\nif (not premake.CurrentContainer) then\nlocal prj = { }\npremake.CurrentContainer = prj\ntable.insert(sln.projects, prj)\nsln.projects[name] = prj\nsetmetatable(prj, {\n__type = \"project\",\n})\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.uuid = os.uuid()\nprj.blocks = { }\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = _SOLUTIONS[name]\nif (not premake.CurrentContainer) then\nlocal sln = { }\npremake.CurrentContainer = sln\ntable.insert(_SOLUTIONS, sln)\n_SOLUTIONS[name] = sln\nsetmetatable(sln, { \n__type=\"solution\"\n})\nsln.name = name\nsln.basedir = os.getcwd()\nsln.projects = { }\nsln.blocks = { }\nsln.configurations = { }\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\n",
+ "local requiredactionfields =\n{\n\"description\",\n\"trigger\",\n}\nlocal requiredoptionfields = \n{\n\"description\",\n\"trigger\"\n}\nfunction newaction(a)\nlocal missing\nfor _, field in ipairs(requiredactionfields) do\nif (not a[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"action needs a \" .. missing, 2)\nend\npremake.actions[a.trigger] = a\nend\nfunction newoption(opt)\nlocal missing\nfor _, field in ipairs(requiredoptionfields) do\nif (not opt[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"action needs a \" .. missing, 2)\nend\npremake.options[opt.trigger] = opt\nend\nnewoption \n{\ntrigger = \"cc\",\nvalue = \"compiler\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n{ \"ow\", \"OpenWatcom\" },\n}\n}\nnewoption\n{\ntrigger = \"dotnet\",\nvalue = \"value\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\", \"Microsoft .NET (csc)\" },\n{ \"mono\", \"Novell Mono (mcs)\" },\n{ \"pnet\", \"Portable.NET (cscc)\" },\n}\n}\nnewoption\n{\ntrigger = \"file\",\nvalue = \"filename\",\ndescription = \"Process the specified Premake script file\"\n}\nnewoption\n{\ntrigger = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger = \"os\",\nvalue = \"value\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"bsd\", \"OpenBSD, NetBSD, or FreeBSD\" },\n{ \"linux\", \"Linux\" },\n{ \"macosx\", \"Apple Mac OS X\" },\n{ \"windows\", \"Microsoft Windows\" },\n}\n}\nnewoption\n{\ntrigger = \"platform\",\nvalue = \"value\",\ndescription = \"Add target architecture (if supported by action)\",\nallowed = {\n{ \"x32\", \"32-bit\" },\n{ \"x64\", \"64-bit\" },\n{ \"universal\", \"Mac OS X Universal, 32- and 64-bit\" },\n{ \"universal32\", \"Mac OS X Universal, 32-bit only\" },\n{ \"universal64\", \"Mac OS X Universal, 64-bit only\" },\n{ \"ps3\", \"Playstation 3 (experimental)\" },\n{ \"xbox360\", \"Xbox 360 (experimental)\" },\n}\n}\nnewoption\n{\ntrigger = \"scripts\",\nvalue = \"path\",\ndescription = \"Search for additional scripts on the given path\"\n}\nnewoption\n{\ntrigger = \"version\",\ndescription = \"Display version information\"\n}\n",
+ "premake.dotnet = { }\npremake.dotnet.namestyle = \"windows\"\nlocal flags =\n{\nFatalWarning = \"/warnaserror\",\nOptimize = \"/optimize\",\nOptimizeSize = \"/optimize\",\nOptimizeSpeed = \"/optimize\",\nSymbols = \"/debug\",\nUnsafe = \"/unsafe\"\n}\nfunction premake.dotnet.getbuildaction(fcfg)\nlocal ext = path.getextension(fcfg.name):lower()\nif fcfg.buildaction == \"Compile\" or ext == \".cs\" then\nreturn \"Compile\"\nelseif fcfg.buildaction == \"Embed\" or ext == \".resx\" then\nreturn \"EmbeddedResource\"\nelseif fcfg.buildaction == \"Copy\" or ext == \".asax\" or ext == \".aspx\" then\nreturn \"Content\"\nelse\nreturn \"None\"\nend\nend\nfunction premake.dotnet.getcompilervar(cfg)\nif (_OPTIONS.dotnet == \"msnet\") then\nreturn \"csc\"\nelseif (_OPTIONS.dotnet == \"mono\") then\nreturn \"gmcs\"\nelse\nreturn \"cscc\"\nend\nend\nfunction premake.dotnet.getflags(cfg)\nlocal result = table.translate(cfg.flags, flags)\nreturn result\nend\nfunction premake.dotnet.getkind(cfg)\nif (cfg.kind == \"ConsoleApp\") then\nreturn \"Exe\"\nelseif (cfg.kind == \"WindowedApp\") then\nreturn \"WinExe\"\nelseif (cfg.kind == \"SharedLib\") then\nreturn \"Library\"\nend\nend",
+ "premake.gcc = { }\npremake.gcc.cc = \"gcc\"\npremake.gcc.cxx = \"g++\"\npremake.gcc.ar = \"ar\"\nlocal cflags =\n{\nExtraWarnings = \"-Wall\",\nFatalWarnings = \"-Werror\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\n}\npremake.gcc.platforms = \n{\nNative = { \ncppflags = \"-MMD\", \n},\nx32 = { \ncppflags = \"-MMD\",\nflags = \"-m32\",\nldflags = \"-L/usr/lib32\", \n},\nx64 = { \ncppflags = \"-MMD\",\nflags = \"-m64\",\nldflags = \"-L/usr/lib64\",\n},\nUniversal = { \ncppflags = \"\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\n},\nUniversal32 = { \ncppflags = \"\",\nflags = \"-arch i386 -arch ppc\",\n},\nUniversal64 = { \ncppflags = \"\",\nflags = \"-arch x86_64 -arch ppc64\",\n},\nPS3 = {\ncc = \"ppu-lv2-g++\",\ncxx = \"ppu-lv2-g++\",\nar = \"ppu-lv2-ar\",\ncppflags = \"-MMD\",\n}\n}\nlocal platforms = premake.gcc.platforms\nfunction premake.gcc.getcppflags(cfg)\nlocal result = { }\ntable.insert(result, platforms[cfg.platform].cppflags)\nreturn result\nend\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nif cfg.system ~= \"windows\" and cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-fPIC\")\nend\nreturn result\nend\nfunction premake.gcc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\nif not cfg.flags.Symbols then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-Wl,-x\")\nelse\ntable.insert(result, \"-s\")\nend\nend\nif cfg.kind == \"SharedLib\" then\nif cfg.system == \"macosx\" then\nresult = table.join(result, { \"-dynamiclib\", \"-flat_namespace\" })\nelse\ntable.insert(result, \"-shared\")\nend\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(result, '-Wl,--out-implib=\"' .. cfg.linktarget.fullpath .. '\"')\nend\nend\nif cfg.kind == \"WindowedApp\" then\nif cfg.system == \"windows\" then\ntable.insert(result, \"-mwindows\")\nend\nend\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\ntable.insert(result, platform.ldflags)\nreturn result\nend\nfunction premake.gcc.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.gcc.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\" .. _MAKE.esc(dir))\nend\nreturn result\nend\n",
+ "premake.msc = { }\npremake.msc.namestyle = \"windows\"\n",
+ "premake.ow = { }\npremake.ow.namestyle = \"windows\"\npremake.ow.cc = \"WCL386\"\npremake.ow.cxx = \"WCL386\"\npremake.ow.ar = \"ar\"\nlocal cflags =\n{\nExtraWarnings = \"-wx\",\nFatalWarning = \"-we\",\nOptimize = \"-ox\",\nOptimizeSize = \"-os\",\nOptimizeSpeed = \"-ot\",\nSymbols = \"-d2\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-xd\",\nNoRTTI = \"-xr\",\n}\npremake.ow.platforms = \n{\nNative = { \nflags = \"\" \n},\n}\nfunction premake.ow.getcppflags(cfg)\nreturn {}\nend\nfunction premake.ow.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\nif (cfg.flags.Symbols) then\ntable.insert(result, \"-hw\") -- Watcom debug format for Watcom debugger\nend\nreturn result\nend\nfunction premake.ow.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.ow.getldflags(cfg)\nlocal result = { }\nif (cfg.flags.Symbols) then\ntable.insert(result, \"op symf\")\nend\nreturn result\nend\nfunction premake.ow.getlinkflags(cfg)\nlocal result = { }\nreturn result\nend\nfunction premake.ow.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.ow.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, '-I \"' .. dir .. '\"')\nend\nreturn result\nend\n",
+ "function premake.checkoptions()\nfor key, value in pairs(_OPTIONS) do\nlocal opt = premake.options[key]\nif (not opt) then\nreturn false, \"invalid option '\" .. key .. \"'\"\nend\nif (opt.value and value == \"\") then\nreturn false, \"no value specified for option '\" .. key .. \"'\"\nend\nif (opt.allowed) then\nfor _, match in ipairs(opt.allowed) do\nif (match[1] == value) then return true end\nend\nreturn false, \"invalid value '\" .. value .. \"' for option '\" .. key .. \"'\"\nend\nend\nreturn true\nend\nfunction premake.checkprojects()\nlocal action = premake.actions[_ACTION]\nfor _, sln in ipairs(_SOLUTIONS) do\nif (#sln.projects == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs at least one project\"\nend\nif (#sln.configurations == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs configurations\"\nend\nfor prj in premake.eachproject(sln) do\nif (not prj.language) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a language\"\nend\nif (action.valid_languages) then\nif (not table.contains(action.valid_languages, prj.language)) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support \" .. prj.language .. \" projects\"\nend\nend\nfor cfg in premake.eachconfig(prj) do\nif (not cfg.kind) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a kind in configuration '\" .. cfg.name .. \"'\"\nend\nif (action.valid_kinds) then\nif (not table.contains(action.valid_kinds, cfg.kind)) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support \" .. cfg.kind .. \" projects\"\nend\nend\nend\nend\nend\nreturn true\nend\nfunction premake.checktools()\nlocal action = premake.actions[_ACTION]\nif (not action.valid_tools) then \nreturn true \nend\nfor tool, values in pairs(action.valid_tools) do\nif (_OPTIONS[tool]) then\nif (not table.contains(values, _OPTIONS[tool])) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support /\" .. tool .. \"=\" .. _OPTIONS[tool] .. \" (yet)\"\nend\nelse\n_OPTIONS[tool] = values[1]\nend\nend\nreturn true\nend\n",
+ "function premake.showhelp()\nactions = { }\nfor name,_ in pairs(premake.actions) do table.insert(actions, name) end\ntable.sort(actions)\noptions = { }\nfor name,_ in pairs(premake.options) do table.insert(options, name) end\ntable.sort(options)\nprintf(\"Premake %s, a build script generator\", _PREMAKE_VERSION)\nprintf(_PREMAKE_COPYRIGHT)\nprintf(\"%s %s\", _VERSION, _COPYRIGHT)\nprintf(\"\")\nprintf(\"Usage: premake4 [options] action [arguments]\")\nprintf(\"\")\nprintf(\"OPTIONS\")\nprintf(\"\")\nfor _,name in ipairs(options) do\nlocal opt = premake.options[name]\nlocal trigger = opt.trigger\nlocal description = opt.description\nif (opt.value) then trigger = trigger .. \"=\" .. opt.value end\nif (opt.allowed) then description = description .. \"; one of:\" end\nprintf(\" --%-15s %s\", trigger, description) \nif (opt.allowed) then\nfor _, value in ipairs(opt.allowed) do\nprintf(\" %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor _,name in ipairs(actions) do\nprintf(\" %-17s %s\", name, premake.actions[name].description)\nend\nprintf(\"\")\nprintf(\"For additional information, see http://industriousone.com/premake\")\nend\n",
+ "function premake.codeblocks_workspace(sln)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>')\n_p('<CodeBlocks_workspace_file>')\n_p('\\t<Workspace title=\"%s\">', sln.name)\nfor prj in premake.eachproject(sln) do\nlocal fname = path.join(path.getrelative(sln.location, prj.location), prj.name)\nlocal active = iif(prj.project == sln.projects[1], ' active=\"1\"', '')\n_p('\\t\\t<Project filename=\"%s.cbp\"%s>', fname, active)\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p('\\t\\t\\t<Depends filename=\"%s.cbp\" />', path.join(path.getrelative(sln.location, dep.location), dep.name))\nend\n_p('\\t\\t</Project>')\nend\n_p('\\t</Workspace>')\n_p('</CodeBlocks_workspace_file>')\nend\n",
+ "function premake.codeblocks_cbp(prj)\nlocal cc = premake.gettool(prj)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>')\n_p('<CodeBlocks_project_file>')\n_p('\\t<FileVersion major=\"1\" minor=\"6\" />')\n_p('\\t<Project>')\n_p('\\t\\t<Option title=\"%s\" />', premake.esc(prj.name))\n_p('\\t\\t<Option pch_mode=\"2\" />')\n_p('\\t\\t<Option compiler=\"%s\" />', _OPTIONS.cc)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \n_p('\\t\\t<Build>')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p('\\t\\t\\t<Target title=\"%s\">', premake.esc(cfg.longname))\n_p('\\t\\t\\t\\t<Option output=\"%s\" prefix_auto=\"0\" extension_auto=\"0\" />', premake.esc(cfg.buildtarget.fullpath))\n_p('\\t\\t\\t\\t<Option object_output=\"%s\" />', premake.esc(cfg.objectsdir))\nlocal types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }\n_p('\\t\\t\\t\\t<Option type=\"%d\" />', types[cfg.kind])\n_p('\\t\\t\\t\\t<Option compiler=\"%s\" />', _OPTIONS.cc)\nif (cfg.kind == \"SharedLib\") then\n_p('\\t\\t\\t\\t<Option createDefFile=\"0\" />')\n_p('\\t\\t\\t\\t<Option createStaticLib=\"%s\" />', iif(cfg.flags.NoImportLib, 0, 1))\nend\n_p('\\t\\t\\t\\t<Compiler>')\nfor _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do\n_p('\\t\\t\\t\\t\\t<Add option=\"%s\" />', premake.esc(flag))\nend\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p('\\t\\t\\t\\t\\t<Add option=\"-Winvalid-pch\" />')\n_p('\\t\\t\\t\\t\\t<Add option=\"-include &quot;%s&quot;\" />', premake.esc(cfg.pchheader))\nend\nfor _,v in ipairs(cfg.includedirs) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</Compiler>')\n_p('\\t\\t\\t\\t<Linker>')\nfor _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do\n_p('\\t\\t\\t\\t\\t<Add option=\"%s\" />', premake.esc(flag))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\n_p('\\t\\t\\t\\t\\t<Add library=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</Linker>')\nif premake.findfile(cfg, \".rc\") then\n_p('\\t\\t\\t\\t<ResourceCompiler>')\nfor _,v in ipairs(cfg.includedirs) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(cfg.resincludedirs) do\n_p('\\t\\t\\t\\t\\t<Add directory=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</ResourceCompiler>')\nend\nif #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then\n_p('\\t\\t\\t\\t<ExtraCommands>')\nfor _,v in ipairs(cfg.prebuildcommands) do\n_p('\\t\\t\\t\\t\\t<Add before=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(cfg.postbuildcommands) do\n_p('\\t\\t\\t\\t\\t<Add after=\"%s\" />', premake.esc(v))\nend\n_p('\\t\\t\\t\\t</ExtraCommands>')\nend\n_p('\\t\\t\\t</Target>')\nend\nend\n_p('\\t\\t</Build>')\nlocal pchheader\nif (prj.pchheader) then\npchheader = path.getrelative(prj.location, prj.pchheader)\nend\nfor _,fname in ipairs(prj.files) do\n_p('\\t\\t<Unit filename=\"%s\">', premake.esc(fname))\nif path.isresourcefile(fname) then\n_p('\\t\\t\\t<Option compilerVar=\"WINDRES\" />')\nelseif path.iscppfile(fname) then\n_p('\\t\\t\\t<Option compilerVar=\"%s\" />', iif(prj.language == \"C\", \"CC\", \"CPP\"))\nend\nif not prj.flags.NoPCH and fname == pchheader then\n_p('\\t\\t\\t<Option compilerVar=\"%s\" />', iif(prj.language == \"C\", \"CC\", \"CPP\"))\n_p('\\t\\t\\t<Option compile=\"1\" />')\n_p('\\t\\t\\t<Option weight=\"0\" />')\n_p('\\t\\t\\t<Add option=\"-x c++-header\" />')\nend\n_p('\\t\\t</Unit>')\nend\n_p('\\t\\t<Extensions />')\n_p('\\t</Project>')\n_p('</CodeBlocks_project_file>')\n_p('')\nend\n",
+ "function premake.codelite_workspace(sln)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<CodeLite_Workspace Name=\"%s\" Database=\"./%s.tags\">', premake.esc(sln.name), premake.esc(sln.name))\nfor i,prj in ipairs(sln.projects) do\nlocal name = premake.esc(prj.name)\nlocal fname = path.join(path.getrelative(sln.location, prj.location), prj.name)\nlocal active = iif(i==1, \"Yes\", \"No\")\n_p(' <Project Name=\"%s\" Path=\"%s.project\" Active=\"%s\" />', name, fname, active)\nend\nlocal platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \n_p(' <BuildMatrix>')\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\nlocal name = premake.getconfigname(cfgname, platform)\n_p(' <WorkspaceConfiguration Name=\"%s\" Selected=\"yes\">', name)\nfor _,prj in ipairs(sln.projects) do\n_p(' <Project Name=\"%s\" ConfigName=\"%s\"/>', prj.name, name)\nend\n_p(' </WorkspaceConfiguration>')\nend\nend\n_p(' </BuildMatrix>')\n_p('</CodeLite_Workspace>')\nend\n",
+ "function premake.codelite_project(prj)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<CodeLite_Project Name=\"%s\">', premake.esc(prj.name))\npremake.walksources(prj, premake.codelite_files)\nlocal types = { \nConsoleApp = \"Executable\", \nWindowedApp = \"Executable\", \nStaticLib = \"Static Library\",\nSharedLib = \"Dynamic Library\",\n}\n_p(' <Settings Type=\"%s\">', types[prj.kind])\nlocal platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nlocal name = premake.esc(cfg.longname)\nlocal compiler = iif(cfg.language == \"C\", \"gcc\", \"g++\")\n_p(' <Configuration Name=\"%s\" CompilerType=\"gnu %s\" DebuggerType=\"GNU gdb debugger\" Type=\"%s\">', name, compiler, types[cfg.kind])\nlocal fname = premake.esc(cfg.buildtarget.fullpath)\nlocal objdir = premake.esc(cfg.objectsdir)\nlocal runcmd = cfg.buildtarget.name\nlocal rundir = cfg.buildtarget.directory\nlocal pause = iif(cfg.kind == \"WindowedApp\", \"no\", \"yes\")\n_p(' <General OutputFile=\"%s\" IntermediateDirectory=\"%s\" Command=\"./%s\" CommandArguments=\"\" WorkingDirectory=\"%s\" PauseExecWhenProcTerminates=\"%s\"/>', fname, objdir, runcmd, rundir, pause)\nlocal flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions))\n_p(' <Compiler Required=\"yes\" Options=\"%s\">', table.concat(flags, \";\"))\nfor _,v in ipairs(cfg.includedirs) do\n_p(' <IncludePath Value=\"%s\"/>', premake.esc(v))\nend\nfor _,v in ipairs(cfg.defines) do\n_p(' <Preprocessor Value=\"%s\"/>', premake.esc(v))\nend\n_p(' </Compiler>')\nflags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions))\n_p(' <Linker Required=\"yes\" Options=\"%s\">', table.concat(flags, \";\"))\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\n_p(' <LibraryPath Value=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\n_p(' <Library Value=\"%s\" />', premake.esc(v))\nend\n_p(' </Linker>')\nif premake.findfile(cfg, \".rc\") then\nlocal defines = table.implode(table.join(cfg.defines, cfg.resdefines), \"-D\", \";\", \"\")\nlocal options = table.concat(cfg.resoptions, \";\")\n_p(' <ResourceCompiler Required=\"yes\" Options=\"%s%s\">', defines, options)\nfor _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do\n_p(' <IncludePath Value=\"%s\"/>', premake.esc(v))\nend\n_p(' </ResourceCompiler>')\nelse\n_p(' <ResourceCompiler Required=\"no\" Options=\"\"/>')\nend\nif #cfg.prebuildcommands > 0 then\n_p(' <PreBuild>')\nfor _,v in ipairs(cfg.prebuildcommands) do\n_p(' <Command Enabled=\"yes\">%s</Command>', premake.esc(v))\nend\n_p(' </PreBuild>')\nend\nif #cfg.postbuildcommands > 0 then\n_p(' <PostBuild>')\nfor _,v in ipairs(cfg.postbuildcommands) do\n_p(' <Command Enabled=\"yes\">%s</Command>', premake.esc(v))\nend\n_p(' </PostBuild>')\nend\n_p(' <CustomBuild Enabled=\"no\">')\n_p(' <CleanCommand></CleanCommand>')\n_p(' <BuildCommand></BuildCommand>')\n_p(' <SingleFileCommand></SingleFileCommand>')\n_p(' <MakefileGenerationCommand></MakefileGenerationCommand>')\n_p(' <ThirdPartyToolName>None</ThirdPartyToolName>')\n_p(' <WorkingDirectory></WorkingDirectory>')\n_p(' </CustomBuild>')\n_p(' <AdditionalRules>')\n_p(' <CustomPostBuild></CustomPostBuild>')\n_p(' <CustomPreBuild></CustomPreBuild>')\n_p(' </AdditionalRules>')\n_p(' </Configuration>')\nend\nend\n_p(' </Settings>')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p(' <Dependencies name=\"%s\">', cfg.longname)\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p(' <Project Name=\"%s\"/>', dep.name)\nend\n_p(' </Dependencies>')\nend\nend\n_p('</CodeLite_Project>')\nend\nfunction premake.codelite_files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\" \", nestlevel + 1)\nif (state == \"GroupStart\") then\nio.write(indent .. '<VirtualDirectory Name=\"' .. path.getname(fname) .. '\">\\n')\nelseif (state == \"GroupEnd\") then\nio.write(indent .. '</VirtualDirectory>\\n')\nelse\nio.write(indent .. '<File Name=\"' .. fname .. '\"/>\\n')\nend\nend\n",
+ "function premake.make_solution(sln)\nlocal cc = premake[_OPTIONS.cc]\nlocal platforms = premake.filterplatforms(sln, cc.platforms, \"Native\")\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\ntable.insert(cfgpairs, premake.getconfigname(cfgname, platform, true))\nend\nend\n_p('# %s solution makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n_p('# Usage: make [ config=config_name ]')\n_p('# Where {config_name} is one of: %s.', table.implode(cfgpairs, '\"', '\"', ', '))\n_p('')\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true)))\n_p('endif')\n_p('export config')\n_p('')\n_p('PROJECTS := %s', table.concat(_MAKE.esc(table.extract(sln.projects, \"name\")), \" \"))\n_p('')\n_p('.PHONY: all clean $(PROJECTS)')\n_p('')\n_p('all: $(PROJECTS)')\n_p('')\nfor _, prj in ipairs(sln.projects) do\n_p('%s: %s', _MAKE.esc(prj.name), table.concat(_MAKE.esc(table.extract(premake.getdependencies(prj), \"name\")), \" \"))\n_p('\\t@echo ==== Building %s ====', prj.name)\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\n_p('')\nend\n_p('clean:')\nfor _ ,prj in ipairs(sln.projects) do\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\nend\n_p('')\nend\n",
+ "function premake.make_cpp(prj)\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\npremake.gmake_cpp_header(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(cfg, cc)\nend\nend\n_p('OBJECTS := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\n_p('\\t$(OBJDIR)/%s.o \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n \n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n \n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\nelse\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')\nend\n_p('')\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')\n_p('\\t@echo Linking %s', prj.name)\n_p('\\t$(SILENT) $(LINKCMD)')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIR):')\npremake.make_mkdirrule(\"$(OBJDIR)\")\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n_p('clean:')\n_p('\\t@echo Cleaning %s', prj.name)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nif prj.language == \"C\" then\n_p('\\t$(SILENT) $(CC) $(CFLAGS) -o $@ -c $<')\nelse\n_p('\\t$(SILENT) $(CXX) $(CXXFLAGS) -o $@ -c $<')\nend\n_p('endif')\n_p('')\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\n_p('\\t@echo $(notdir $<)')\nif (path.iscfile(file)) then\n_p('\\t$(SILENT) $(CC) $(CFLAGS) -o $@ -c $<')\nelse\n_p('\\t$(SILENT) $(CXX) $(CXXFLAGS) -o $@ -c $<')\nend\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\n_p('\\t@echo $(notdir $<)')\n_p('\\t$(SILENT) windres $< -O coff -o $@ $(RESFLAGS)')\nend\nend\n_p('')\n_p('-include $(OBJECTS:%%.o=%%.d)')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('ifndef CC')\n_p(' CC = %s', cc.cc)\n_p('endif')\n_p('')\n_p('ifndef CXX')\n_p(' CXX = %s', cc.cxx)\n_p('endif')\n_p('')\n_p('ifndef AR')\n_p(' AR = %s', cc.ar)\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES += %s', table.concat(cc.getdefines(cfg.defines), \" \"))\n_p(' INCLUDES += %s', table.concat(cc.getincludedirs(cfg.includedirs), \" \"))\n_p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p(' PCH = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader)))\n_p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader))) \n_p(' CPPFLAGS += -I$(OBJDIR) -include $(PCH)')\nend\n_p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), \" \"))\n_p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), \" \"))\n_p(' LDFLAGS += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), \" \"))\n_p(' LIBS += %s', table.concat(cc.getlinkflags(cfg), \" \"))\n_p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), \" \"))\n_p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\")), \" \"))\nif cfg.kind == \"StaticLib\" then\n_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')\nelse\n_p(' LINKCMD = $(%s) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == \"C\", \"CC\", \"CXX\"))\nend\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p('endif')\n_p('')\nend\n",
+ "local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n local name = cfg.buildtarget.basename .. \".\"\n local dir = path.getdirectory(fname)\n if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Compile\" then\ntable.insert(sources, fcfg.name)\nelseif action == \"EmbeddedResource\" then\ntable.insert(embedded, fcfg.name)\nelseif action == \"Content\" then\ncopypairs[\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name)\nelseif path.getname(fcfg.name):lower() == \"app.config\" then\ncopypairs[\"$(TARGET).config\"] = _MAKE.esc(fcfg.name)\nend\nend\nlocal paths = table.translate(prj.libdirs, function(v) return path.join(prj.basedir, v) end)\npaths = table.join({prj.basedir}, paths)\nfor _, libname in ipairs(premake.getlinks(prj, \"system\", \"fullpath\")) do\nlocal libdir = os.pathsearch(libname..\".dll\", unpack(paths))\nif (libdir) then\nlocal target = \"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(libname))\nlocal source = path.getrelative(prj.basedir, path.join(libdir, libname))..\".dll\"\ncopypairs[target] = _MAKE.esc(source)\nend\nend\n_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n_p('')\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(prj.configurations[1]:lower()))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('ifndef CSC')\n_p(' CSC=%s', csc.getcompilervar(prj))\n_p('endif')\n_p('')\n_p('ifndef RESGEN')\n_p(' RESGEN=resgen')\n_p('endif')\n_p('')\nlocal platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms)\ntable.insert(platforms, 1, \"\")\nfor cfg in premake.eachconfig(prj) do\n_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\n_p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir))\n_p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \"dependencies\", \"fullpath\")), \" \"))\n_p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), \"/r:\", \"\", \" \"))\n_p(' FLAGS += %s %s', table.concat(csc.getflags(cfg), \" \"), table.implode(cfg.defines, \"/d:\", \"\", \" \"))\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p('endif')\n_p('')\nend\n_p('# To maintain compatibility with VS.NET, these values must be set at the project level')\n_p('TARGET := $(TARGETDIR)/%s', _MAKE.esc(prj.buildtarget.name))\n_p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), \"/lib:\", \"\", \" \"))\n_p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, \"system\", \"basename\")), \"/r:\", \".dll\", \" \"))\n_p('')\n_p('SOURCES := \\\\')\nfor _, fname in ipairs(sources) do\n_p('\\t%s \\\\', _MAKE.esc(path.translate(fname)))\nend\n_p('')\n_p('EMBEDFILES := \\\\')\nfor _, fname in ipairs(embedded) do\n_p('\\t%s \\\\', getresourcefilename(prj, fname))\nend\n_p('')\n_p('COPYFILES += \\\\')\nfor target, source in pairs(cfgpairs[anycfg]) do\n_p('\\t%s \\\\', target)\nend\nfor target, source in pairs(copypairs) do\n_p('\\t%s \\\\', target)\nend\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')\n_p('')\n_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)')\n_p('\\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIR):')\npremake.make_mkdirrule(\"$(OBJDIR)\")\n_p('clean:')\n_p('\\t@echo Cleaning %s', prj.name)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGETDIR)/%s.* $(COPYFILES)', prj.buildtarget.basename)\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGETDIR)/%s.*) del $(subst /,\\\\\\\\,$(TARGETDIR)/%s.*)', prj.buildtarget.basename, prj.buildtarget.basename)\nfor target, source in pairs(cfgpairs[anycfg]) do\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,%s) del $(subst /,\\\\\\\\,%s)', target, target)\nend\nfor target, source in pairs(copypairs) do\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,%s) del $(subst /,\\\\\\\\,%s)', target, target)\nend\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n_p('# Per-configuration copied file rules')\nfor cfg in premake.eachconfig(prj) do\n_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\nfor target, source in pairs(cfgpairs[cfg]) do\npremake.make_copyrule(source, target)\nend\n_p('endif')\n_p('')\nend\n_p('# Copied file rules')\nfor target, source in pairs(copypairs) do\npremake.make_copyrule(source, target)\nend\n_p('# Embedded file rules')\nfor _, fname in ipairs(embedded) do \nif path.getextension(fname) == \".resx\" then\n_p('%s: %s', getresourcefilename(prj, fname), _MAKE.esc(fname))\n_p('\\t$(SILENT) $(RESGEN) $^ $@')\nend\n_p('')\nend\nend\n",
+ "function premake.vs2002_solution(sln)\nio.eol = '\\r\\n'\n_p('Microsoft Visual Studio Solution File, Format Version 7.00')\nfor prj in premake.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\n_p('EndProject')\nend\n_p('Global')\n_p('\\tGlobalSection(SolutionConfiguration) = preSolution')\nfor i, cfgname in ipairs(sln.configurations) do\n_p('\\t\\tConfigName.%d = %s', i - 1, cfgname)\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectDependencies) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectConfiguration) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\n_p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\nend\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityGlobals) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityAddIns) = postSolution')\n_p('\\tEndGlobalSection')\n_p('EndGlobal')\nend\n",
+ "local function getelements(prj, action, fname)\nif action == \"Compile\" and fname:endswith(\".cs\") then\nreturn \"SubTypeCode\"\nend\nif action == \"EmbeddedResource\" and fname:endswith(\".resx\") then\nlocal basename = fname:sub(1, -6)\nlocal testname = path.getname(basename .. \".cs\")\nif premake.findfile(prj, testname) then\nreturn \"Dependency\", testname\nend\nend\nreturn \"None\"\nend\nfunction premake.vs2002_csproj(prj)\nio.eol = \"\\r\\n\"\n_p('<VisualStudioProject>')\n_p('\\t<CSHARP')\n_p('\\t\\tProjectType = \"Local\"')\n_p('\\t\\tProductVersion = \"%s\"', iif(_ACTION == \"vs2002\", \"7.0.9254\", \"7.10.3077\"))\n_p('\\t\\tSchemaVersion = \"%s\"', iif(_ACTION == \"vs2002\", \"1.0\", \"2.0\"))\n_p('\\t\\tProjectGuid = \"{%s}\"', prj.uuid)\n_p('\\t>')\n_p('\\t\\t<Build>')\n_p('\\t\\t\\t<Settings')\n_p('\\t\\t\\t\\tApplicationIcon = \"\"')\n_p('\\t\\t\\t\\tAssemblyKeyContainerName = \"\"')\n_p('\\t\\t\\t\\tAssemblyName = \"%s\"', prj.buildtarget.basename)\n_p('\\t\\t\\t\\tAssemblyOriginatorKeyFile = \"\"')\n_p('\\t\\t\\t\\tDefaultClientScript = \"JScript\"')\n_p('\\t\\t\\t\\tDefaultHTMLPageLayout = \"Grid\"')\n_p('\\t\\t\\t\\tDefaultTargetSchema = \"IE50\"')\n_p('\\t\\t\\t\\tDelaySign = \"false\"')\nif _ACTION == \"vs2002\" then\n_p('\\t\\t\\t\\tNoStandardLibraries = \"false\"')\nend\n_p('\\t\\t\\t\\tOutputType = \"%s\"', premake.dotnet.getkind(prj))\nif _ACTION == \"vs2003\" then\n_p('\\t\\t\\t\\tPreBuildEvent = \"\"')\n_p('\\t\\t\\t\\tPostBuildEvent = \"\"')\nend\n_p('\\t\\t\\t\\tRootNamespace = \"%s\"', prj.buildtarget.basename)\nif _ACTION == \"vs2003\" then\n_p('\\t\\t\\t\\tRunPostBuildEvent = \"OnBuildSuccess\"')\nend\n_p('\\t\\t\\t\\tStartupObject = \"\"')\n_p('\\t\\t\\t>')\nfor cfg in premake.eachconfig(prj) do\n_p('\\t\\t\\t\\t<Config')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', premake.esc(cfg.name))\n_p('\\t\\t\\t\\t\\tAllowUnsafeBlocks = \"%s\"', iif(cfg.flags.Unsafe, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tBaseAddress = \"285212672\"')\n_p('\\t\\t\\t\\t\\tCheckForOverflowUnderflow = \"false\"')\n_p('\\t\\t\\t\\t\\tConfigurationOverrideFile = \"\"')\n_p('\\t\\t\\t\\t\\tDefineConstants = \"%s\"', premake.esc(table.concat(cfg.defines, \";\")))\n_p('\\t\\t\\t\\t\\tDocumentationFile = \"\"')\n_p('\\t\\t\\t\\t\\tDebugSymbols = \"%s\"', iif(cfg.flags.Symbols, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tFileAlignment = \"4096\"')\n_p('\\t\\t\\t\\t\\tIncrementalBuild = \"false\"')\nif _ACTION == \"vs2003\" then\n_p('\\t\\t\\t\\t\\tNoStdLib = \"false\"')\n_p('\\t\\t\\t\\t\\tNoWarn = \"\"')\nend\n_p('\\t\\t\\t\\t\\tOptimize = \"%s\"', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tOutputPath = \"%s\"', premake.esc(cfg.buildtarget.directory))\n_p('\\t\\t\\t\\t\\tRegisterForComInterop = \"false\"')\n_p('\\t\\t\\t\\t\\tRemoveIntegerChecks = \"false\"')\n_p('\\t\\t\\t\\t\\tTreatWarningsAsErrors = \"%s\"', iif(cfg.flags.FatalWarnings, \"true\", \"false\"))\n_p('\\t\\t\\t\\t\\tWarningLevel = \"4\"')\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</Settings>')\n_p('\\t\\t\\t<References>')\nfor _, ref in ipairs(premake.getlinks(prj, \"siblings\", \"object\")) do\n_p('\\t\\t\\t\\t<Reference')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', ref.buildtarget.basename)\n_p('\\t\\t\\t\\t\\tProject = \"{%s}\"', ref.uuid)\n_p('\\t\\t\\t\\t\\tPackage = \"{%s}\"', _VS.tool(ref))\n_p('\\t\\t\\t\\t/>')\nend\nfor _, linkname in ipairs(premake.getlinks(prj, \"system\", \"fullpath\")) do\n_p('\\t\\t\\t\\t<Reference')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', path.getbasename(linkname))\n_p('\\t\\t\\t\\t\\tAssemblyName = \"%s\"', path.getname(linkname))\nif path.getdirectory(linkname) ~= \".\" then\n_p('\\t\\t\\t\\t\\tHintPath = \"%s\"', path.translate(linkname, \"\\\\\"))\nend\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</References>')\n_p('\\t\\t</Build>')\n_p('\\t\\t<Files>')\n_p('\\t\\t\\t<Include>')\nfor fcfg in premake.eachfile(prj) do\nlocal action = premake.dotnet.getbuildaction(fcfg)\nlocal fname = path.translate(premake.esc(fcfg.name), \"\\\\\")\nlocal elements, dependency = getelements(prj, action, fcfg.name)\n_p('\\t\\t\\t\\t<File')\n_p('\\t\\t\\t\\t\\tRelPath = \"%s\"', premake.esc(fname))\n_p('\\t\\t\\t\\t\\tBuildAction = \"%s\"', action)\nif dependency then\n_p('\\t\\t\\t\\t\\tDependentUpon = \"%s\"', premake.esc(path.translate(dependency, \"\\\\\")))\nend\nif elements == \"SubTypeCode\" then\n_p('\\t\\t\\t\\t\\tSubType = \"Code\"')\nend\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</Include>')\n_p('\\t\\t</Files>')\n_p('\\t</CSHARP>')\n_p('</VisualStudioProject>')\nend\n",
+ "function premake.vs2002_csproj_user(prj)\nio.eol = \"\\r\\n\"\n_p('<VisualStudioProject>')\n_p('\\t<CSHARP>')\n_p('\\t\\t<Build>')\nlocal refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. \"/\" .. v) end)\n_p('\\t\\t\\t<Settings ReferencePath = \"%s\">', path.translate(table.concat(refpaths, \";\"), \"\\\\\"))\nfor cfg in premake.eachconfig(prj) do\n_p('\\t\\t\\t\\t<Config')\n_p('\\t\\t\\t\\t\\tName = \"%s\"', premake.esc(cfg.name))\n_p('\\t\\t\\t\\t\\tEnableASPDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tEnableASPXDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tEnableUnmanagedDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tEnableSQLServerDebugging = \"false\"')\n_p('\\t\\t\\t\\t\\tRemoteDebugEnabled = \"false\"')\n_p('\\t\\t\\t\\t\\tRemoteDebugMachine = \"\"')\n_p('\\t\\t\\t\\t\\tStartAction = \"Project\"')\n_p('\\t\\t\\t\\t\\tStartArguments = \"\"')\n_p('\\t\\t\\t\\t\\tStartPage = \"\"')\n_p('\\t\\t\\t\\t\\tStartProgram = \"\"')\n_p('\\t\\t\\t\\t\\tStartURL = \"\"')\n_p('\\t\\t\\t\\t\\tStartWorkingDirectory = \"\"')\n_p('\\t\\t\\t\\t\\tStartWithIE = \"false\"')\n_p('\\t\\t\\t\\t/>')\nend\n_p('\\t\\t\\t</Settings>')\n_p('\\t\\t</Build>')\n_p('\\t\\t<OtherProjectSettings')\n_p('\\t\\t\\tCopyProjectDestinationFolder = \"\"')\n_p('\\t\\t\\tCopyProjectUncPath = \"\"')\n_p('\\t\\t\\tCopyProjectOption = \"0\"')\n_p('\\t\\t\\tProjectView = \"ProjectFiles\"')\n_p('\\t\\t\\tProjectTrust = \"0\"')\n_p('\\t\\t/>')\n_p('\\t</CSHARP>')\n_p('</VisualStudioProject>')\nend\n",
+ "function premake.vs200x_vcproj_platforms(prj)\nlocal used = { }\n_p('\\t<Platforms>')\nfor _, cfg in ipairs(prj.solution.vstudio_configs) do\nif cfg.isreal and not table.contains(used, cfg.platform) then\ntable.insert(used, cfg.platform)\n_p('\\t\\t<Platform')\n_p('\\t\\t\\tName=\"%s\"', cfg.platform)\n_p('\\t\\t/>')\nend\nend\n_p('\\t</Platforms>')\nend\nfunction premake.vs200x_vcproj_symbols(cfg)\nif (not cfg.flags.Symbols) then\nreturn 0\nelse\nif cfg.flags.NoEditAndContinue or \n _VS.optimization(cfg) ~= 0 or \n cfg.flags.Managed or \n cfg.platform == \"x64\" then\nreturn 3\nelse\nreturn 4\nend\nend\nend\nfunction premake.vs200x_vcproj_VCCLCompilerTool(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"%s\"', iif(cfg.platform ~= \"Xbox360\", \"VCCLCompilerTool\", \"VCCLX360CompilerTool\"))\nif #cfg.buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', table.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p('\\t\\t\\t\\tOptimization=\"%s\"', _VS.optimization(cfg))\nif cfg.flags.NoFramePointer then\n_p('\\t\\t\\t\\tOmitFramePointers=\"%s\"', _VS.bool(true))\nend\nif #cfg.includedirs > 0 then\n_p('\\t\\t\\t\\tAdditionalIncludeDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nif #cfg.defines > 0 then\n_p('\\t\\t\\t\\tPreprocessorDefinitions=\"%s\"', premake.esc(table.concat(cfg.defines, \";\")))\nend\nif cfg.flags.Symbols and not cfg.flags.Managed then\n_p('\\t\\t\\t\\tMinimalRebuild=\"%s\"', _VS.bool(true))\nend\nif cfg.flags.NoExceptions then\n_p('\\t\\t\\t\\tExceptionHandling=\"%s\"', iif(_ACTION < \"vs2005\", \"FALSE\", 0))\nelseif cfg.flags.SEH and _ACTION > \"vs2003\" then\n_p('\\t\\t\\t\\tExceptionHandling=\"2\"')\nend\nif _VS.optimization(cfg) == 0 and not cfg.flags.Managed then\n_p('\\t\\t\\t\\tBasicRuntimeChecks=\"3\"')\nend\nif _VS.optimization(cfg) ~= 0 then\n_p('\\t\\t\\t\\tStringPooling=\"%s\"', _VS.bool(true))\nend\n_p('\\t\\t\\t\\tRuntimeLibrary=\"%s\"', _VS.runtime(cfg))\n_p('\\t\\t\\t\\tEnableFunctionLevelLinking=\"%s\"', _VS.bool(true))\nif _ACTION < \"vs2005\" and not cfg.flags.NoRTTI then\n_p('\\t\\t\\t\\tRuntimeTypeInfo=\"%s\"', _VS.bool(true))\nelseif _ACTION > \"vs2003\" and cfg.flags.NoRTTI then\n_p('\\t\\t\\t\\tRuntimeTypeInfo=\"%s\"', _VS.bool(false))\nend\nif cfg.flags.NativeWChar then\n_p('\\t\\t\\t\\tTreatWChar_tAsBuiltInType=\"%s\"', _VS.bool(true))\nelseif cfg.flags.NoNativeWChar then\n_p('\\t\\t\\t\\tTreatWChar_tAsBuiltInType=\"%s\"', _VS.bool(false))\nend\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p('\\t\\t\\t\\tUsePrecompiledHeader=\"%s\"', iif(_ACTION < \"vs2005\", 3, 2))\n_p('\\t\\t\\t\\tPrecompiledHeaderThrough=\"%s\"', cfg.pchheader)\nelse\n_p('\\t\\t\\t\\tUsePrecompiledHeader=\"%s\"', iif(_ACTION > \"vs2003\" or cfg.flags.NoPCH, 0, 2))\nend\n_p('\\t\\t\\t\\tWarningLevel=\"%s\"', iif(cfg.flags.ExtraWarnings, 4, 3))\nif cfg.flags.FatalWarnings then\n_p('\\t\\t\\t\\tWarnAsError=\"%s\"', _VS.bool(true))\nend\nif _ACTION < \"vs2008\" and not cfg.flags.Managed then\n_p('\\t\\t\\t\\tDetect64BitPortabilityProblems=\"%s\"', _VS.bool(not cfg.flags.No64BitChecks))\nend\n_p('\\t\\t\\t\\tProgramDataBaseFileName=\"$(OutDir)\\\\$(ProjectName).pdb\"')\n_p('\\t\\t\\t\\tDebugInformationFormat=\"%s\"', premake.vs200x_vcproj_symbols(cfg))\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCLinkerTool(cfg)\n_p('\\t\\t\\t<Tool')\nif cfg.kind ~= \"StaticLib\" then\n_p('\\t\\t\\t\\tName=\"%s\"', iif(cfg.platform ~= \"Xbox360\", \"VCLinkerTool\", \"VCX360LinkerTool\"))\nif cfg.flags.NoImportLib then\n_p('\\t\\t\\t\\tIgnoreImportLibrary=\"%s\"', _VS.bool(true))\nend\nif #cfg.linkoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', table.concat(premake.esc(cfg.linkoptions), \" \"))\nend\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\n_p('\\t\\t\\t\\tLinkIncremental=\"%s\"', iif(_VS.optimization(cfg) == 0, 2, 1))\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"))\nlocal deffile = premake.findfile(cfg, \".def\")\nif deffile then\n_p('\\t\\t\\t\\tModuleDefinitionFile=\"%s\"', deffile)\nend\nif cfg.flags.NoManifest then\n_p('\\t\\t\\t\\tGenerateManifest=\"%s\"', _VS.bool(false))\nend\n_p('\\t\\t\\t\\tGenerateDebugInformation=\"%s\"', _VS.bool(premake.vs200x_vcproj_symbols(cfg) ~= 0))\nif premake.vs200x_vcproj_symbols(cfg) ~= 0 then\n_p('\\t\\t\\t\\tProgramDatabaseFile=\"$(OutDir)\\\\$(ProjectName).pdb\"')\nend\n_p('\\t\\t\\t\\tSubSystem=\"%s\"', iif(cfg.kind == \"ConsoleApp\", 1, 2))\nif _VS.optimization(cfg) ~= 0 then\n_p('\\t\\t\\t\\tOptimizeReferences=\"2\"')\n_p('\\t\\t\\t\\tEnableCOMDATFolding=\"2\"')\nend\nif (cfg.kind == \"ConsoleApp\" or cfg.kind == \"WindowedApp\") and not cfg.flags.WinMain then\n_p('\\t\\t\\t\\tEntryPointSymbol=\"mainCRTStartup\"')\nend\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p('\\t\\t\\t\\tImportLibrary=\"%s\"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\n_p('\\t\\t\\t\\tTargetMachine=\"%d\"', iif(cfg.platform == \"x64\", 17, 1))\nelse\n_p('\\t\\t\\t\\tName=\"VCLibrarianTool\"')\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\nif #cfg.libdirs > 0 then\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.libdirs , \";\"))))\nend\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCCLCompilerTool_GCC(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCCLCompilerTool\"')\nlocal buildoptions = table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions)\nif #buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', premake.esc(table.concat(buildoptions, \" \")))\nend\nif #cfg.includedirs > 0 then\n_p('\\t\\t\\t\\tAdditionalIncludeDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nif #cfg.defines > 0 then\n_p('\\t\\t\\t\\tPreprocessorDefinitions=\"%s\"', table.concat(premake.esc(cfg.defines), \";\"))\nend\n_p('\\t\\t\\t\\tProgramDataBaseFileName=\"$(OutDir)\\\\$(ProjectName).pdb\"')\n_p('\\t\\t\\t\\tDebugInformationFormat=\"0\"')\n_p('\\t\\t\\t\\tCompileAs=\"0\"')\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCLinkerTool_GCC(cfg)\n_p('\\t\\t\\t<Tool')\nif cfg.kind ~= \"StaticLib\" then\n_p('\\t\\t\\t\\tName=\"VCLinkerTool\"')\nlocal buildoptions = table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)\nif #buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', premake.esc(table.concat(buildoptions, \" \")))\nend\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\n_p('\\t\\t\\t\\tLinkIncremental=\"0\"')\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"))\n_p('\\t\\t\\t\\tGenerateManifest=\"%s\"', _VS.bool(false))\n_p('\\t\\t\\t\\tProgramDatabaseFile=\"\"')\n_p('\\t\\t\\t\\tRandomizedBaseAddress=\"1\"')\n_p('\\t\\t\\t\\tDataExecutionPrevention=\"0\"')\nelse\n_p('\\t\\t\\t\\tName=\"VCLibrarianTool\"')\nlocal buildoptions = table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)\nif #buildoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', premake.esc(table.concat(buildoptions, \" \")))\nend\nif #cfg.links > 0 then\n_p('\\t\\t\\t\\tAdditionalDependencies=\"%s\"', table.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \" \"))\nend\n_p('\\t\\t\\t\\tOutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\nif #cfg.libdirs > 0 then\n_p('\\t\\t\\t\\tAdditionalLibraryDirectories=\"%s\"', premake.esc(path.translate(table.concat(cfg.libdirs , \";\"))))\nend\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCResourceCompilerTool(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCResourceCompilerTool\"')\nif #cfg.resoptions > 0 then\n_p('\\t\\t\\t\\tAdditionalOptions=\"%s\"', table.concat(premake.esc(cfg.resoptions), \" \"))\nend\nif #cfg.defines > 0 or #cfg.resdefines > 0 then\n_p('\\t\\t\\t\\tPreprocessorDefinitions=\"%s\"', table.concat(premake.esc(table.join(cfg.defines, cfg.resdefines)), \";\"))\nend\nif #cfg.includedirs > 0 or #cfg.resincludedirs > 0 then\nlocal dirs = table.join(cfg.includedirs, cfg.resincludedirs)\n_p('\\t\\t\\t\\tAdditionalIncludeDirectories=\"%s\"', premake.esc(path.translate(table.concat(dirs, \";\"), '\\\\')))\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCManifestTool(cfg)\nlocal manifests = { }\nfor _, fname in ipairs(cfg.files) do\nif path.getextension(fname) == \".manifest\" then\ntable.insert(manifests, fname)\nend\nend\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCManifestTool\"')\nif #manifests > 0 then\n_p('\\t\\t\\t\\tAdditionalManifestFiles=\"%s\"', premake.esc(table.concat(manifests, \";\")))\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_VCMIDLTool(cfg)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCMIDLTool\"')\nif cfg.platform == \"x64\" then\n_p('\\t\\t\\t\\tTargetEnvironment=\"3\"')\nend\n_p('\\t\\t\\t/>')\nend\nfunction premake.vs200x_vcproj_buildstepsblock(name, steps)\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"%s\"', name)\nif #steps > 0 then\n_p('\\t\\t\\t\\tCommandLine=\"%s\"', premake.esc(table.implode(steps, \"\", \"\", \"\\r\\n\")))\nend\n_p('\\t\\t\\t/>')\nend\nlocal blockmap = \n{\nVCCLCompilerTool = premake.vs200x_vcproj_VCCLCompilerTool,\nVCCLCompilerTool_GCC = premake.vs200x_vcproj_VCCLCompilerTool_GCC,\nVCLinkerTool = premake.vs200x_vcproj_VCLinkerTool,\nVCLinkerTool_GCC = premake.vs200x_vcproj_VCLinkerTool_GCC,\nVCManifestTool = premake.vs200x_vcproj_VCManifestTool,\nVCMIDLTool = premake.vs200x_vcproj_VCMIDLTool,\nVCResourceCompilerTool = premake.vs200x_vcproj_VCResourceCompilerTool,\n}\nlocal function getsections(version, platform)\nif version == \"vs2002\" then\nreturn {\n\"VCCLCompilerTool\",\n\"VCCustomBuildTool\",\n\"VCLinkerTool\",\n\"VCMIDLTool\",\n\"VCPostBuildEventTool\",\n\"VCPreBuildEventTool\",\n\"VCPreLinkEventTool\",\n\"VCResourceCompilerTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCWebDeploymentTool\"\n}\nend\nif version == \"vs2003\" then\nreturn {\n\"VCCLCompilerTool\",\n\"VCCustomBuildTool\",\n\"VCLinkerTool\",\n\"VCMIDLTool\",\n\"VCPostBuildEventTool\",\n\"VCPreBuildEventTool\",\n\"VCPreLinkEventTool\",\n\"VCResourceCompilerTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebDeploymentTool\",\n\"VCManagedWrapperGeneratorTool\",\n\"VCAuxiliaryManagedWrapperGeneratorTool\"\n}\nend\nif platform == \"Xbox360\" then\nreturn {\n\"VCPreBuildEventTool\",\n\"VCCustomBuildTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCMIDLTool\",\n\"VCCLCompilerTool\",\n\"VCManagedResourceCompilerTool\",\n\"VCResourceCompilerTool\",\n\"VCPreLinkEventTool\",\n\"VCX360LinkerTool\",\n\"VCALinkTool\",\n\"VCX360ImageTool\",\n\"VCBscMakeTool\",\n\"VCX360DeploymentTool\",\n\"VCPostBuildEventTool\",\n\"DebuggerTool\",\n}\nend\nif platform == \"PS3\" then\nreturn {\n\"VCPreBuildEventTool\",\n\"VCCustomBuildTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCMIDLTool\",\n\"VCCLCompilerTool_GCC\",\n\"VCManagedResourceCompilerTool\",\n\"VCResourceCompilerTool\",\n\"VCPreLinkEventTool\",\n\"VCLinkerTool_GCC\",\n\"VCALinkTool\",\n\"VCManifestTool\",\n\"VCXDCMakeTool\",\n\"VCBscMakeTool\",\n\"VCFxCopTool\",\n\"VCAppVerifierTool\",\n\"VCWebDeploymentTool\",\n\"VCPostBuildEventTool\"\n}\nelse\nreturn {\n\"VCPreBuildEventTool\",\n\"VCCustomBuildTool\",\n\"VCXMLDataGeneratorTool\",\n\"VCWebServiceProxyGeneratorTool\",\n\"VCMIDLTool\",\n\"VCCLCompilerTool\",\n\"VCManagedResourceCompilerTool\",\n\"VCResourceCompilerTool\",\n\"VCPreLinkEventTool\",\n\"VCLinkerTool\",\n\"VCALinkTool\",\n\"VCManifestTool\",\n\"VCXDCMakeTool\",\n\"VCBscMakeTool\",\n\"VCFxCopTool\",\n\"VCAppVerifierTool\",\n\"VCWebDeploymentTool\",\n\"VCPostBuildEventTool\"\n}\nend\nend\nfunction premake.vs200x_vcproj(prj)\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"Windows-1252\"?>')\n_p('<VisualStudioProject')\n_p('\\tProjectType=\"Visual C++\"')\nif _ACTION == \"vs2002\" then\n_p('\\tVersion=\"7.00\"')\nelseif _ACTION == \"vs2003\" then\n_p('\\tVersion=\"7.10\"')\nelseif _ACTION == \"vs2005\" then\n_p('\\tVersion=\"8.00\"')\nelseif _ACTION == \"vs2008\" then\n_p('\\tVersion=\"9.00\"')\nend\n_p('\\tName=\"%s\"', premake.esc(prj.name))\n_p('\\tProjectGUID=\"{%s}\"', prj.uuid)\nif _ACTION > \"vs2003\" then\n_p('\\tRootNamespace=\"%s\"', prj.name)\nend\n_p('\\tKeyword=\"%s\"', iif(prj.flags.Managed, \"ManagedCProj\", \"Win32Proj\"))\n_p('\\t>')\npremake.vs200x_vcproj_platforms(prj)\nif _ACTION > \"vs2003\" then\n_p('\\t<ToolFiles>')\n_p('\\t</ToolFiles>')\nend\n_p('\\t<Configurations>')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nif cfginfo.isreal then\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p('\\t\\t<Configuration')\n_p('\\t\\t\\tName=\"%s\"', premake.esc(cfginfo.name))\n_p('\\t\\t\\tOutputDirectory=\"%s\"', premake.esc(cfg.buildtarget.directory))\n_p('\\t\\t\\tIntermediateDirectory=\"%s\"', premake.esc(cfg.objectsdir))\n_p('\\t\\t\\tConfigurationType=\"%s\"', _VS.cfgtype(cfg))\n_p('\\t\\t\\tCharacterSet=\"%s\"', iif(cfg.flags.Unicode, 1, 2))\nif cfg.flags.Managed then\n_p('\\t\\t\\tManagedExtensions=\"true\"')\nend\n_p('\\t\\t\\t>')\nfor _, block in ipairs(getsections(_ACTION, cfginfo.src_platform)) do\nif blockmap[block] then\nblockmap[block](cfg)\nelseif block == \"VCPreBuildEventTool\" then\npremake.vs200x_vcproj_buildstepsblock(\"VCPreBuildEventTool\", cfg.prebuildcommands)\nelseif block == \"VCPreLinkEventTool\" then\npremake.vs200x_vcproj_buildstepsblock(\"VCPreLinkEventTool\", cfg.prelinkcommands)\nelseif block == \"VCPostBuildEventTool\" then\npremake.vs200x_vcproj_buildstepsblock(\"VCPostBuildEventTool\", cfg.postbuildcommands)\nelseif block == \"VCX360DeploymentTool\" then\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"VCX360DeploymentTool\"')\n_p('\\t\\t\\t\\tDeploymentType=\"0\"')\n_p('\\t\\t\\t/>')\nelseif block == \"DebuggerTool\" then\n_p('\\t\\t\\t<DebuggerTool')\n_p('\\t\\t\\t/>')\nelse\n_p('\\t\\t\\t<Tool')\n_p('\\t\\t\\t\\tName=\"%s\"', block)\n_p('\\t\\t\\t/>')\nend\nend\n_p('\\t\\t</Configuration>')\nend\nend\n_p('\\t</Configurations>')\n_p('\\t<References>')\n_p('\\t</References>')\n_p('\\t<Files>')\npremake.walksources(prj, _VS.files)\n_p('\\t</Files>')\n_p('\\t<Globals>')\n_p('\\t</Globals>')\n_p('</VisualStudioProject>')\nend\n",
+ "function premake.vs2003_solution(sln)\nio.eol = '\\r\\n'\n_p('Microsoft Visual Studio Solution File, Format Version 8.00')\nfor prj in premake.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\n_p('\\tProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p('\\t\\t{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p('\\tEndProjectSection')\nend\n_p('EndProject')\nend\n_p('Global')\n_p('\\tGlobalSection(SolutionConfiguration) = preSolution')\nfor _, cfgname in ipairs(sln.configurations) do\n_p('\\t\\t%s = %s', cfgname, cfgname)\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectDependencies) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ProjectConfiguration) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\n_p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\nend\nend\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityGlobals) = postSolution')\n_p('\\tEndGlobalSection')\n_p('\\tGlobalSection(ExtensibilityAddIns) = postSolution')\n_p('\\tEndGlobalSection')\n_p('EndGlobal')\nend\n",
+ "function premake.vs2005_solution(sln)\nio.eol = '\\r\\n'\nsln.vstudio_configs = premake.vstudio_buildconfigs(sln)\n_p('\\239\\187\\191')\n_p('Microsoft Visual Studio Solution File, Format Version %s', iif(_ACTION == 'vs2005', '9.00', '10.00'))\n_p('# Visual Studio %s', iif(_ACTION == 'vs2005', '2005', '2008'))\nfor prj in premake.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)), \"\\\\\")\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\n_p('\\tProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p('\\t\\t{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p('\\tEndProjectSection')\nend\n_p('EndProject')\nend\n_p('Global')\npremake.vs2005_solution_platforms(sln)\npremake.vs2005_solution_project_platforms(sln)\npremake.vs2005_solution_properties(sln)\n_p('EndGlobal')\nend\nfunction premake.vs2005_solution_platforms(sln)\n_p('\\tGlobalSection(SolutionConfigurationPlatforms) = preSolution')\nfor _, cfg in ipairs(sln.vstudio_configs) do\n_p('\\t\\t%s = %s', cfg.name, cfg.name)\nend\n_p('\\tEndGlobalSection')\nend\nfunction premake.vs2005_solution_project_platforms(sln)\n_p('\\tGlobalSection(ProjectConfigurationPlatforms) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfg in ipairs(sln.vstudio_configs) do\nlocal mapped\nif premake.isdotnetproject(prj) then\nmapped = \"Any CPU\"\nelse\nif cfg.platform == \"Any CPU\" or cfg.platform == \"Mixed Platforms\" then\nmapped = sln.vstudio_configs[3].platform\nelse\nmapped = cfg.platform\nend\nend\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\nif mapped == cfg.platform or cfg.platform == \"Mixed Platforms\" then\n_p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\nend\nend\nend\n_p('\\tEndGlobalSection')\nend\nfunction premake.vs2005_solution_properties(sln)\n_p('\\tGlobalSection(SolutionProperties) = preSolution')\n_p('\\t\\tHideSolutionNode = FALSE')\n_p('\\tEndGlobalSection')\nend\n",
+ "local function getelements(prj, action, fname)\nif action == \"Compile\" and fname:endswith(\".cs\") then\nif fname:endswith(\".Designer.cs\") then\nlocal basename = fname:sub(1, -13)\nlocal testname = basename .. \".cs\"\nif premake.findfile(prj, testname) then\nreturn \"Dependency\", testname\nend\ntestname = basename .. \".resx\"\nif premake.findfile(prj, testname) then\nreturn \"AutoGen\", testname\nend\nelse\nlocal basename = fname:sub(1, -4)\nlocal testname = basename .. \".Designer.cs\"\nif premake.findfile(prj, testname) then\nreturn \"SubTypeForm\"\nend\nend\nend\nif action == \"EmbeddedResource\" and fname:endswith(\".resx\") then\nlocal basename = fname:sub(1, -6)\nlocal testname = path.getname(basename .. \".cs\")\nif premake.findfile(prj, testname) then\nif premake.findfile(prj, basename .. \".Designer.cs\") then\nreturn \"DesignerType\", testname\nelse\nreturn \"Dependency\", testname\nend\nelse\ntestname = path.getname(basename .. \".Designer.cs\")\nif premake.findfile(prj, testname) then\nreturn \"AutoGenerated\"\nend\nend\nend\nif action == \"Content\" then\nreturn \"CopyNewest\"\nend\nreturn \"None\"\nend\nfunction premake.vs2005_csproj(prj)\nio.eol = \"\\r\\n\"\nlocal vsversion, toolversion\nif _ACTION == \"vs2005\" then\nvsversion = \"8.0.50727\"\ntoolversion = nil\nelseif _ACTION == \"vs2008\" then\nvsversion = \"9.0.21022\"\ntoolversion = \"3.5\"\nend\nif toolversion then\n_p('<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"%s\">', toolversion)\nelse\n_p('<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nend\n_p(' <PropertyGroup>')\n_p(' <Configuration Condition=\" \\'$(Configuration)\\' == \\'\\' \">%s</Configuration>', premake.esc(prj.solution.configurations[1]))\n_p(' <Platform Condition=\" \\'$(Platform)\\' == \\'\\' \">AnyCPU</Platform>')\n_p(' <ProductVersion>%s</ProductVersion>', vsversion)\n_p(' <SchemaVersion>2.0</SchemaVersion>')\n_p(' <ProjectGuid>{%s}</ProjectGuid>', prj.uuid)\n_p(' <OutputType>%s</OutputType>', premake.dotnet.getkind(prj))\n_p(' <AppDesignerFolder>Properties</AppDesignerFolder>')\n_p(' <RootNamespace>%s</RootNamespace>', prj.buildtarget.basename)\n_p(' <AssemblyName>%s</AssemblyName>', prj.buildtarget.basename)\n_p(' </PropertyGroup>')\nfor cfg in premake.eachconfig(prj) do\n_p(' <PropertyGroup Condition=\" \\'$(Configuration)|$(Platform)\\' == \\'%s|AnyCPU\\' \">', premake.esc(cfg.name))\nif cfg.flags.Symbols then\n_p(' <DebugSymbols>true</DebugSymbols>')\n_p(' <DebugType>full</DebugType>')\nelse\n_p(' <DebugType>pdbonly</DebugType>')\nend\n_p(' <Optimize>%s</Optimize>', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, \"true\", \"false\"))\n_p(' <OutputPath>%s</OutputPath>', cfg.buildtarget.directory)\n_p(' <DefineConstants>%s</DefineConstants>', table.concat(premake.esc(cfg.defines), \";\"))\n_p(' <ErrorReport>prompt</ErrorReport>')\n_p(' <WarningLevel>4</WarningLevel>')\nif cfg.flags.Unsafe then\n_p(' <AllowUnsafeBlocks>true</AllowUnsafeBlocks>')\nend\nif cfg.flags.FatalWarnings then\n_p(' <TreatWarningsAsErrors>true</TreatWarningsAsErrors>')\nend\n_p(' </PropertyGroup>')\nend\n_p(' <ItemGroup>')\nfor _, ref in ipairs(premake.getlinks(prj, \"siblings\", \"object\")) do\n_p(' <ProjectReference Include=\"%s\">', path.translate(path.getrelative(prj.location, _VS.projectfile(ref)), \"\\\\\"))\n_p(' <Project>{%s}</Project>', ref.uuid)\n_p(' <Name>%s</Name>', premake.esc(ref.name))\n_p(' </ProjectReference>')\nend\nfor _, linkname in ipairs(premake.getlinks(prj, \"system\", \"basename\")) do\n_p(' <Reference Include=\"%s\" />', premake.esc(linkname))\nend\n_p(' </ItemGroup>')\n_p(' <ItemGroup>')\nfor fcfg in premake.eachfile(prj) do\nlocal action = premake.dotnet.getbuildaction(fcfg)\nlocal fname = path.translate(premake.esc(fcfg.name), \"\\\\\")\nlocal elements, dependency = getelements(prj, action, fcfg.name)\nif elements == \"None\" then\n_p(' <%s Include=\"%s\" />', action, fname)\nelse\n_p(' <%s Include=\"%s\">', action, fname)\nif elements == \"AutoGen\" then\n_p(' <AutoGen>True</AutoGen>')\nelseif elements == \"AutoGenerated\" then\n_p(' <SubType>Designer</SubType>')\n_p(' <Generator>ResXFileCodeGenerator</Generator>')\n_p(' <LastGenOutput>%s.Designer.cs</LastGenOutput>', premake.esc(path.getbasename(fcfg.name)))\nelseif elements == \"SubTypeDesigner\" then\n_p(' <SubType>Designer</SubType>')\nelseif elements == \"SubTypeForm\" then\n_p(' <SubType>Form</SubType>')\nelseif elements == \"PreserveNewest\" then\n_p(' <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>')\nend\nif dependency then\n_p(' <DependentUpon>%s</DependentUpon>', path.translate(premake.esc(dependency), \"\\\\\"))\nend\n_p(' </%s>', action)\nend\nend\n_p(' </ItemGroup>')\n_p(' <Import Project=\"$(MSBuildBinPath)\\\\Microsoft.CSharp.targets\" />')\n_p(' <!-- To modify your build process, add your task inside one of the targets below and uncomment it.')\n_p(' Other similar extension points exist, see Microsoft.Common.targets.')\n_p(' <Target Name=\"BeforeBuild\">')\n_p(' </Target>')\n_p(' <Target Name=\"AfterBuild\">')\n_p(' </Target>')\n_p(' -->')\n_p('</Project>')\nend\n",
+ "function premake.vs2005_csproj_user(prj)\nio.eol = \"\\r\\n\"\n_p('<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\n_p(' <PropertyGroup>')\nlocal refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. \"/\" .. v) end)\n_p(' <ReferencePath>%s</ReferencePath>', path.translate(table.concat(refpaths, \";\"), \"\\\\\"))\n_p(' </PropertyGroup>')\n_p('</Project>')\nend\n",
+ "local function cleantemplatefiles(this, templates)\nif (templates) then\nfor _,tmpl in ipairs(templates) do\nlocal fname = premake.getoutputname(this, tmpl[1])\nos.remove(fname)\nend\nend\nend\nnewaction {\ntrigger = \"clean\",\ndescription = \"Remove all binaries and generated files\",\nexecute = function()\nlocal solutions = { }\nlocal projects = { }\nlocal targets = { }\nlocal cwd = os.getcwd()\nlocal function rebase(parent, dir)\nreturn path.rebase(dir, parent.location, cwd)\nend\nfor _,sln in ipairs(_SOLUTIONS) do\ntable.insert(solutions, path.join(sln.location, sln.name))\nfor prj in premake.eachproject(sln) do\ntable.insert(projects, path.join(prj.location, prj.name))\nif (prj.objectsdir) then\nos.rmdir(rebase(prj, prj.objectsdir))\nend\nfor cfg in premake.eachconfig(prj) do\ntable.insert(targets, path.join(rebase(cfg, cfg.buildtarget.directory), cfg.buildtarget.basename))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"windows\", \"windows\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"macosx\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"PS3\", \"windows\").fullpath))\nif (cfg.kind == \"WindowedApp\") then\nos.rmdir(rebase(cfg, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath .. \".app\"))\nend\nos.remove(rebase(cfg, premake.gettarget(cfg, \"link\", \"windows\", \"windows\", \"windows\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"link\", \"posix\", \"posix\", \"linux\").fullpath))\nos.rmdir(rebase(cfg, cfg.objectsdir))\nend\nend\nend\nfor _,action in pairs(premake.actions) do\nfor _,sln in ipairs(_SOLUTIONS) do\ncleantemplatefiles(sln, action.solutiontemplates)\nfor prj in premake.eachproject(sln) do\ncleantemplatefiles(prj, action.projecttemplates)\nend\nend\nif (type(action.onclean) == \"function\") then\naction.onclean(solutions, projects, targets)\nend\nend\nend,\n}\n",
+ "newaction {\ntrigger = \"codeblocks\",\nshortname = \"Code::Blocks\",\ndescription = \"Code::Blocks Studio\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\", \"ow\" },\n},\nsolutiontemplates = {\n{ \".workspace\", premake.codeblocks_workspace },\n},\nprojecttemplates = {\n{ \".cbp\", premake.codeblocks_cbp },\n},\nonclean = function(solutions, projects, targets)\nfor _,name in ipairs(projects) do\nos.remove(name .. \".depend\")\nos.remove(name .. \".layout\")\nend\nend\n}\n",
+ "newaction {\ntrigger = \"codelite\",\nshortname = \"CodeLite\",\ndescription = \"CodeLite\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nsolutiontemplates = {\n{ \".workspace\", premake.codelite_workspace },\n},\nprojecttemplates = {\n{ \".project\", premake.codelite_project },\n},\nonclean = function(solutions, projects, targets)\nfor _,name in ipairs(solutions) do\nos.remove(name .. \"_wsp.mk\")\nos.remove(name .. \".tags\")\nend\nfor _,name in ipairs(projects) do\nos.remove(name .. \".mk\")\nos.remove(name .. \".list\")\nos.remove(name .. \".out\")\nend\nend\n}\n",
+ "_MAKE = { }\nfunction _MAKE.esc(value)\nif (type(value) == \"table\") then\nlocal result = { }\nfor _,v in ipairs(value) do\ntable.insert(result, _MAKE.esc(v))\nend\nreturn result\nelse\nlocal result\nresult = value:gsub(\"\\\\\", \"\\\\\\\\\")\nresult = result:gsub(\" \", \"\\\\ \")\nresult = result:gsub(\"%(\", \"\\\\%(\")\nresult = result:gsub(\"%)\", \"\\\\%)\")\nreturn result\nend\nend\nfunction premake.make_copyrule(source, target)\n_p('%s: %s', target, source)\n_p('\\t@echo Copying $(notdir %s)', target)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) cp -fR %s %s', source, target)\n_p('else')\n_p('\\t$(SILENT) copy /Y $(subst /,\\\\\\\\,%s) $(subst /,\\\\\\\\,%s)', source, target)\n_p('endif')\nend\nfunction premake.make_mkdirrule(var)\n_p('\\t@echo Creating %s', var)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) mkdir -p %s', var)\n_p('else')\n_p('\\t$(SILENT) mkdir $(subst /,\\\\\\\\,%s)', var)\n_p('endif')\n_p('')\nend\nfunction _MAKE.getmakefilename(this, searchprjs)\nlocal count = 0\nfor _,sln in ipairs(_SOLUTIONS) do\nif (sln.location == this.location) then count = count + 1 end\nif (searchprjs) then\nfor _,prj in ipairs(sln.projects) do\nif (prj.location == this.location) then count = count + 1 end\nend\nend\nend\nif (count == 1) then\nreturn \"Makefile\"\nelse\nreturn this.name .. \".make\"\nend\nend\nfunction _MAKE.getnames(tbl)\nlocal result = table.extract(tbl, \"name\")\nfor k,v in pairs(result) do\nresult[k] = _MAKE.esc(v)\nend\nreturn result\nend\nnewaction {\ntrigger = \"gmake\",\nshortname = \"GNU Make\",\ndescription = \"GNU makefiles for POSIX, MinGW, and Cygwin\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"gcc\" },\ndotnet = { \"mono\", \"msnet\", \"pnet\" },\n},\nsolutiontemplates = {\n{\nfunction(this) return _MAKE.getmakefilename(this, false) end, \npremake.make_solution\n},\n},\nprojecttemplates = {\n{ \nfunction(this) return _MAKE.getmakefilename(this, true) end, \npremake.make_cpp,\nfunction(this) return this.language == \"C\" or this.language == \"C++\" end\n},\n{\nfunction(this) return _MAKE.getmakefilename(this, true) end,\npremake.make_csharp,\nfunction(this) return this.language == \"C#\" end\n},\n},\n}\n",
+ "_VS = { }\npremake.vstudio_platforms = { \nany = \"Any CPU\", \nmixed = \"Mixed Platforms\", \nNative = \"Win32\",\nx32 = \"Win32\", \nx64 = \"x64\",\nPS3 = \"PS3\",\nXbox360 = \"Xbox 360\",\n}\nfunction _VS.arch(prj)\nif (prj.language == \"C#\") then\nif (_ACTION < \"vs2005\") then\nreturn \".NET\"\nelse\nreturn \"Any CPU\"\nend\nelse\nreturn \"Win32\"\nend\nend\nfunction _VS.bool(value)\nif (_ACTION < \"vs2005\") then\nreturn iif(value, \"TRUE\", \"FALSE\")\nelse\nreturn iif(value, \"true\", \"false\")\nend\nend\nfunction premake.vstudio_buildconfigs(sln)\nlocal cfgs = { }\nlocal platforms = premake.filterplatforms(sln, premake.vstudio_platforms, \"Native\")\nlocal hascpp = premake.hascppproject(sln)\nlocal hasdotnet = premake.hasdotnetproject(sln)\nif hasdotnet then\ntable.insert(platforms, 1, \"any\")\nend\nif hasdotnet and hascpp then\ntable.insert(platforms, 2, \"mixed\")\nend\nfor _, buildcfg in ipairs(sln.configurations) do\nfor _, platform in ipairs(platforms) do\nlocal entry = { }\nentry.src_buildcfg = buildcfg\nentry.src_platform = platform\nif platform ~= \"PS3\" then\nentry.buildcfg = buildcfg\nentry.platform = premake.vstudio_platforms[platform]\nelse\nentry.buildcfg = platform .. \" \" .. buildcfg\nentry.platform = \"Win32\"\nend\nentry.name = entry.buildcfg .. \"|\" .. entry.platform\nentry.isreal = (platform ~= \"any\" and platform ~= \"mixed\")\ntable.insert(cfgs, entry)\nend\nend\nreturn cfgs\nend\nfunction _VS.cfgtype(cfg)\nif (cfg.kind == \"SharedLib\") then\nreturn 2\nelseif (cfg.kind == \"StaticLib\") then\nreturn 4\nelse\nreturn 1\nend\nend\nfunction premake.vstudio_clean(solutions, projects, targets)\nfor _,name in ipairs(solutions) do\nos.remove(name .. \".suo\")\nos.remove(name .. \".ncb\")\nos.remove(name .. \".userprefs\") -- MonoDevelop files\nos.remove(name .. \".usertasks\")\nend\nfor _,name in ipairs(projects) do\nos.remove(name .. \".csproj.user\")\nos.remove(name .. \".csproj.webinfo\")\nlocal files = os.matchfiles(name .. \".vcproj.*.user\", name .. \".csproj.*.user\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nend\nfor _,name in ipairs(targets) do\nos.remove(name .. \".pdb\")\nos.remove(name .. \".idb\")\nos.remove(name .. \".ilk\")\nos.remove(name .. \".vshost.exe\")\nos.remove(name .. \".exe.manifest\")\nend\nend\nlocal function output(indent, value)\nio.write(indent .. value .. \"\\r\\n\")\nend\nlocal function attrib(indent, name, value)\nio.write(indent .. \"\\t\" .. name .. '=\"' .. value .. '\"\\r\\n')\nend\nfunction _VS.files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\"\\t\", nestlevel + 2)\nif (state == \"GroupStart\") then\noutput(indent, \"<Filter\")\nattrib(indent, \"Name\", path.getname(fname))\nattrib(indent, \"Filter\", \"\")\noutput(indent, \"\\t>\")\nelseif (state == \"GroupEnd\") then\noutput(indent, \"</Filter>\")\nelse\noutput(indent, \"<File\")\nattrib(indent, \"RelativePath\", path.translate(fname, \"\\\\\"))\noutput(indent, \"\\t>\")\nif (not prj.flags.NoPCH and prj.pchsource == fname) then\nfor _, cfgname in ipairs(prj.configurations) do\noutput(indent, \"\\t<FileConfiguration\")\nattrib(indent, \"\\tName\", cfgname .. \"|Win32\")\noutput(indent, \"\\t\\t>\")\noutput(indent, \"\\t\\t<Tool\")\nattrib(indent, \"\\t\\tName\", \"VCCLCompilerTool\")\nattrib(indent, \"\\t\\tUsePrecompiledHeader\", \"1\")\noutput(indent, \"\\t\\t/>\")\noutput(indent, \"\\t</FileConfiguration>\")\nend\nend\noutput(indent, \"</File>\")\nend\nend\nfunction _VS.optimization(cfg)\nlocal result = 0\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nresult = 3\nelseif (value == \"OptimizeSize\") then\nresult = 1\nelseif (value == \"OptimizeSpeed\") then\nresult = 2\nend\nend\nreturn result\nend\nfunction _VS.projectfile(prj)\nlocal extension\nif (prj.language == \"C#\") then\nextension = \".csproj\"\nelse\nextension = \".vcproj\"\nend\nlocal fname = path.join(prj.location, prj.name)\nreturn fname..extension\nend\nfunction _VS.runtime(cfg)\nlocal debugbuild = (_VS.optimization(cfg) == 0)\nif (cfg.flags.StaticRuntime) then\nreturn iif(debugbuild, 1, 0)\nelse\nreturn iif(debugbuild, 3, 2)\nend\nend\nfunction _VS.tool(prj)\nif (prj.language == \"C#\") then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelse\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\nnewaction {\ntrigger = \"vs2002\",\nshortname = \"Visual Studio 2002\",\ndescription = \"Microsoft Visual Studio 2002\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2002_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2002_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2002_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\nnewaction {\ntrigger = \"vs2003\",\nshortname = \"Visual Studio 2003\",\ndescription = \"Microsoft Visual Studio 2003\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2003_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2002_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2002_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\nnewaction {\ntrigger = \"vs2005\",\nshortname = \"Visual Studio 2005\",\ndescription = \"Microsoft Visual Studio 2005 (SharpDevelop, MonoDevelop)\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2005_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2005_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2005_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\nnewaction {\ntrigger = \"vs2008\",\nshortname = \"Visual Studio 2008\",\ndescription = \"Microsoft Visual Studio 2008\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nsolutiontemplates = {\n{ \".sln\", premake.vs2005_solution },\n},\nprojecttemplates = {\n{ \".vcproj\", premake.vs200x_vcproj, function(this) return this.language ~= \"C#\" end },\n{ \".csproj\", premake.vs2005_csproj, function(this) return this.language == \"C#\" end },\n{ \".csproj.user\", premake.vs2005_csproj_user, function(this) return this.language == \"C#\" end },\n},\nonclean = premake.vstudio_clean,\n}\n",
+ "local scriptfile = \"premake4.lua\"\nlocal shorthelp = \"Type 'premake4 --help' for help\"\nlocal versionhelp = \"premake4 (Premake Build Script Generator) %s\"\nlocal function doaction(name)\nlocal action = premake.actions[name]\nlocal function generatefiles(this, templates)\nif (not templates) then return end\nfor _,tmpl in ipairs(templates) do\nlocal output = true\nif (tmpl[3]) then\noutput = tmpl[3](this)\nend\nif (output) then\nlocal fname = path.getrelative(os.getcwd(), premake.getoutputname(this, tmpl[1]))\nprintf(\"Generating %s...\", fname)\nlocal f, err = io.open(fname, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nio.output(f)\ntmpl[2](this)\nio.output():close()\nend\nend\nend\nfor _,sln in ipairs(_SOLUTIONS) do\ngeneratefiles(sln, action.solutiontemplates)\nfor prj in premake.eachproject(sln) do\ngeneratefiles(prj, action.projecttemplates)\nend\nend\nif (action.execute) then\naction.execute()\nend\nend\nlocal function injectplatform(platform)\nif not platform then return true end\nplatform = premake.checkvalue(platform, premake.fields.platforms.allowed)\nfor _, sln in ipairs(_SOLUTIONS) 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\nif (_ACTION and premake.actions[_ACTION]) then\n_OS = premake.actions[_ACTION].os or _OS\nend\nlocal fname = _OPTIONS[\"file\"] or scriptfile\nif (os.isfile(fname)) then\ndofile(fname)\nend\nif (_OPTIONS[\"version\"]) then\nprintf(versionhelp, _PREMAKE_VERSION)\nreturn 1\nend\nif (_OPTIONS[\"help\"]) then\npremake.showhelp()\nreturn 1\nend\nif (not _ACTION) then\nprint(shorthelp)\nreturn 1\nend\nif (not os.isfile(fname)) then\nerror(\"No Premake script (\"..scriptfile..\") found!\", 2)\nend\nif (not premake.actions[_ACTION]) then\nerror(\"Error: no such action '\".._ACTION..\"'\", 0)\nend\nok, err = premake.checkoptions()\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\nprint(\"Building configurations...\")\npremake.buildconfigs()\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\nprintf(\"Running action '%s'...\", _ACTION)\ndoaction(_ACTION)\nprint(\"Done.\")\nreturn 0\nend\n",
0
};