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:
-rw-r--r--premake4.lua22
-rw-r--r--src/_manifest.lua16
-rw-r--r--src/_premake_main.lua15
-rw-r--r--src/host/scripts.c16
4 files changed, 12 insertions, 57 deletions
diff --git a/premake4.lua b/premake4.lua
index 1bab1ca..7bbb202 100644
--- a/premake4.lua
+++ b/premake4.lua
@@ -137,21 +137,11 @@ end
end
- local function embedtemplate(out, fname)
- local s = loadscript(fname)
-
- local name = path.getbasename(fname)
- out:write(string.format("\t\"_TEMPLATES.%s=premake.loadtemplatestring('%s',[[", name, name))
- out:write(s)
- out:write("]])\",\n")
- end
-
-
premake.actions["embed"] = {
description = "Embed scripts in scripts.c; required before release builds",
execute = function ()
-- load the manifest of script files
- scripts, templates, actions = dofile("src/_manifest.lua")
+ scripts = dofile("src/_manifest.lua")
table.insert(scripts, "_premake_main.lua")
-- open scripts.c and write the file header
@@ -164,16 +154,6 @@ end
print(fn)
s = embedfile(out, "src/"..fn)
end
-
- for i,fn in ipairs(templates) do
- print(fn)
- s = embedtemplate(out, "src/"..fn)
- end
-
- for i,fn in ipairs(actions) do
- print(fn)
- s = embedfile(out, "src/"..fn)
- end
out:write("\t0\n};\n");
out:close()
diff --git a/src/_manifest.lua b/src/_manifest.lua
index 763e5f9..45d6644 100644
--- a/src/_manifest.lua
+++ b/src/_manifest.lua
@@ -1,14 +1,13 @@
--
-- _manifest.lua
-- Manage the list of built-in Premake scripts.
--- Copyright (c) 2002-2008 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
--
-
-- The master list of built-in scripts. Order is important! If you want to
-- build a new script into Premake, add it to this list.
- local scripts =
+ return
{
"base/os.lua",
"base/path.lua",
@@ -41,20 +40,9 @@
"actions/vstudio/vs2005_solution.lua",
"actions/vstudio/vs2005_csproj.lua",
"actions/vstudio/vs2005_csproj_user.lua",
- }
-
-
--- The list of built in actions
-
- local actions =
- {
"actions/clean/_clean.lua",
"actions/codeblocks/_codeblocks.lua",
"actions/codelite/_codelite.lua",
"actions/make/_make.lua",
"actions/vstudio/_vstudio.lua",
}
-
-
-
- return scripts, templates, actions \ No newline at end of file
diff --git a/src/_premake_main.lua b/src/_premake_main.lua
index c72726d..97b76d4 100644
--- a/src/_premake_main.lua
+++ b/src/_premake_main.lua
@@ -69,23 +69,10 @@
-- everything gets initialized in the proper order.
if (scriptpath) then
- local scripts, templates, actions = dofile(scriptpath .. "/_manifest.lua")
-
- -- core code first
+ local scripts = dofile(scriptpath .. "/_manifest.lua")
for _,v in ipairs(scripts) do
dofile(scriptpath .. "/" .. v)
end
-
- -- then the templates
- for _,v in ipairs(templates) do
- local name = path.getbasename(v)
- _TEMPLATES[name] = premake.loadtemplatefile(scriptpath .. "/" .. v)
- end
-
- -- finally the actions
- for _,v in ipairs(actions) do
- dofile(scriptpath .. "/" .. v)
- end
end
diff --git a/src/host/scripts.c b/src/host/scripts.c
index 172da3e..45058a3 100644
--- a/src/host/scripts.c
+++ b/src/host/scripts.c
@@ -14,10 +14,14 @@ const char* builtin_scripts[] = {
"--\n\n\n\npremake.fields = \n{\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\n\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\n\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\nconfigurations = \n{\nkind = \"list\",\nscope = \"solution\",\n},\n\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\n\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\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},\n\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\n\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\n\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\n\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\n\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\n\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\n\nlanguage =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\n\nlibdirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\n\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\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\n},\n\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\n\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\n\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\n\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\n\nplatforms = \n{\nkind = \"list\",\nscope = \"solution\",\nallowed = {\n\"Native\",\n\"x32\",\n\"x64\",\n\"Universal\",\n\"Universal32\",\n\"Universal64\",\n\"Xbox360\"\n}\n},\n\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\nresdefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\nresincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\n\nresoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\n\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\n\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\n\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\n\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\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}\n\n\n\n\n\n\nlocal function 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\n\n\n\n\nfunction premake.getobject(t)\nlocal container\n\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\n\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\n\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\n\nreturn container, msg\nend\n\n\n\n\nfunction premake.setarray(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\n\nif (not container[fieldname]) then\ncontainer[fieldname] = { }\nend\n\nlocal function doinsert(value, depth)\nif (type(value) == \"table\") then\nfor _,v in ipairs(value) do\ndoinsert(v, depth + 1)\nend\nelse\nvalue, err = checkvalue(value, allowed)\nif (not value) then\nerror(err, depth)\nend\ntable.insert(container[fieldname], value)\nend\nend\n\nif (value) then\ndoinsert(value, 5)\nend\n\nreturn container[fieldname]\nend\n\n\n\n\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\n\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\n\nmakeabsolute(value)\nreturn premake.setarray(ctype, fieldname, result)\nend\n\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\n\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\n\n\n\n\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\n-- if a value was provided, set it\nif (value) then\nvalue, err = checkvalue(value, allowed)\nif (not value) then \nerror(err, 4)\nend\n\ncontainer[fieldname] = value\nend\n\nreturn container[fieldname]\nend\n\n\n\n\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\n\nif (kind == \"string\" or kind == \"path\" and value) then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\n\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\n\n\n\n\nfor name,_ in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nend\n\n\n\n\nfunction configuration(keywords)\nif not keywords then\nreturn premake.CurrentConfiguration\nend\n\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\n\nlocal cfg = { }\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\n\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\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\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\n\nreturn cfg\nend\n\n\nfunction project(name)\nif not name then\nreturn iif(type(premake.CurrentContainer) == \"project\", premake.CurrentContainer, nil)\nend\n\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\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\n-- add to master list keyed by both name and index\ntable.insert(sln.projects, prj)\nsln.projects[name] = prj\n\n-- attach a type\nsetmetatable(prj, {\n__type = \"project\",\n})\n\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.location = prj.basedir\nprj.uuid = os.uuid()\nprj.blocks = { }\nend\n\n-- add an empty, global configuration to the project\nconfiguration { }\n\nreturn premake.CurrentContainer\nend\n\n\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\n\npremake.CurrentContainer = _SOLUTIONS[name]\nif (not premake.CurrentContainer) then\nlocal sln = { }\npremake.CurrentContainer = sln\n\n-- add to master list keyed by both name and index\ntable.insert(_SOLUTIONS, sln)\n_SOLUTIONS[name] = sln\n\n-- attach a type\nsetmetatable(sln, { \n__type=\"solution\"\n})\n\nsln.name = name\nsln.location = os.getcwd()\nsln.projects = { }\nsln.blocks = { }\nsln.configurations = { }\nend\n\n-- add an empty, global configuration\nconfiguration { }\n\nreturn premake.CurrentContainer\nend\n\n\n",
"--\n\n\nlocal requiredactionfields =\n{\n\"description\",\n\"trigger\",\n}\n\nlocal requiredoptionfields = \n{\n\"description\",\n\"trigger\"\n}\n\n\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\n\nif (missing) then\nerror(\"action needs a \" .. missing, 2)\nend\n\n-- add it to the master list\npremake.actions[a.trigger] = a\nend\n\n\n\n\nfunction newoption(opt)\n-- some sanity checking\nlocal missing\nfor _, field in ipairs(requiredoptionfields) do\nif (not opt[field]) then\nmissing = field\nend\nend\n\nif (missing) then\nerror(\"action needs a \" .. missing, 2)\nend\n\n-- add it to the master list\npremake.options[opt.trigger] = opt\nend\n\n\n\n\nnewoption \n{\ntrigger = \"cc\",\nvalue = \"compiler\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC compiler (gcc/g++)\" },\n{ \"ow\", \"OpenWatcom compiler\" },\n}\n}\n\nnewoption\n{\ntrigger = \"dotnet\",\nvalue = \"value\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"ms\", \"Microsoft .NET (csc)\" },\n{ \"mono\", \"Novell Mono (mcs)\" },\n{ \"pnet\", \"Portable.NET (cscc)\" },\n}\n}\n\nnewoption\n{\ntrigger = \"file\",\nvalue = \"filename\",\ndescription = \"Process the specified Premake script file\"\n}\n\nnewoption\n{\ntrigger = \"help\",\ndescription = \"Display this information\"\n}\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}\n\nnewoption\n{\ntrigger = \"scripts\",\nvalue = \"path\",\ndescription = \"Search for additional scripts on the given path\"\n}\n\nnewoption\n{\ntrigger = \"version\",\ndescription = \"Display version information\"\n}\n",
"--\n\n\npremake.csc = { }\n\n\n\nlocal flags =\n{\nFatalWarning = \"/warnaserror\",\nOptimize = \"/optimize\",\nOptimizeSize = \"/optimize\",\nOptimizeSpeed = \"/optimize\",\nSymbols = \"/debug\",\nUnsafe = \"/unsafe\"\n}\n\n\n\nfunction premake.csc.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\n\n\n\n\nfunction premake.csc.getcompilervar(cfg)\nif (_OPTIONS.dotnet == \"ms\") then\nreturn \"csc\"\nelseif (_OPTIONS.dotnet == \"mono\") then\nreturn \"gmcs\"\nelse\nreturn \"cscc\"\nend\nend\n\n\n\n\nfunction premake.csc.getflags(cfg)\nlocal result = table.translate(cfg.flags, flags)\nreturn result\nend\n\n\n\n\nfunction premake.csc.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",
- "--\n\n\npremake.gcc = { }\npremake.targetstyle = \"linux\"\n\n\n\nlocal cflags =\n{\nExtraWarnings = \"-Wall\",\nFatalWarnings = \"-Werror\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\n\nlocal cxxflags =\n{\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\n}\n\n\n\npremake.gcc.platforms = \n{\nNative = { \nsuffix = \"\",\ncppflags = \"-MMD\", \nflags = \"\" ,\nldflags = \"\",\n},\nx32 = { \nsuffix = \"32\",\ncppflags = \"-MMD\", \nflags = \"-m32\",\nldflags = \"-L/usr/lib32\", \n},\nx64 = { \nsuffix = \"64\",\ncppflags = \"-MMD\",\nflags = \"-m64\",\nldflags = \"-L/usr/lib64\",\n},\nUniversal = { \nsuffix = \"univ\",\ncppflags = \"\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\nldflags = \"\",\n},\nUniversal32 = { \nsuffix = \"univ32\",\ncppflags = \"\",\nflags = \"-arch i386 -arch ppc\",\nldflags = \"\",\n},\nUniversal64 = { \nsuffix = \"univ64\",\ncppflags = \"\",\nflags = \"-arch x86_64 -arch ppc64\",\nldflags = \"\",\n},\n}\n\n\n\n\nfunction premake.gcc.getcppflags(cfg)\nreturn premake.gcc.platforms[cfg.platform].cppflags\nend\n\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\nif (cfg.kind == \"SharedLib\" and not os.is(\"windows\")) then\ntable.insert(result, \"-fPIC\")\nend\ntable.insert(result, premake.gcc.platforms[cfg.platform].flags)\nreturn result\nend\n\nfunction premake.gcc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\n\n\n\n\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\n\nif (cfg.kind == \"SharedLib\") then\nif os.is(\"macosx\") then\nresult = table.join(result, { \"-dynamiclib\", \"-flat_namespace\" })\nelse\ntable.insert(result, \"-shared\")\nend\n\n-- create import library for DLLs under Windows\nif (os.is(\"windows\") and not cfg.flags.NoImportLib) then\ntable.insert(result, '-Wl,--out-implib=\"'..premake.gettarget(cfg, \"link\", \"linux\").fullpath..'\"')\nend\nend\n\nif (os.is(\"windows\") and cfg.kind == \"WindowedApp\") then\ntable.insert(result, \"-mwindows\")\nend\n\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 (os.is(\"macosx\")) then\ntable.insert(result, \"-Wl,-x\")\nelse\ntable.insert(result, \"-s\")\nend\nend\n\ntable.insert(result, premake.gcc.platforms[cfg.platform].flags)\ntable.insert(result, premake.gcc.platforms[cfg.platform].ldflags)\n\nreturn result\nend\n\n\n\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nreturn result\nend\n\n\n\n\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\n\n\n\n\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",
+ "--\n\n\npremake.gcc = { }\npremake.targetstyle = \"linux\"\n\n\n\nlocal cflags =\n{\nExtraWarnings = \"-Wall\",\nFatalWarnings = \"-Werror\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\n\nlocal cxxflags =\n{\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\n}\n\n\n\npremake.gcc.platforms = \n{\nNative = { \nsuffix = \"\",\ncppflags = \"-MMD\", \n},\nx32 = { \nsuffix = \"32\",\ncppflags = \"-MMD\", \nflags = \"-m32\",\nldflags = \"-L/usr/lib32\", \n},\nx64 = { \nsuffix = \"64\",\ncppflags = \"-MMD\",\nflags = \"-m64\",\nldflags = \"-L/usr/lib64\",\n},\nUniversal = { \nsuffix = \"univ\",\ncppflags = \"\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\n},\nUniversal32 = { \nsuffix = \"univ32\",\ncppflags = \"\",\nflags = \"-arch i386 -arch ppc\",\n},\nUniversal64 = { \nsuffix = \"univ64\",\ncppflags = \"\",\nflags = \"-arch x86_64 -arch ppc64\",\n},\n}\n\n\n\n\nfunction premake.gcc.getcppflags(cfg)\nreturn premake.gcc.platforms[cfg.platform].cppflags\nend\n\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\nif (cfg.kind == \"SharedLib\" and not os.is(\"windows\")) then\ntable.insert(result, \"-fPIC\")\nend\ntable.insert(result, premake.gcc.platforms[cfg.platform].flags)\nreturn result\nend\n\nfunction premake.gcc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\n\n\n\n\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\n\nif (cfg.kind == \"SharedLib\") then\nif os.is(\"macosx\") then\nresult = table.join(result, { \"-dynamiclib\", \"-flat_namespace\" })\nelse\ntable.insert(result, \"-shared\")\nend\n\n-- create import library for DLLs under Windows\nif (os.is(\"windows\") and not cfg.flags.NoImportLib) then\ntable.insert(result, '-Wl,--out-implib=\"'..premake.gettarget(cfg, \"link\", \"linux\").fullpath..'\"')\nend\nend\n\nif (os.is(\"windows\") and cfg.kind == \"WindowedApp\") then\ntable.insert(result, \"-mwindows\")\nend\n\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 (os.is(\"macosx\")) then\ntable.insert(result, \"-Wl,-x\")\nelse\ntable.insert(result, \"-s\")\nend\nend\n\ntable.insert(result, premake.gcc.platforms[cfg.platform].flags)\ntable.insert(result, premake.gcc.platforms[cfg.platform].ldflags)\n\nreturn result\nend\n\n\n\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nreturn result\nend\n\n\n\n\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\n\n\n\n\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",
"--\n\npremake.ow = { }\npremake.ow.targetstyle = \"windows\"\n\n\n\nlocal cflags =\n{\nExtraWarnings = \"-wx\",\nFatalWarning = \"-we\",\nOptimize = \"-ox\",\nOptimizeSize = \"-os\",\nOptimizeSpeed = \"-ot\",\nSymbols = \"-d2\",\n}\n\nlocal cxxflags =\n{\nNoExceptions = \"-xd\",\nNoRTTI = \"-xr\",\n}\n\n\n\n\npremake.ow.platforms = \n{\nNative = { suffix=\"\", cflags=\"\" },\n}\n\n\n\n\nfunction premake.ow.getcppflags(cfg)\nreturn \"\"\nend\n\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\n\nfunction premake.ow.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\n\n\n\n\nfunction premake.ow.getldflags(cfg)\nlocal result = { }\n\nif (cfg.flags.Symbols) then\ntable.insert(result, \"op symf\")\nend\n\nreturn result\nend\n\n\n\nfunction premake.ow.getlinkflags(cfg)\nlocal result = { }\nreturn result\nend\n\n\n\n\nfunction premake.ow.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\n\n\n\n\nfunction premake.ow.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, '-I \"' .. dir .. '\"')\nend\nreturn result\nend\n\n",
"--\n\n\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\n-- does it need a value?\nif (opt.value and value == \"\") then\nreturn false, \"no value specified for option '\" .. key .. \"'\"\nend\n\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\n\n\n\n\nfunction premake.checkprojects()\nlocal action = premake.actions[_ACTION]\n\nfor _, sln in ipairs(_SOLUTIONS) do\n\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\n-- every solution must provide a list of configurations\nif (#sln.configurations == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs configurations\"\nend\n\nfor prj in premake.eachproject(sln) do\n\n-- every project must have a language\nif (not prj.language) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a language\"\nend\n\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\n\nfor cfg in premake.eachconfig(prj) do\n\n-- every config must have a kind\nif (not cfg.kind) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a kind in configuration '\" .. cfgname .. \"'\"\nend\n\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\n\nend\nend\nend\nreturn true\nend\n\n\n\nfunction premake.checktools()\nlocal action = premake.actions[_ACTION]\nif (not action.valid_tools) then \nreturn true \nend\n\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\n\nreturn true\nend\n",
"--\n\n\nfunction premake.showhelp()\n\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)\n\noptions = { }\nfor name,_ in pairs(premake.options) do table.insert(options, name) end\ntable.sort(options)\n\n\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\n\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\n\nif (opt.value) then trigger = trigger .. \"=\" .. opt.value end\nif (opt.allowed) then description = description .. \"; one of:\" end\n\nprintf(\" --%-15s %s\", trigger, description) \nif (opt.allowed) then\ntable.sort(opt.allowed, function(a,b) return a[1] < b[1] end)\nfor _, value in ipairs(opt.allowed) do\nprintf(\" %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\n\n-- display all actions\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor _,name in ipairs(actions) do\nprintf(\" %-17s %s\", name, premake.actions[name].description)\nend\nprintf(\"\")\n\n\n-- see more\nprintf(\"For additional information, see http://industriousone.com/premake\")\n\nend\n\n\n",
+ "--\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)\n\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\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\n_p('\\t\\t</Project>')\nend\n\n_p('\\t</Workspace>')\n_p('</CodeBlocks_workspace_file>')\nend\n\n",
+ "--\n\nfunction premake.codeblocks_cbp(prj)\n-- alias the C/C++ compiler interface\nlocal cc = premake[_OPTIONS.cc]\n\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\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\n-- write configuration blocks\n_p('\\t\\t<Build>')\nfor cfg in premake.eachconfig(prj) do\n_p('\\t\\t\\t<Target title=\"%s\">', premake.esc(cfg.name))\n\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\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\n_p('\\t\\t\\t\\t<Option compiler=\"%s\" />', _OPTIONS.cc)\n\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\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\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\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\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\n_p('\\t\\t\\t\\t</ExtraCommands>')\nend\n-- end build steps --\n\n_p('\\t\\t\\t</Target>')\nend\n_p('\\t\\t</Build>')\n\n-- begin files block --\nfor _,fname in ipairs(prj.files) do\n_p('\\t\\t<Unit filename=\"%s\">', premake.esc(fname))\nif path.getextension(fname) == \".rc\" 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\"))\nif (not prj.flags.NoPCH and fname == prj.pchheader) then\n_p('\\t\\t\\t<Option compile=\"1\" />')\n_p('\\t\\t\\t<Option weight=\"0\" />')\nend\nend\n_p('\\t\\t</Unit>')\nend\n-- end files block --\n\n_p('\\t\\t<Extensions />')\n_p('\\t</Project>')\n_p('</CodeBlocks_project_file>')\n_p('')\n\nend\n",
+ "--\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))\n\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\n_p(' <BuildMatrix>')\nfor _, cfgname in ipairs(sln.configurations) do\n_p(' <WorkspaceConfiguration Name=\"%s\" Selected=\"yes\">', cfgname)\n\nfor _,prj in ipairs(sln.projects) do\n_p(' <Project Name=\"%s\" ConfigName=\"%s\"/>', prj.name, cfgname)\nend\n\n_p(' </WorkspaceConfiguration>')\nend\n_p(' </BuildMatrix>')\n_p('</CodeLite_Workspace>')\nend\n\n",
+ "--\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))\n\npremake.walksources(prj, prj.files, premake.codelite_files)\n\nlocal types = { \nConsoleApp = \"Executable\", \nWindowedApp = \"Executable\", \nStaticLib = \"Static Library\",\nSharedLib = \"Dynamic Library\",\n}\n_p(' <Settings Type=\"%s\">', types[prj.kind])\n\nfor cfg in premake.eachconfig(prj) do\nlocal name = premake.esc(cfg.name)\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])\n\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\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\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\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\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\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\n_p(' </Settings>')\n\nfor _,cfgname in ipairs(prj.configurations) do\n_p(' <Dependencies name=\"%s\">', cfgname)\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p(' <Project Name=\"%s\"/>', dep.name)\nend\n_p(' </Dependencies>')\nend\n\n_p('</CodeLite_Project>')\nend\n\n\n\n\nfunction premake.codelite_files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\" \", nestlevel + 1)\n\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\n\n\n",
"--\n\nfunction premake.make_solution(sln)\n-- create a shortcut to the compiler interface\nlocal cc = premake[_OPTIONS.cc]\n\n-- build a list of supported target platforms that also includes a generic build\nlocal platforms = premake.filterplatforms(sln, cc.platforms, \"Native\")\n\n-- write a header showing the build options\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfg in ipairs(sln.configurations) do\ntable.insert(cfgpairs, cfg .. cc.platforms[platform].suffix)\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, '\"', '\"', ', '):lower())\n_p('')\n\n-- set a default configuration\n_p('ifndef config')\n_p(' config=%s%s', _MAKE.esc(sln.configurations[1]:lower()), cc.platforms[platforms[1]].suffix)\n_p('endif')\n_p('export config')\n_p('')\n\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\n-- write the project build rules\nfor _, prj in ipairs(sln.projects) do\n\n-- before each project rule, build a list of dependencies for the project. If any of\n-- these dependencies change, the project needs to be rebuilt\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p('ifeq ($(config),%s%s)', _MAKE.esc(cfg.name:lower()), cc.platforms[platform].suffix)\n_p(' DEPENDENCIES := %s', table.concat(_MAKE.esc(table.extract(premake.getdependencies(cfg), \"name\")), \" \"))\n_p('endif')\nend\nend\n_p('')\n\n_p('%s: ${DEPENDENCIES}', _MAKE.esc(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\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('')\n\nend\n",
"--\n\nfunction premake.make_cpp(prj)\n-- create a shortcut to the compiler interface\nlocal cc = premake[_OPTIONS.cc]\n\n-- build a list of supported target platforms that also includes a generic build\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\n\n-- write a quick header\n_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n\n-- set up the environment\n_p('ifndef config')\n_p(' config=%s%s', _MAKE.esc(prj.configurations[1]:lower()), cc.platforms[platforms[1]].suffix)\n_p('endif')\n_p('')\n\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n\n-- list the configurations\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p('ifeq ($(config),%s%s)', _MAKE.esc(cfg.name:lower()), cc.platforms[platform].suffix)\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\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)', cc.getcppflags(cfg))\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), cc.getlinkflags(cfg), cfg.linkoptions), \" \"))\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\")), \" \"))\n\nif cfg.kind == \"StaticLib\" then\n_p(' LINKCMD = ar -rcs $(TARGET) $(OBJECTS)')\nelse\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH)', iif(cfg.language == \"C\", \"CC\", \"CXX\"))\nend\n\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\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\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\n_p('endif')\n_p('')\nend\nend\n\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-- set up support commands like mkdir, rmdir, etc. based on the shell\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('ifeq (posix,$(SHELLTYPE))')\n_p(' define MKDIR_RULE')\n_p('\\t@echo Creating $@')\n_p('\\t$(SILENT) mkdir -p $@')\n_p(' endef')\n_p('else')\n_p(' define MKDIR_RULE')\n_p('\\t@echo Creating $@')\n_p('\\t$(SILENT) mkdir $(subst /,\\\\\\\\,$@)')\n_p(' endef')\n_p('endif')\n_p('')\n\n-- main build rule(s)\n_p('.PHONY: clean prebuild prelink')\n_p('')\n\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(OBJECTS) $(RESOURCES) prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\nelse\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(OBJECTS) $(RESOURCES) prelink $(TARGET)')\nend\n_p('')\n\n_p('$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES)')\n_p('\\t@echo Linking %s', prj.name)\n_p('\\t@$(LINKCMD)')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n\n-- create destination directories\n_p('$(TARGETDIR):')\n_p('\\t$(MKDIR_RULE)')\n_p('')\n\n_p('$(OBJDIR):')\n_p('\\t$(MKDIR_RULE)')\n_p('')\n\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\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\n-- custom build step targets\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n\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\n-- include the dependencies, built by GCC (with the -MMD flag)\n_p('-include $(OBJECTS:%%.o=%%.d)')\nend\n\n\n\nfunction premake.gmake_cpp_config(cfg)\nlocal cc = premake[_OPTIONS.cc]\nlocal platform = cc.platforms[cfg.platform or \"Native\"].suffix\n\n_p('ifeq ($(config),%s%s)', _MAKE.esc(cfg.name:lower()), platform)\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\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)', cc.getcppflags(cfg))\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), cc.getlinkflags(cfg), cfg.linkoptions), \" \"))\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\")), \" \"))\n\nif cfg.kind == \"StaticLib\" then\n_p(' LINKCMD = ar -rcs $(TARGET) $(OBJECTS)')\nelse\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH)', iif(cfg.language == \"C\", \"CC\", \"CXX\"))\nend\n\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\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\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\n_p('endif')\n_p('')\nend\n",
"--\n\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)/\" .. name .. path.getbasename(fname) .. \".resources\"\nelse\nreturn fname\nend\nend\n\n\n\nfunction premake.make_csharp(prj)\nlocal csc = premake.csc\n\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)/\"..path.getname(fname)] = fname\nend\nend\nend\n\n-- sort the files into categories, based on their build action\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\n\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)/\"..path.getname(fcfg.name)] = fcfg.name\nelseif path.getname(fcfg.name):lower() == \"app.config\" then\ncopypairs[\"$(TARGET).config\"] = fcfg.name\nend\nend\n\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)/\"..path.getname(libname)\nlocal source = path.getrelative(prj.basedir, path.join(libdir, libname))..\".dll\"\ncopypairs[target] = source\nend\nend\n\n-- end of preprocessing --\n\n\n-- set up the environment\n_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)\n_p('')\n\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(prj.configurations[1]:lower()))\n_p('endif')\n_p('')\n\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n\n_p('ifndef CSC')\n_p(' CSC=%s', csc.getcompilervar(prj))\n_p('endif')\n_p('')\n\n_p('ifndef RESGEN')\n_p(' RESGEN=resgen')\n_p('endif')\n_p('')\n\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\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\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\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\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\n_p('endif')\n_p('')\nend\n\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\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\n_p('EMBEDFILES := \\\\')\nfor _, fname in ipairs(embedded) do\n_p('\\t%s \\\\', _MAKE.esc(getresourcefilename(prj, fname)))\nend\n_p('')\n\n_p('COPYFILES += \\\\')\nfor target, source in pairs(cfgpairs[anycfg]) do\n_p('\\t%s \\\\', _MAKE.esc(target))\nend\nfor target, source in pairs(copypairs) do\n_p('\\t%s \\\\', _MAKE.esc(target))\nend\n_p('')\n\n-- set up support commands like mkdir, rmdir, etc. based on the shell\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('ifeq (posix,$(SHELLTYPE))')\n_p(' define MKDIR_RULE')\n_p('\\t@echo Creating $@')\n_p('\\t$(SILENT) mkdir -p $@')\n_p(' endef')\n_p(' define COPY_RULE')\n_p('\\t@echo Copying $(notdir $@)')\n_p('\\t$(SILENT) cp -fR $^ $@')\n_p(' endef')\n_p('else')\n_p(' define MKDIR_RULE')\n_p('\\t@echo Creating $@')\n_p('\\t$(SILENT) mkdir $(subst /,\\\\\\\\,$@)')\n_p(' endef')\n_p(' define COPY_RULE')\n_p('\\t@echo Copying $(notdir $@)')\n_p('\\t$(SILENT) copy /Y $(subst /,\\\\\\\\,$^) $(subst /,\\\\\\\\,$@)')\n_p(' endef')\n_p('endif')\n\n-- main build rule(s)\n_p('.PHONY: clean prebuild prelink')\n_p('')\n\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')\n_p('')\n\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\n-- create destination directories\n_p('$(TARGETDIR):')\n_p('\\t$(MKDIR_RULE)')\n_p('')\n\n_p('$(OBJDIR):')\n_p('\\t$(MKDIR_RULE)')\n_p('')\n\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\n-- custom build step targets\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n\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\n_p('%s: %s', _MAKE.esc(target), _MAKE.esc(source))\n_p('\\t$(COPY_RULE)')\nend\n_p('endif')\nend\n_p('')\n\n_p('# Copied file rules')\nfor target, source in pairs(copypairs) do\n_p('%s: %s', _MAKE.esc(target), _MAKE.esc(source))\n_p('\\t$(COPY_RULE)')\n_p('')\nend\n\n_p('# Embedded file rules')\nfor _, fname in ipairs(embedded) do \nif path.getextension(fname) == \".resx\" then\n_p('%s: %s', _MAKE.esc(getresourcefilename(prj, fname)), _MAKE.esc(fname))\n_p('\\t$(SILENT) $(RESGEN) $^ $@')\nend\n_p('')\nend\n\nend\n",
@@ -29,15 +33,11 @@ const char* builtin_scripts[] = {
"--\n\n\nfunction premake.vs2005_solution(sln)\nio.eol = '\\r\\n'\n\n-- Mark the file as Unicode\n_p('\\239\\187\\191')\n\n-- Write the solution file version header\nif _ACTION == \"vs2005\" then\n_p('Microsoft Visual Studio Solution File, Format Version 9.00')\n_p('# Visual Studio 2005')\nelse\n_p('Microsoft Visual Studio Solution File, Format Version 10.00')\n_p('# Visual Studio 2008')\nend\n\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\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\nlocal platforms = premake.vs2005_solution_platforms(sln)\n\n_p('Global')\npremake.vs2005_solution_configurations(sln, platforms)\npremake.vs2005_solution_project_configurations(sln, platforms)\npremake.vs2005_solution_properties(sln)\n_p('EndGlobal')\nend\n\n\n\n\nfunction premake.vs2005_solution_configurations(sln, platforms)\n_p('\\tGlobalSection(SolutionConfigurationPlatforms) = preSolution')\nfor _, cfgname in ipairs(sln.configurations) do\nfor _, platform in ipairs(platforms) do\nlocal platname = premake.vstudio_platforms[platform]\n_p('\\t\\t%s|%s = %s|%s', cfgname, platname, cfgname, platname)\nend\nend\n_p('\\tEndGlobalSection')\nend\n\n\n\n\nfunction premake.vs2005_solution_project_configurations(sln, platforms)\n_p('\\tGlobalSection(ProjectConfigurationPlatforms) = postSolution')\nfor prj in premake.eachproject(sln) do\nfor _, cfgname in ipairs(sln.configurations) do\nfor i, platform in ipairs(platforms) do\nlocal platname = premake.vstudio_platforms[platform]\n\n-- .NET projects always use \"Any CPU\" platform (for now, at least)\n-- C++ projects use the current platform, or the first C++ platform \n-- if the current one is for .NET\nlocal mappedname\nif premake.isdotnetproject(prj) then\nmappedname = \"Any CPU\"\nelse\nmappedname = premake.vstudio_platforms[platforms[math.max(i, platforms._offset)]]\nend\n\n_p('\\t\\t{%s}.%s|%s.ActiveCfg = %s|%s', prj.uuid, cfgname, platname, cfgname, mappedname)\nif (platname == mappedname or platname == \"Mixed Platforms\") then\n_p('\\t\\t{%s}.%s|%s.Build.0 = %s|%s', prj.uuid, cfgname, platname, cfgname, mappedname)\nend\nend\nend\nend\n\n_p('\\tEndGlobalSection')\nend\n\n\n\n\nfunction premake.vs2005_solution_properties(sln)\n_p('\\tGlobalSection(SolutionProperties) = preSolution')\n_p('\\t\\tHideSolutionNode = FALSE')\n_p('\\tEndGlobalSection')\nend\n\n\n\n\nfunction premake.vs2005_solution_platforms(sln)\nlocal platforms = premake.filterplatforms(sln, premake.vstudio_platforms, \"x32\")\nplatforms._offset = 1\n\nlocal hascpp = premake.hascppproject(sln)\nlocal hasdotnet = premake.hasdotnetproject(sln)\nif hasdotnet then\ntable.insert(platforms, 1, \"any\")\nplatforms._offset = 2\nend\nif hasdotnet and hascpp then\ntable.insert(platforms, 2, \"mixed\")\nplatforms._offset = 3\nend\n\nreturn platforms\nend\n",
"--\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-- \n\nfunction getelements(prj, action, fname)\n\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\n\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\n\nif action == \"Content\" then\nreturn \"CopyNewest\"\nend\n\nreturn \"None\"\nend\n\n\nfunction premake.vs2005_csproj(prj)\nio.eol = \"\\r\\n\"\n\nlocal vsversion, toolversion\nif _ACTION == \"vs2005\" then\nvsversion = \"8.0.50727\"\ntoolversion = nil\nelseif _ACTION == \"vs2008\" then\nvsversion = \"9.0.50727\"\ntoolversion = \"3.5\"\nend\n\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\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.csc.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>')\n\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\n_p(' <ItemGroup>')\nfor _, prj in ipairs(premake.getlinks(prj, \"siblings\", \"object\")) do\n_p(' <ProjectReference Include=\"%s\">', path.translate(path.getrelative(prj.location, _VS.projectfile(prj)), \"\\\\\"))\n_p(' <Project>{%s}</Project>', prj.uuid)\n_p(' <Name>%s</Name>', premake.esc(prj.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\n_p(' <ItemGroup>')\nfor fcfg in premake.eachfile(prj) do\nlocal action = premake.csc.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\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\n",
"--\n\nfunction premake.vs2005_csproj_user(prj)\nio.eol = \"\\r\\n\"\n\n_p('<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\n_p(' <PropertyGroup>')\n\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>')\n\nend\n",
- "--\n\n\nlocal scriptfile = \"premake4.lua\"\nlocal shorthelp = \"Type 'premake4 --help' for help\"\nlocal versionhelp = \"premake4 (Premake Build Script Generator) %s\"\n\n\n\n\nlocal function doaction(name)\nlocal action = premake.actions[name]\n\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\n-- call the template function to generate the output\ntmpl[2](this)\n\nio.output():close()\nend\nend\nend\n\nfor _,sln in ipairs(_SOLUTIONS) do\ngeneratefiles(sln, action.solutiontemplates)\nfor prj in premake.eachproject(sln) do\ngeneratefiles(prj, action.projecttemplates)\nend\nend\n\nif (action.execute) then\naction.execute()\nend\nend\n\n\n\n\nfunction _premake_main(scriptpath)\n\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.\n\nif (scriptpath) then\nlocal scripts, templates, actions = dofile(scriptpath .. \"/_manifest.lua\")\n\n-- core code first\nfor _,v in ipairs(scripts) do\ndofile(scriptpath .. \"/\" .. v)\nend\n\n-- then the templates\nfor _,v in ipairs(templates) do\nlocal name = path.getbasename(v)\n_TEMPLATES[name] = premake.loadtemplatefile(scriptpath .. \"/\" .. v)\nend\n\n-- finally the actions\nfor _,v in ipairs(actions) do\ndofile(scriptpath .. \"/\" .. v)\nend\nend\n\n\n-- If there is a project script available, run it to get the\n-- project information, available options and actions, etc.\n\nlocal fname = _OPTIONS[\"file\"] or scriptfile\nif (os.isfile(fname)) then\ndofile(fname)\nend\n\n\n-- Process special options\n\nif (_OPTIONS[\"version\"]) then\nprintf(versionhelp, _PREMAKE_VERSION)\nreturn 1\nend\n\nif (_OPTIONS[\"help\"]) then\npremake.showhelp()\nreturn 1\nend\n\n\n-- If no action was specified, show a short help message\n\nif (not _ACTION) then\nprint(shorthelp)\nreturn 1\nend\n\n\n-- If there wasn't a project script I've got to bail now\n\nif (not os.isfile(fname)) then\nerror(\"No Premake script (\"..scriptfile..\") found!\", 2)\nend\n\n\n-- Validate the command-line arguments. This has to happen after the\n-- script has run to allow for project-specific options\n\nif (not premake.actions[_ACTION]) then\nerror(\"Error: no such action '\".._ACTION..\"'\", 0)\nend\n\nok, err = premake.checkoptions()\nif (not ok) then error(\"Error: \" .. err, 0) end\n\n\n-- Sanity check the current project setup\n\nok, err = premake.checktools()\nif (not ok) then error(\"Error: \" .. err, 0) end\n\n-- work-in-progress: build the configurations\nprint(\"Building configurations...\")\npremake.buildconfigs()\n\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\n\n\n-- Hand over control to the action\nprintf(\"Running action '%s'...\", _ACTION)\ndoaction(_ACTION)\n\nprint(\"Done.\")\nreturn 0\n\nend\n",
- "_TEMPLATES.codeblocks_workspace=premake.loadtemplatestring('codeblocks_workspace',[[<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n<CodeBlocks_workspace_file>\n <Workspace title=\"<%= this.name %>\">\n <% for prj in premake.eachproject(this) do %>\n <Project filename=\"<%= path.join(path.getrelative(this.location, prj.location), prj.name) %>.cbp\"<%= iif(prj.project==this.projects[1], ' active=\"1\"', '') %>>\n <% for _,dep in ipairs(premake.getdependencies(prj)) do %>\n <Depends filename=\"<%= path.join(path.getrelative(this.location, dep.location), dep.name) %>.cbp\" />\n <% end %>\n </Project>\n <% end %>\n </Workspace>\n</CodeBlocks_workspace_file>\n]])",
- "_TEMPLATES.codeblocks_cbp=premake.loadtemplatestring('codeblocks_cbp',[[<% local cc = premake[_OPTIONS.cc] %>\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n<CodeBlocks_project_file>\n <FileVersion major=\"1\" minor=\"6\" />\n <Project>\n <Option title=\"<%= premake.esc(this.name) %>\" />\n <Option pch_mode=\"2\" />\n <Option compiler=\"<%= _OPTIONS.cc %>\" />\n <Build>\n <% for cfg in premake.eachconfig(this) do %>\n <Target title=\"<%= premake.esc(cfg.name) %>\">\n <Option output=\"<%= premake.esc(cfg.buildtarget.fullpath) %>\" prefix_auto=\"0\" extension_auto=\"0\" />\n <Option object_output=\"<%= premake.esc(cfg.objectsdir) %>\" />\n <% if (cfg.kind == \"WindowedApp\") then %>\n <Option type=\"0\" />\n <% elseif (cfg.kind == \"ConsoleApp\") then %>\n <Option type=\"1\" />\n <% elseif (cfg.kind == \"StaticLib\") then %>\n <Option type=\"2\" />\n <% elseif (cfg.kind == \"SharedLib\") then %>\n <Option type=\"3\" />\n <% end %>\n <Option compiler=\"<%= _OPTIONS.cc %>\" />\n <% if (cfg.kind == \"SharedLib\") then %>\n <Option createDefFile=\"0\" />\n <Option createStaticLib=\"<%= iif(cfg.flags.NoImportLib, 0, 1) %>\" />\n <% end %>\n <Compiler>\n <% for _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do %>\n <Add option=\"<%= premake.esc(flag) %>\" />\n <% end %>\n <% if not cfg.flags.NoPCH and cfg.pchheader then %>\n <Add option=\"-Winvalid-pch\" />\n <Add option=\"-include &quot;<%= premake.esc(cfg.pchheader) %>&quot;\" />\n <% end %>\n <% for _,v in ipairs(cfg.includedirs) do %>\n <Add directory=\"<%= premake.esc(v) %>\" />\n <% end %>\n </Compiler>\n <Linker>\n <% for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do %>\n <Add option=\"<%= premake.esc(flag) %>\" />\n <% end %>\n <% for _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do %>\n <Add directory=\"<%= premake.esc(v) %>\" />\n <% end %>\n <% for _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do %>\n <Add library=\"<%= premake.esc(v) %>\" />\n <% end %>\n </Linker>\n <% if premake.findfile(cfg, \".rc\") then %>\n <ResourceCompiler>\n <% for _,v in ipairs(cfg.includedirs) do %>\n <Add directory=\"<%= premake.esc(v) %>\" />\n <% end %>\n <% for _,v in ipairs(cfg.resincludedirs) do %>\n <Add directory=\"<%= premake.esc(v) %>\" />\n <% end %>\n </ResourceCompiler>\n <% end %>\n <% if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then %>\n <ExtraCommands>\n <% for _,v in ipairs(cfg.prebuildcommands) do %>\n <Add before=\"<%= premake.esc(v) %>\" />\n <% end %>\n <% for _,v in ipairs(cfg.postbuildcommands) do %>\n <Add after=\"<%= premake.esc(v) %>\" />\n <% end %>\n </ExtraCommands>\n <% end %>\n </Target>\n <% end %>\n </Build>\n <% for _,fname in ipairs(this.files) do %>\n <Unit filename=\"<%= premake.esc(fname) %>\">\n <% if path.getextension(fname) == \".rc\" then %>\n <Option compilerVar=\"WINDRES\" />\n <% elseif path.iscppfile(fname) then %>\n <Option compilerVar=\"<%= iif(this.language == \"C\", \"CC\", \"CPP\") %>\" />\n <% if (not this.flags.NoPCH and fname == this.pchheader) then %>\n <Option compile=\"1\" />\n <Option weight=\"0\" />\n <% end %>\n <% end %>\n </Unit>\n <% end %>\n <Extensions />\n </Project>\n</CodeBlocks_project_file>\n]])",
- "_TEMPLATES.codelite_workspace=premake.loadtemplatestring('codelite_workspace',[[<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<CodeLite_Workspace Name=\"<%= premake.esc(this.name) %>\" Database=\"./<%= premake.esc(this.name) %>.tags\">\n<% for i,prj in ipairs(this.projects) do %>\n <Project Name=\"<%= premake.esc(prj.name) %>\" Path=\"<%= path.join(path.getrelative(this.location, prj.location), prj.name) %>.project\" Active=\"<%= iif(i==1, \"Yes\", \"No\") %>\" />\n<% end %>\n <BuildMatrix>\n <% for _, cfgname in ipairs(this.configurations) do %>\n <WorkspaceConfiguration Name=\"<%= cfgname %>\" Selected=\"yes\">\n <% for _,prj in ipairs(this.projects) do %>\n <Project Name=\"<%= prj.name %>\" ConfigName=\"<%= cfgname %>\"/>\n <% end %>\n </WorkspaceConfiguration>\n <% end %>\n </BuildMatrix>\n</CodeLite_Workspace>\n]])",
- "_TEMPLATES.codelite_project=premake.loadtemplatestring('codelite_project',[[<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<CodeLite_Project Name=\"<%= premake.esc(this.name) %>\">\n <% premake.walksources(this, this.files, _CODELITE.files) %>\n <Settings Type=\"<%= _CODELITE.kind(this.kind) %>\">\n <% for cfg in premake.eachconfig(this) do %>\n <Configuration Name=\"<%= premake.esc(cfg.name) %>\" CompilerType=\"gnu <%= iif(cfg.language == \"C\", \"gcc\", \"g++\") %>\" DebuggerType=\"GNU gdb debugger\" Type=\"<%= _CODELITE.kind(cfg.kind) %>\">\n <General OutputFile=\"<%= premake.esc(cfg.buildtarget.fullpath) %>\" IntermediateDirectory=\"<%= premake.esc(cfg.objectsdir) %>\" Command=\"./<%= cfg.buildtarget.name %>\" CommandArguments=\"\" WorkingDirectory=\"<%= cfg.buildtarget.directory %>\" PauseExecWhenProcTerminates=\"<%= iif(cfg.kind == \"WindowedApp\", \"no\", \"yes\") %>\"/>\n <Compiler Required=\"yes\" Options=\"<%= table.concat(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions), \";\") %>\">\n <% for _,v in ipairs(cfg.includedirs) do %>\n <IncludePath Value=\"<%= premake.esc(v) %>\"/>\n <% end %>\n <% for _,v in ipairs(cfg.defines) do %>\n <Preprocessor Value=\"<%= premake.esc(v) %>\"/>\n <% end %>\n </Compiler>\n <Linker Required=\"yes\" Options=\"<%= table.concat(premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)), \";\") %>\">\n <% for _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do %>\n <LibraryPath Value=\"<%= premake.esc(v) %>\" />\n <% end %>\n <% for _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do %>\n <Library Value=\"<%= premake.esc(v) %>\" />\n <% end %>\n </Linker>\n <% if premake.findfile(cfg, \".rc\") then %>\n <ResourceCompiler Required=\"yes\" Options=\"<%= table.implode(table.join(cfg.defines,cfg.resdefines), \"-D\", \";\", \"\") %><%= table.concat(cfg.resoptions, \";\") %>\">\n <% for _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do %>\n <IncludePath Value=\"<%= premake.esc(v) %>\"/>\n <% end %>\n </ResourceCompiler>\n <% else %>\n <ResourceCompiler Required=\"no\" Options=\"\"/>\n <% end %>\n <% if #cfg.prebuildcommands > 0 then %>\n <PreBuild>\n <% for _,v in ipairs(cfg.prebuildcommands) do %>\n <Command Enabled=\"yes\"><%= premake.esc(v) %></Command>\n <% end %>\n </PreBuild>\n <% end %>\n <% if #cfg.postbuildcommands > 0 then %>\n <PostBuild>\n <% for _,v in ipairs(cfg.postbuildcommands) do %>\n <Command Enabled=\"yes\"><%= premake.esc(v) %></Command>\n <% end %>\n </PostBuild>\n <% end %>\n <CustomBuild Enabled=\"no\">\n <CleanCommand></CleanCommand>\n <BuildCommand></BuildCommand>\n <SingleFileCommand></SingleFileCommand>\n <MakefileGenerationCommand></MakefileGenerationCommand>\n <ThirdPartyToolName>None</ThirdPartyToolName>\n <WorkingDirectory></WorkingDirectory>\n </CustomBuild>\n <AdditionalRules>\n <CustomPostBuild></CustomPostBuild>\n <CustomPreBuild></CustomPreBuild>\n </AdditionalRules>\n </Configuration>\n <%end %>\n </Settings>\n <% for _,cfgname in ipairs(this.configurations) do %>\n <Dependencies name=\"<%= cfgname %>\">\n <% for _,dep in ipairs(premake.getdependencies(this)) do %>\n <Project Name=\"<%= dep.name %>\"/>\n <% end %>\n </Dependencies>\n <% end %>\n</CodeLite_Project>\n]])",
"--\n\n\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\n\n\n\nnewaction {\ntrigger = \"clean\",\ndescription = \"Remove all binaries and generated files\",\ntargetstyle = \"windows\",\n\nexecute = function()\nlocal solutions = { }\nlocal projects = { }\nlocal targets = { }\n\nlocal cwd = os.getcwd()\nlocal function rebase(parent, dir)\nreturn path.rebase(dir, parent.location, cwd)\nend\n\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))\n\nfor prj in premake.eachproject(sln) do\ntable.insert(projects, path.join(prj.location, prj.name))\n\nif (prj.objectsdir) then\nos.rmdir(rebase(prj, prj.objectsdir))\nend\n\nfor cfg in premake.eachconfig(prj) do\ntable.insert(targets, path.join(rebase(cfg, cfg.buildtarget.directory), cfg.buildtarget.basename))\n\n-- remove all possible permutations of the target binary\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"windows\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"linux\", \"linux\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"build\", \"linux\", \"macosx\").fullpath))\nif (cfg.kind == \"WindowedApp\") then\nos.rmdir(rebase(cfg, premake.gettarget(cfg, \"build\", \"linux\", \"linux\").fullpath .. \".app\"))\nend\n\n-- if there is an import library, remove that too\nos.remove(rebase(cfg, premake.gettarget(cfg, \"link\", \"windows\").fullpath))\nos.remove(rebase(cfg, premake.gettarget(cfg, \"link\", \"linux\").fullpath))\n\nos.rmdir(rebase(cfg, cfg.objectsdir))\nend\nend\nend\n\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\n\nif (type(action.onclean) == \"function\") then\naction.onclean(solutions, projects, targets)\nend\nend\nend,\n}\n",
- "--\n\n\nnewaction {\ntrigger = \"codeblocks\",\nshortname = \"Code::Blocks\",\ndescription = \"Code::Blocks Studio\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\" },\n\nvalid_tools = {\ncc = { \"gcc\", \"ow\" },\n},\n\nsolutiontemplates = {\n{ \".workspace\", _TEMPLATES.codeblocks_workspace },\n},\n\nprojecttemplates = {\n{ \".cbp\", _TEMPLATES.codeblocks_cbp },\n},\n\nonclean = function(solutions, projects, targets)\nfor _,name in ipairs(projects) do\nos.remove(name .. \".depend\")\nos.remove(name .. \".layout\")\nend\nend\n}\n",
- "--\n\n_CODELITE = { }\n\n\n\nfunction _CODELITE.kind(value)\nif (value == \"ConsoleApp\" or value == \"WindowedApp\") then\nreturn \"Executable\"\nelseif (value == \"StaticLib\") then\nreturn \"Static Library\"\nelseif (value == \"SharedLib\") then\nreturn \"Dynamic Library\"\nend\nend\n\n\n\n\nfunction _CODELITE.files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\" \", nestlevel + 1)\n\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\n\n\nnewaction {\ntrigger = \"codelite\",\nshortname = \"CodeLite\",\ndescription = \"CodeLite (experimental)\",\ntargetstyle = \"linux\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\" },\n\nvalid_tools = {\ncc = { \"gcc\" },\n},\n\nsolutiontemplates = {\n{ \".workspace\", _TEMPLATES.codelite_workspace },\n},\n\nprojecttemplates = {\n{ \".project\", _TEMPLATES.codelite_project },\n},\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\n\nnewaction {\ntrigger = \"codeblocks\",\nshortname = \"Code::Blocks\",\ndescription = \"Code::Blocks Studio\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\" },\n\nvalid_tools = {\ncc = { \"gcc\", \"ow\" },\n},\n\nsolutiontemplates = {\n{ \".workspace\", premake.codeblocks_workspace },\n},\n\nprojecttemplates = {\n{ \".cbp\", premake.codeblocks_cbp },\n},\n\nonclean = function(solutions, projects, targets)\nfor _,name in ipairs(projects) do\nos.remove(name .. \".depend\")\nos.remove(name .. \".layout\")\nend\nend\n}\n",
+ "--\n\nnewaction {\ntrigger = \"codelite\",\nshortname = \"CodeLite\",\ndescription = \"CodeLite (experimental)\",\ntargetstyle = \"linux\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\" },\n\nvalid_tools = {\ncc = { \"gcc\" },\n},\n\nsolutiontemplates = {\n{ \".workspace\", premake.codelite_workspace },\n},\n\nprojecttemplates = {\n{ \".project\", premake.codelite_project },\n},\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\n_MAKE = { }\n\n\n\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(\"\\\\\", \"\\\\\\\\\")\nreturn result\nend\nend\n\n\n\n\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\n\nif (count == 1) then\nreturn \"Makefile\"\nelse\nreturn this.name .. \".make\"\nend\nend\n\n\n\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\n\n\n\nnewaction {\ntrigger = \"gmake\",\nshortname = \"GNU Make\",\ndescription = \"GNU makefiles for POSIX, MinGW, and Cygwin\",\ntargetstyle = \"linux\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\", \"C#\" },\n\nvalid_tools = {\ncc = { \"gcc\" },\ndotnet = { \"mono\", \"ms\", \"pnet\" },\n},\n\nsolutiontemplates = {\n{\nfunction(this) return _MAKE.getmakefilename(this, false) end, \npremake.make_solution\n},\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\n_VS = { }\n\n\n\npremake.vstudio_platforms = { \nany = \"Any CPU\", \nmixed = \"Mixed Platforms\", \nNative = \"Win32\",\nx32 = \"Win32\", \nx64 = \"x64\",\nXbox360 = \"Xbox 360\",\n}\n\n\n\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\n\n\n\n\nfunction _VS.bool(value)\nif (_ACTION < \"vs2005\") then\nreturn iif(value, \"TRUE\", \"FALSE\")\nelse\nreturn iif(value, \"true\", \"false\")\nend\nend\n\n\n\n\nfunction _VS.cfgtype(cfg)\nif (cfg.kind == \"SharedLib\") then\nreturn 2\nelseif (cfg.kind == \"StaticLib\") then\nreturn 4\nelse\nreturn 1\nend\nend\n\n\n\n\nfunction premake.vstudio_filterplatforms(sln)\nlocal supported = iif(_ACTION < \"vs2005\", {}, premake.vstudio_platforms)\nreturn premake.filterplatforms(sln, supported, \"x32\")\nend\n\n\n\n\nfunction _VS.onclean(solutions, projects, targets)\nfor _,name in ipairs(solutions) do\nos.remove(name .. \".suo\")\nos.remove(name .. \".ncb\")\nend\n\nfor _,name in ipairs(projects) do\nos.remove(name .. \".csproj.user\")\nos.remove(name .. \".csproj.webinfo\")\n\nlocal files = os.matchfiles(name .. \".vcproj.*.user\", name .. \".csproj.*.user\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nend\n\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\n\n\n\n\nlocal function output(indent, value)\nio.write(indent .. value .. \"\\r\\n\")\nend\n\nlocal function attrib(indent, name, value)\nio.write(indent .. \"\\t\" .. name .. '=\"' .. value .. '\"\\r\\n')\nend\n\nfunction _VS.files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\"\\t\", nestlevel + 2)\n\nif (state == \"GroupStart\") then\noutput(indent, \"<Filter\")\nattrib(indent, \"Name\", path.getname(fname))\nattrib(indent, \"Filter\", \"\")\noutput(indent, \"\\t>\")\n\nelseif (state == \"GroupEnd\") then\noutput(indent, \"</Filter>\")\n\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\n\n\n\n\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\n\n\n\n\nfunction _VS.projectfile(prj)\nlocal extension\nif (prj.language == \"C#\") then\nextension = \".csproj\"\nelse\nextension = \".vcproj\"\nend\n\nlocal fname = path.join(prj.location, prj.name)\nreturn fname..extension\nend\n\n\n\n\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\n\n\n\n\nfunction _VS.symbols(cfg)\nif (not cfg.flags.Symbols) then\nreturn 0\nelse\n-- Edit-and-continue does't work if optimizing or managed C++\nif (cfg.flags.NoEditAndContinue or _VS.optimization(cfg) ~= 0 or cfg.flags.Managed) then\nreturn 3\nelse\nreturn 4\nend\nend\nend\n\n\n\n\nfunction _VS.tool(prj)\nif (prj.language == \"C#\") then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelse\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\n\n\n\n\n\nnewaction {\ntrigger = \"vs2002\",\nshortname = \"Visual Studio 2002\",\ndescription = \"Microsoft Visual Studio 2002\",\ntargetstyle = \"windows\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\", \"C#\" },\n\nsolutiontemplates = {\n{ \".sln\", premake.vs2002_solution },\n},\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},\n\nonclean = _VS.onclean,\n}\n\nnewaction {\ntrigger = \"vs2003\",\nshortname = \"Visual Studio 2003\",\ndescription = \"Microsoft Visual Studio 2003\",\ntargetstyle = \"windows\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\", \"C#\" },\n\nsolutiontemplates = {\n{ \".sln\", premake.vs2003_solution },\n},\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},\n\nonclean = _VS.onclean,\n}\n\nnewaction {\ntrigger = \"vs2005\",\nshortname = \"Visual Studio 2005\",\ndescription = \"Microsoft Visual Studio 2005 (SharpDevelop, MonoDevelop)\",\ntargetstyle = \"windows\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\", \"C#\" },\n\nsolutiontemplates = {\n{ \".sln\", premake.vs2005_solution },\n},\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},\n\nonclean = _VS.onclean,\n}\n\nnewaction {\ntrigger = \"vs2008\",\nshortname = \"Visual Studio 2008\",\ndescription = \"Microsoft Visual Studio 2008\",\ntargetstyle = \"windows\",\n\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\n\nvalid_languages = { \"C\", \"C++\", \"C#\" },\n\nsolutiontemplates = {\n{ \".sln\", premake.vs2005_solution },\n},\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},\n\nonclean = _VS.onclean,\n}\n",
+ "--\n\n\nlocal scriptfile = \"premake4.lua\"\nlocal shorthelp = \"Type 'premake4 --help' for help\"\nlocal versionhelp = \"premake4 (Premake Build Script Generator) %s\"\n\n\n\n\nlocal function doaction(name)\nlocal action = premake.actions[name]\n\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\n-- call the template function to generate the output\ntmpl[2](this)\n\nio.output():close()\nend\nend\nend\n\nfor _,sln in ipairs(_SOLUTIONS) do\ngeneratefiles(sln, action.solutiontemplates)\nfor prj in premake.eachproject(sln) do\ngeneratefiles(prj, action.projecttemplates)\nend\nend\n\nif (action.execute) then\naction.execute()\nend\nend\n\n\n\n\nfunction _premake_main(scriptpath)\n\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.\n\nif (scriptpath) then\nlocal scripts = dofile(scriptpath .. \"/_manifest.lua\")\nfor _,v in ipairs(scripts) do\ndofile(scriptpath .. \"/\" .. v)\nend\nend\n\n\n-- If there is a project script available, run it to get the\n-- project information, available options and actions, etc.\n\nlocal fname = _OPTIONS[\"file\"] or scriptfile\nif (os.isfile(fname)) then\ndofile(fname)\nend\n\n\n-- Process special options\n\nif (_OPTIONS[\"version\"]) then\nprintf(versionhelp, _PREMAKE_VERSION)\nreturn 1\nend\n\nif (_OPTIONS[\"help\"]) then\npremake.showhelp()\nreturn 1\nend\n\n\n-- If no action was specified, show a short help message\n\nif (not _ACTION) then\nprint(shorthelp)\nreturn 1\nend\n\n\n-- If there wasn't a project script I've got to bail now\n\nif (not os.isfile(fname)) then\nerror(\"No Premake script (\"..scriptfile..\") found!\", 2)\nend\n\n\n-- Validate the command-line arguments. This has to happen after the\n-- script has run to allow for project-specific options\n\nif (not premake.actions[_ACTION]) then\nerror(\"Error: no such action '\".._ACTION..\"'\", 0)\nend\n\nok, err = premake.checkoptions()\nif (not ok) then error(\"Error: \" .. err, 0) end\n\n\n-- Sanity check the current project setup\n\nok, err = premake.checktools()\nif (not ok) then error(\"Error: \" .. err, 0) end\n\n-- work-in-progress: build the configurations\nprint(\"Building configurations...\")\npremake.buildconfigs()\n\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\n\n\n-- Hand over control to the action\nprintf(\"Running action '%s'...\", _ACTION)\ndoaction(_ACTION)\n\nprint(\"Done.\")\nreturn 0\n\nend\n",
0
};