/* Premake's Lua scripts, as static data buffers for release mode builds */
/* DO NOT EDIT - this file is autogenerated - see BUILD.txt */
/* To regenerate this file, run: premake5 embed */

#include "premake.h"

const char* builtin_scripts_index[] = {
	"codelite/_preload.lua",
	"codelite/codelite.lua",
	"codelite/codelite_workspace.lua",
	"codelite/codelite_project.lua",
	"d/_preload.lua",
	"d/d.lua",
	"d/actions/gmake.lua",
	"d/actions/monodev.lua",
	"d/actions/vstudio.lua",
	"d/tools/dmd.lua",
	"d/tools/gdc.lua",
	"d/tools/ldc.lua",
	"monodevelop/_preload.lua",
	"monodevelop/monodevelop.lua",
	"monodevelop/monodevelop_cproj.lua",
	"xcode/_preload.lua",
	"xcode/xcode.lua",
	"xcode/xcode4_workspace.lua",
	"xcode/xcode_common.lua",
	"xcode/xcode_project.lua",
	"src/base/_foundation.lua",
	"src/base/string.lua",
	"src/base/table.lua",
	"src/base/path.lua",
	"src/base/os.lua",
	"src/base/io.lua",
	"src/base/tools.lua",
	"src/base/tree.lua",
	"src/base/globals.lua",
	"src/base/field.lua",
	"src/base/criteria.lua",
	"src/base/detoken.lua",
	"src/base/configset.lua",
	"src/base/context.lua",
	"src/base/container.lua",
	"src/base/option.lua",
	"src/base/action.lua",
	"src/base/api.lua",
	"src/base/global.lua",
	"src/base/workspace.lua",
	"src/base/group.lua",
	"src/base/project.lua",
	"src/base/config.lua",
	"src/base/fileconfig.lua",
	"src/base/rule.lua",
	"src/base/oven.lua",
	"src/base/validation.lua",
	"src/base/premake.lua",
	"src/base/help.lua",
	"src/tools/dotnet.lua",
	"src/tools/gcc.lua",
	"src/tools/msc.lua",
	"src/tools/snc.lua",
	"src/tools/clang.lua",
	"src/actions/make/_make.lua",
	"src/actions/make/make_workspace.lua",
	"src/actions/make/make_cpp.lua",
	"src/actions/make/make_csharp.lua",
	"src/actions/vstudio/_vstudio.lua",
	"src/actions/vstudio/vs2005.lua",
	"src/actions/vstudio/vs2008.lua",
	"src/actions/vstudio/vs200x_vcproj.lua",
	"src/actions/vstudio/vs200x_vcproj_user.lua",
	"src/actions/vstudio/vs2005_solution.lua",
	"src/actions/vstudio/vs2005_csproj.lua",
	"src/actions/vstudio/vs2005_csproj_user.lua",
	"src/actions/vstudio/vs2010.lua",
	"src/actions/vstudio/vs2010_vcxproj.lua",
	"src/actions/vstudio/vs2010_vcxproj_user.lua",
	"src/actions/vstudio/vs2010_vcxproj_filters.lua",
	"src/actions/vstudio/vs2010_rules_props.lua",
	"src/actions/vstudio/vs2010_rules_targets.lua",
	"src/actions/vstudio/vs2010_rules_xml.lua",
	"src/actions/vstudio/vs2012.lua",
	"src/actions/vstudio/vs2013.lua",
	"src/actions/vstudio/vs2015.lua",
	"src/actions/clean/_clean.lua",
	"src/_premake_init.lua",
	"src/_premake_main.lua",
	"src/_manifest.lua",
	"src/_modules.lua",
	NULL
};

const char* builtin_scripts[] = {
	"local p = premake\nnewaction\n{\ntrigger         = \"codelite\",\nshortname       = \"CodeLite\",\ndescription     = \"Generate CodeLite project files\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"Makefile\", \"SharedLib\", \"StaticLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools     = {\n    cc = { \"gcc\", \"clang\", \"msc\" }\n},\nonWorkspace = function(wks)\np.modules.codelite.generateWorkspace(wks)\nend,\nonProject = function(prj)\np.modules.codelite.generateProject(prj)\nend,\nonCleanWorkspace = function(wks)\np.modules.codelite.cleanWorkspace(wks)\nend,\nonCleanProject = function(prj)\np.modules.codelite.cleanProject(prj)\nend,\nonCleanTarget = function(prj)\np.modules.codelite.cleanTarget(prj)\nend,\n}\nreturn function(cfg)\nreturn (_ACTION == \"codelite\")\nend\n",

	"local p = premake\np.modules.codelite = {}\np.modules.codelite._VERSION = p._VERSION\nlocal codelite = p.modules.codelite\nlocal project = p.project\nfunction codelite.cfgname(cfg)\nlocal cfgname = cfg.buildcfg\nif codelite.workspace.multiplePlatforms then\ncfgname = string.format(\"%s|%s\", cfg.platform, cfg.buildcfg)\nend\nreturn cfgname\nend\nfunction codelite.esc(value)\nreturn value\nend\nfunction codelite.generateWorkspace(wks)\np.eol(\"\\r\\n\")\np.indent(\"  \")\np.escaper(codelite.esc)\np.generate(wks, \".workspace\", codelite.workspace.generate)\nend\nfunction codelite.generateProject(prj)\np.eol(\"\\r\\n\")\np.indent(\"  \")\np.escaper(codelite.esc)\nif project.iscpp(prj) then\np.generate(prj, \".project\", codelite.project.generate)\nend\nend\nfunction codelite.cleanWorkspace(wks)\np.clean.file(wks, wks.name .. \".workspace\")\np.clean.file(wks, wks.name .. \"_wsp.mk\")\np.clean.file(wks, wks.name .. \".tags\")\np.clean.file(wks, \".clang\")\nend\nfunction codelite.cleanProject(prj)\np.clean.file(prj, prj.name .. \".project\")\np.clean.file(prj, prj.name .. \".mk\")\np.clean.file(prj, prj.name .. \".list\")\np.clean.file(prj, prj.name .. \".out\")\nend\nfunction codelite.cleanTarget(prj)\nend\ninclude(\"codelite_workspace.lua\")\ninclude(\"codelite_project.lua\")\nreturn codelite\n",

	"local p = premake\nlocal project = p.project\nlocal workspace = p.workspace\nlocal tree = p.tree\nlocal codelite = p.modules.codelite\ncodelite.workspace = {}\nlocal m = codelite.workspace\nfunction m.generate(wks)\np.utf8()\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')\nlocal tagsdb = \"\"\n_p('<CodeLite_Workspace Name=\"%s\" Database=\"%s\" SWTLW=\"No\">', wks.name, tagsdb)\nlocal tr = workspace.grouptree(wks)\ntree.traverse(tr, {\nonleaf = function(n)\nlocal prj = n.project\nlocal prjpath = p.filename(prj, \".project\")\nprjpath = path.translate(path.getrelative(prj.workspace.location, prjpath))\nlocal active  = iif(prj.name == wks.startproject, ' Active=\"Yes\"', '')\n_x(1, '<Project Name=\"%s\" Path=\"%s\"%s/>', prj.name, prjpath, active)\nend,\nonbranch = function(n)\nend,\n})\nlocal platformsPresent = {}\nlocal numPlatforms = 0\nfor cfg in workspace.eachconfig(wks) do\nlocal platform = cfg.platform\nif platform and not platformsPresent[platform] then\nnumPlatforms = numPlatforms + 1\nplatformsPresent[platform] = true\nend\nend\nif numPlatforms >= 2 then\ncodelite.workspace.multiplePlatforms = true\nend\n_p(1, '<BuildMatrix>')\nfor cfg in workspace.eachconfig(wks) do\nlocal cfgname = codelite.cfgname(cfg)\n_p(2, '<WorkspaceConfiguration Name=\"%s\" Selected=\"yes\">', cfgname)\nlocal tr = workspace.grouptree(wks)\ntree.traverse(tr, {\nonleaf = function(n)\nlocal prj = n.project\n_p(3, '<Project Name=\"%s\" ConfigName=\"%s\"/>', prj.name, cfgname)\nend\n})\n_p(2, '</WorkspaceConfiguration>')\nend\n_p(1, '</BuildMatrix>')\n_p('</CodeLite_Workspace>')\nend\n",

	"local p = premake\nlocal tree = p.tree\nlocal project = p.project\nlocal config = p.config\nlocal codelite = p.modules.codelite\ncodelite.project = {}\nlocal m = codelite.project\nfunction codelite.getLinks(cfg)\nreturn config.getlinks(cfg, \"system\", \"fullpath\")\nend\nfunction codelite.getSiblingLinks(cfg)\nreturn config.getlinks(cfg, \"siblings\", \"fullpath\")\nend\nm.elements = {}\nm.ctools = {\ngcc = \"gnu gcc\",\nclang = \"clang\",\nmsc = \"Visual C++\",\n}\nm.cxxtools = {\ngcc = \"gnu g++\",\nclang = \"clang++\",\nmsc = \"Visual C++\",\n}\nfunction m.getcompilername(cfg)\nlocal tool = _OPTIONS.cc or cfg.toolset or p.CLANG\nlocal toolset = p.tools[tool]\nif not toolset then\nerror(\"Invalid toolset '\" + (_OPTIONS.cc or cfg.toolset) + \"'\")\nend\nif cfg.language == \"C\" then\nreturn m.ctools[tool]\nelseif cfg.language == \"C++\" then\nreturn m.cxxtools[tool]\nend\nend\nfunction m.getcompiler(cfg)\nlocal toolset = p.tools[_OPTIONS.cc or cfg.toolset or p.CLANG]\nif not toolset then\nerror(\"Invalid toolset '\" + (_OPTIONS.cc or cfg.toolset) + \"'\")\nend\nreturn toolset\nend\nlocal function configuration_iscustombuild(cfg)\nreturn cfg and (cfg.kind == p.MAKEFILE) and (#cfg.buildcommands > 0)\nend\nlocal function configuration_isfilelist(cfg)\nreturn cfg and (cfg.buildaction == \"None\") and not configuration_iscustombuild(cfg)\nend\nlocal function configuration_needresoptions(cfg)\nreturn cfg and config.findfile(cfg, \".rc\") and not configuration_iscustombuild(cfg)\nend\nm.internalTypeMap = {\nConsoleApp = \"Console\",\nWindowedApp = \"Console\",\nMakefile = \"\",\nSharedLib = \"Library\",\nStaticLib = \"Library\"\n}\nfunction m.header(prj)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')\nlocal type = m.internalTypeMap[prj.kind] or \"\"\n_x('<CodeLite_Project Name=\"%s\" InternalType=\"%s\">', prj.name, type)\nend\nfunction m.plugins(prj)\n_p(1, '<Plugins/>')\nend\nfunction m.description(prj)\n_p(1, '<Description/>')\nend\nfunction m.files(prj)\nlocal tr = project.getsourcetree(prj)\ntree.traverse(tr, {\nonbranchenter = function(node, depth)\n_p(depth, '<VirtualDirectory Name=\"%s\">', node.name)\nend,\nonbranchexit = function(node, depth)\n_p(depth, '</VirtualDirectory>')\nend,\nonleaf = function(node, depth)\n_p(depth, '<File Name=\"%s\"/>', node.relpath)\nend,\n}, false, 1)\nend\nfunction m.dependencies(prj)\nlocal dependencies = project.getdependencies(prj)\nfor cfg in project.eachconfig(prj) do\ncfgname = codelite.cfgname(cfg)\nif #dependencies > 0 then\n_p(1, '<Dependencies Name=\"%s\">', cfgname)\nfor _, dependency in ipairs(dependencies) do\n_p(2, '<Project Name=\"%s\"/>', dependency.name)\nend\n_p(1, '</Dependencies>')\nelse\n_p(1, '<Dependencies Name=\"%s\"/>', cfgname)\nend\nend\nend\nfunction m.global_compiler(prj)\n_p(3, '<Compiler Options=\"\" C_Options=\"\" Assembler=\"\">')\n_p(4, '<IncludePath Value=\".\"/>')\n_p(3, '</Compiler>')\nend\nfunction m.global_linker(prj)\n_p(3, '<Linker Options=\"\">')\n_p(4, '<LibraryPath Value=\".\"/>')\n_p(3, '</Linker>')\nend\nfunction m.global_resourceCompiler(prj)\n_p(3, '<ResourceCompiler Options=\"\"/>')\nend\nm.elements.globalSettings = function(prj)\nreturn {\nm.global_compiler,\nm.global_linker,\nm.global_resourceCompiler,\n}\nend\nfunction m.compiler(cfg)\nif configuration_iscustombuild(cfg) or configuration_isfilelist(cfg) then\n_p(3, '<Compiler Required=\"no\"/>')\nreturn\nend\nlocal toolset = m.getcompiler(cfg)\nlocal cxxflags = table.concat(table.join(toolset.getcflags(cfg), toolset.getcxxflags(cfg), cfg.buildoptions), \";\")\nlocal cflags   = table.concat(table.join(toolset.getcflags(cfg), cfg.buildoptions), \";\")\nlocal asmflags = \"\"\nlocal pch      = \"\"\n_x(3, '<Compiler Options=\"%s\" C_Options=\"%s\" Assembler=\"%s\" Required=\"yes\" PreCompiledHeader=\"%s\" PCHInCommandLine=\"no\" UseDifferentPCHFlags=\"no\" PCHFlags=\"\">', cxxflags, cflags, asmflags, pch)\nfor _, includedir in ipairs(cfg.includedirs) do\n_x(4, '<IncludePath Value=\"%s\"/>', project.getrelative(cfg.project, includedir))\nend\nfor _, define in ipairs(cfg.defines) do\n_x(4"
	", '<Preprocessor Value=\"%s\"/>', define)\nend\n_p(3, '</Compiler>')\nend\nfunction m.linker(cfg)\nif configuration_iscustombuild(cfg) or configuration_isfilelist(cfg) then\n_p(3, '<Linker Required=\"no\"/>')\nreturn\nend\nlocal toolset = m.getcompiler(cfg)\nlocal flags = table.join(toolset.getldflags(cfg), cfg.linkoptions)\nlocal withdeps = table.join(flags, codelite.getSiblingLinks(cfg))\nlocal ldflags = table.concat(withdeps, \";\")\n_x(3, '<Linker Required=\"yes\" Options=\"%s\">', ldflags)\nif #cfg.libdirs > 0 then\nlocal libdirs = project.getrelative(cfg.project, cfg.libdirs)\nfor _, libpath in ipairs(libdirs) do\n_x(4, '<LibraryPath Value=\"%s\" />', libpath)\nend\nend\nlocal links = codelite.getLinks(cfg)\nfor _, libname in ipairs(links) do\n_x(4, '<Library Value=\"%s\" />', libname)\nend\n_p(3, '</Linker>')\nend\nfunction m.resourceCompiler(cfg)\nif not configuration_needresoptions(cfg) then\n_p(3, '<ResourceCompiler Options=\"\" Required=\"no\"/>')\nreturn\nend\nlocal toolset = m.getcompiler(cfg)\nlocal defines = table.implode(toolset.getdefines(table.join(cfg.defines, cfg.resdefines)), \"\", \";\", \"\")\nlocal options = table.concat(cfg.resoptions, \";\")\n_x(3, '<ResourceCompiler Options=\"%s%s\" Required=\"yes\">', defines, options)\nfor _, includepath in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do\n_x(4, '<IncludePath Value=\"%s\"/>', project.getrelative(cfg.project, includepath))\nend\n_p(3, '</ResourceCompiler>')\nend\nfunction m.general(cfg)\nif configuration_isfilelist(cfg) then\n_p(3, '<General IntermediateDirectory=\".\" WorkingDirectory=\".\" PauseExecWhenProcTerminates=\"no\"/>')\nreturn\nend\nlocal prj = cfg.project\nlocal isExe = prj.kind == \"WindowedApp\" or prj.kind == \"ConsoleApp\"\nlocal targetpath = project.getrelative(prj, cfg.buildtarget.directory)\nlocal objdir     = project.getrelative(prj, cfg.objdir)\nlocal targetname = project.getrelative(prj, cfg.buildtarget.abspath)\nlocal command    = iif(isExe, targetname, \"\")\nlocal cmdargs    = iif(isExe, table.concat(cfg.debugargs, \" \"), \"\") -- TODO: should this be debugargs instead?\nlocal useseparatedebugargs = \"no\"\nlocal debugargs  = \"\"\nlocal workingdir = iif(isExe, targetpath, \"\")\nlocal pauseexec  = iif(prj.kind == \"ConsoleApp\", \"yes\", \"no\")\nlocal isguiprogram = iif(prj.kind == \"WindowedApp\", \"yes\", \"no\")\nlocal isenabled  = iif(cfg.flags.ExcludeFromBuild, \"no\", \"yes\")\n_x(3, '<General OutputFile=\"%s\" IntermediateDirectory=\"%s\" Command=\"%s\" CommandArguments=\"%s\" UseSeparateDebugArgs=\"%s\" DebugArguments=\"%s\" WorkingDirectory=\"%s\" PauseExecWhenProcTerminates=\"%s\" IsGUIProgram=\"%s\" IsEnabled=\"%s\"/>',\ntargetname, objdir, command, cmdargs, useseparatedebugargs, debugargs, workingdir, pauseexec, isguiprogram, isenabled)\nend\nfunction m.environment(cfg)\n_p(3, '<Environment EnvVarSetName=\"&lt;Use Defaults&gt;\" DbgSetName=\"&lt;Use Defaults&gt;\">')\nlocal variables = \"\"\n_x(4, '<![CDATA[%s]]>', variables)\n_p(3, '</Environment>')\nend\nfunction m.debugger(cfg)\n_p(3, '<Debugger IsRemote=\"%s\" RemoteHostName=\"%s\" RemoteHostPort=\"%s\" DebuggerPath=\"\" IsExtended=\"%s\">', iif(cfg.debugremotehost, \"yes\", \"no\"), cfg.debugremotehost or \"\", iif(cfg.debugport, tostring(cfg.debugport), \"\"), iif(cfg.debugextendedprotocol, \"yes\", \"no\"))\nif #cfg.debugsearchpaths > 0 then\n_p(4, '<DebuggerSearchPaths>%s</DebuggerSearchPaths>', table.concat(premake.esc(project.getrelative(cfg.project, cfg.debugsearchpaths)), \"\\n\"))\nelse\n_p(4, '<DebuggerSearchPaths/>')\nend\nif #cfg.debugconnectcommands > 0 then\n_p(4, '<PostConnectCommands>%s</PostConnectCommands>', table.concat(premake.esc(cfg.debugconnectcommands), \"\\n\"))\nelse\n_p(4, '<PostConnectCommands/>')\nend\nif #cfg.debugstartupcommands > 0 then\n_p(4, '<StartupCommands>%s</StartupCommands>', table.concat(premake.esc(cfg.debugstartupcommands), \"\\n\"))\nelse\n_p(4, '<StartupCommands/>')\nend\n_p(3, '</Debugger>')\nend\nfunction m.preBuild(cfg)\nif #cfg.prebuildcommands > 0 then\n_p(3, '<PreBuild>')\nfor _, commands in"
	" ipairs(cfg.prebuildcommands) do\n_x(4, '<Command Enabled=\"yes\">%s</Command>',\np.esc(commands))\nend\n_p(3, '</PreBuild>')\nend\nend\nfunction m.postBuild(cfg)\nif #cfg.postbuildcommands > 0 then\n_p(3, '<PostBuild>')\nfor _, commands in ipairs(cfg.postbuildcommands) do\n_x(4, '<Command Enabled=\"yes\">%s</Command>',\np.esc(commands))\nend\n_p(3, '</PostBuild>')\nend\nend\nfunction m.customBuild(cfg)\nif not configuration_iscustombuild(cfg) then\n_p(3, '<CustomBuild Enabled=\"no\"/>')\nreturn\nend\nlocal build   = table.implode(cfg.buildcommands,\"\",\"\",\"\")\nlocal clean   = table.implode(cfg.cleancommands,\"\",\"\",\"\")\nlocal rebuild = table.implode(cfg.rebuildcommands,\"\",\"\",\"\")\n_p(3, '<CustomBuild Enabled=\"yes\">')\n_x(4, '<BuildCommand>%s</BuildCommand>', build)\n_x(4, '<CleanCommand>%s</CleanCommand>', clean)\n_x(4, '<RebuildCommand>%s</RebuildCommand>', rebuild)\n_p(4, '<PreprocessFileCommand></PreprocessFileCommand>')\n_p(4, '<SingleFileCommand></SingleFileCommand>')\n_p(4, '<MakefileGenerationCommand></MakefileGenerationCommand>')\n_p(4, '<ThirdPartyToolName></ThirdPartyToolName>')\n_p(4, '<WorkingDirectory></WorkingDirectory>')\n_p(3, '</CustomBuild>')\nend\nfunction m.additionalRules(cfg)\nif configuration_iscustombuild(cfg) then\n_p(3, '<AdditionalRules/>')\nreturn\nend\n_p(3, '<AdditionalRules>')\n_p(4, '<CustomPostBuild/>')\n_p(4, '<CustomPreBuild/>')\n_p(3, '</AdditionalRules>')\nend\nfunction m.completion(cfg)\n_p(3, '<Completion EnableCpp11=\"%s\" EnableCpp14=\"%s\">', iif(cfg.flags[\"C++11\"], \"yes\", \"no\"), iif(cfg.flags[\"C++14\"], \"yes\", \"no\"))\n_p(4, '<ClangCmpFlagsC/>')\n_p(4, '<ClangCmpFlags/>')\n_p(4, '<ClangPP/>') -- TODO: we might want to set special code completion macros...?\n_p(4, '<SearchPaths/>') -- TODO: search paths for code completion?\n_p(3, '</Completion>')\nend\nm.elements.settings = function(cfg)\nreturn {\nm.compiler,\nm.linker,\nm.resourceCompiler,\nm.general,\nm.environment,\nm.debugger,\nm.preBuild,\nm.postBuild,\nm.customBuild,\nm.additionalRules,\nm.completion,\n}\nend\nm.types =\n{\nConsoleApp  = \"Executable\",\nMakefile    = \"\",\nSharedLib   = \"Dynamic Library\",\nStaticLib   = \"Static Library\",\nWindowedApp = \"Executable\"\n}\nm.debuggers =\n{\nDefault = \"GNU gdb debugger\",\nGDB = \"GNU gdb debugger\",\nLLDB = \"LLDB Debugger\",\n}\nfunction m.settings(prj)\n_p(1, '<Settings Type=\"%s\">', m.types[prj.kind] or \"\")\n_p(2, '<GlobalSettings>')\np.callArray(m.elements.globalSettings, prj)\n_p(2, '</GlobalSettings>')\nfor cfg in project.eachconfig(prj) do\nlocal cfgname  = codelite.cfgname(cfg)\nlocal compiler = m.getcompilername(cfg)\nlocal debugger = m.debuggers[cfg.debugger] or m.debuggers.Default\nlocal type = m.types[cfg.kind]\n_x(2, '<Configuration Name=\"%s\" CompilerType=\"%s\" DebuggerType=\"%s\" Type=\"%s\" BuildCmpWithGlobalSettings=\"append\" BuildLnkWithGlobalSettings=\"append\" BuildResWithGlobalSettings=\"append\">', cfgname, compiler, debugger, type)\np.callArray(m.elements.settings, cfg)\n_p(2, '</Configuration>')\nend\n_p(1, '</Settings>')\nend\nm.elements.project = function(prj)\nreturn {\nm.header,\nm.plugins,\nm.description,\nm.files,\nm.dependencies,\nm.settings,\n}\nend\nfunction m.generate(prj)\np.utf8()\np.callArray(m.elements.project, prj)\n_p('</CodeLite_Project>')\nend\n",

	"local p = premake\nlocal api = p.api\np.D = \"D\"\napi.addAllowed(\"language\", p.D)\napi.addAllowed(\"floatingpoint\", \"None\")\napi.addAllowed(\"flags\", {\n\"CodeCoverage\",\n\"Deprecated\",\n\"Documentation\",\n\"GenerateHeader\",\n\"GenerateJSON\",\n\"GenerateMap\",\n\"NoBoundsCheck\",\n\"Profile\",\n\"Quiet\",\n\"RetainPaths\",\n\"SeparateCompilation\",\n\"SymbolsLikeC\",\n\"UnitTest\",\n\"Verbose\",\n})\napi.register {\nname = \"versionconstants\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"versionlevel\",\nscope = \"config\",\nkind = \"integer\",\n}\napi.register {\nname = \"debugconstants\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"debuglevel\",\nscope = \"config\",\nkind = \"integer\",\n}\napi.register {\nname = \"docdir\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"docname\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"headerdir\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"headername\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\nnewoption\n{\ntrigger= \"dc\",\nvalue= \"VALUE\",\ndescription= \"Choose a D compiler\",\nallowed = {\n{ \"dmd\", \"Digital Mars (dmd)\" },\n{ \"gdc\", \"GNU GDC (gdc)\" },\n{ \"ldc\", \"LLVM LDC (ldc2)\" },\n}\n}\nreturn function (cfg)\nreturn (cfg.language == p.D)\nend\n",

	"local p = premake\np.modules.d = {}\nlocal m = p.modules.d\nm._VERSION = p._VERSION\nm.elements = {}\nlocal api = p.api\nfunction p.project.isd(prj)\nreturn prj.language == premake.D\nend\nfunction path.isdfile(fname)\nreturn path.hasextension(fname, { \".d\", \".di\" })\nend\ninclude( \"tools/dmd.lua\" )\ninclude( \"tools/gdc.lua\" )\ninclude( \"tools/ldc.lua\" )\ninclude( \"actions/gmake.lua\" )\ninclude( \"actions/vstudio.lua\" )\nif p.modules.monodevelop then\ninclude( \"actions/monodev.lua\" )\nend\nreturn m\n",

	"local p = premake\nlocal m = p.modules.d\nm.make = {}\nlocal dmake = m.make\nlocal make = p.make\nlocal cpp = p.make.cpp\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nlocal gmake = p.action.get( 'gmake' )\nif gmake == nil then\nerror( \"Failed to locate prequisite action 'gmake'\" )\nend\ngmake.valid_languages = table.join(gmake.valid_languages, { p.D } )\ngmake.valid_tools.dc = { \"dmd\", \"gdc\", \"ldc\" }\nfunction m.make.separateCompilation(prj)\nlocal some = false\nlocal all = true\nfor cfg in project.eachconfig(prj) do\nif cfg.flags.SeparateCompilation then\nsome = true\nelse\nall = false\nend\nend\nreturn iif(all, \"all\", iif(some, \"some\", \"none\"))\nend\np.override( gmake, \"onProject\", function(oldfn, prj)\np.escaper(make.esc)\nif project.isd(prj) then\nlocal makefile = make.getmakefilename(prj, true)\np.generate(prj, makefile, m.make.generate)\nreturn\nend\noldfn(prj)\nend)\np.override( make, \"objdir\", function(oldfn, cfg)\nif cfg.project.language ~= \"D\" or cfg.flags.SeparateCompilation then\noldfn(cfg)\nend\nend)\np.override( make, \"objDirRules\", function(oldfn, prj)\nif prj.language ~= \"D\" or m.make.separateCompilation(prj) ~= \"none\" then\noldfn(prj)\nend\nend)\nm.elements = {}\nm.elements.makefile = function(prj)\nreturn {\nmake.header,\nmake.phonyRules,\nm.make.configs,\nm.make.objects,-- TODO: This is basically identical to make.cppObjects(), and should ideally be merged/shared\nmake.shellType,\nm.make.targetRules,\nmake.targetDirRules,\nmake.objDirRules,\nmake.cppCleanRules,-- D clean code is identical to C/C++\nmake.preBuildRules,\nmake.preLinkRules,\nm.make.dFileRules,\n}\nend\nfunction m.make.generate(prj)\np.callArray(m.elements.makefile, prj)\nend\nfunction m.make.buildRule(prj)\n_p('$(TARGET): $(SOURCEFILES) $(LDDEPS)')\n_p('\\t@echo Building %s', prj.name)\n_p('\\t$(SILENT) $(BUILDCMD)')\n_p('\\t$(POSTBUILDCMDS)')\nend\nfunction m.make.linkRule(prj)\n_p('$(TARGET): $(OBJECTS) $(LDDEPS)')\n_p('\\t@echo Linking %s', prj.name)\n_p('\\t$(SILENT) $(LINKCMD)')\n_p('\\t$(POSTBUILDCMDS)')\nend\nfunction m.make.targetRules(prj)\nlocal separateCompilation = m.make.separateCompilation(prj)\nif separateCompilation == \"all\" then\nm.make.linkRule(prj)\nelseif separateCompilation == \"none\" then\nm.make.buildRule(prj)\nelse\nfor cfg in project.eachconfig(prj) do\n_x('ifeq ($(config),%s)', cfg.shortname)\nif cfg.flags.SeparateCompilation then\nm.make.linkRule(prj)\nelse\nm.make.buildRule(prj)\nend\n_p('endif')\nend\nend\n_p('')\nend\nfunction m.make.dFileRules(prj)\nlocal separateCompilation = m.make.separateCompilation(prj)\nif separateCompilation ~= \"none\" then\nmake.cppFileRules(prj)\nend\nend\np.override(cpp, \"standardFileRules\", function(oldfn, prj, node)\nif path.isdfile(node.abspath) then\n_x('$(OBJDIR)/%s.o: %s', node.objname, node.relpath)\n_p('\\t@echo $(notdir $<)')\n_p('\\t$(SILENT) $(DC) $(ALL_DFLAGS) $(OUTPUTFLAG) -c $<')\nelse\n oldfn(prj, node)\n end\nend)\nm.elements.makeconfig = function(cfg)\nreturn {\nm.make.dTools,\nmake.target,\nm.make.target,\nmake.objdir,\nm.make.versions,\nm.make.debug,\nm.make.imports,\nm.make.dFlags,\nmake.libs,\nmake.ldDeps,\nmake.ldFlags,\nm.make.linkCmd,\nmake.preBuildCmds,\nmake.preLinkCmds,\nmake.postBuildCmds,\nm.make.allRules,\nmake.settings,\n}\nend\nfunction m.make.configs(prj)\nfor cfg in project.eachconfig(prj) do\nlocal toolset = p.tools[_OPTIONS.dc or cfg.toolset or \"dmd\"]\nif not toolset then\nerror(\"Invalid toolset '\" + (_OPTIONS.dc or cfg.toolset) + \"'\")\nend\n_x('ifeq ($(config),%s)', cfg.shortname)\np.callArray(m.elements.makeconfig, cfg, toolset)\n_p('endif')\n_p('')\nend\nend\nfunction m.make.dTools(cfg, toolset)\nlocal tool = toolset.gettoolname(cfg, \"dc\")\nif tool then\n_p('  DC = %s', tool)\nend\nend\nfunction m.make.target(cfg, toolset)\nif cfg.flags.SeparateCompilation then\n_p('  OUTPUTFLAG = %s', toolset.gettarget('\"$@\"'))\nend\nend\nfunction m.make.versions(cfg, toolset)\n_p('  VERSIONS +=%s', make.list(toolset.getversions(cfg.versionconstants, cfg.versionlevel)))\nend\nfun"
	"ction m.make.debug(cfg, toolset)\n_p('  DEBUG +=%s', make.list(toolset.getdebug(cfg.debugconstants, cfg.debuglevel)))\nend\nfunction m.make.imports(cfg, toolset)\nlocal includes = p.esc(toolset.getimportdirs(cfg, cfg.includedirs))\n_p('  IMPORTS +=%s', make.list(includes))\nend\nfunction m.make.dFlags(cfg, toolset)\n_p('  ALL_DFLAGS += $(DFLAGS)%s $(VERSIONS) $(DEBUG) $(IMPORTS) $(ARCH)', make.list(table.join(toolset.getdflags(cfg), cfg.buildoptions)))\nend\nfunction m.make.linkCmd(cfg, toolset)\nif cfg.flags.SeparateCompilation then\n_p('  LINKCMD = $(DC) ' .. toolset.gettarget(\"$(TARGET)\") .. ' $(ALL_LDFLAGS) $(LIBS) $(OBJECTS)')\nelse\n_p('  BUILDCMD = $(DC) ' .. toolset.gettarget(\"$(TARGET)\") .. ' $(ALL_DFLAGS) $(ALL_LDFLAGS) $(LIBS) $(SOURCEFILES)')\nend\nend\nfunction m.make.allRules(cfg, toolset)\nif cfg.flags.SeparateCompilation then\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')\nelse\n_p('all: $(TARGETDIR) prebuild prelink $(TARGET)')\nend\n_p('\\t@:')\nend\nfunction m.make.objects(prj)\nlocal root = { sourcefiles={}, objects={} }\nlocal configs = {}\nfor cfg in project.eachconfig(prj) do\nconfigs[cfg] = { sourcefiles={}, objects={} }\nend\nlocal tr = project.getsourcetree(prj)\np.tree.traverse(tr, {\nonleaf = function(node, depth)\nlocal incfg = {}\nlocal inall = true\nlocal custom = false\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif filecfg and not filecfg.flags.ExcludeFromBuild then\nincfg[cfg] = filecfg\ncustom = fileconfig.hasCustomBuildRule(filecfg)\nelse\ninall = false\nend\nend\nif not custom then\nif not path.isdfile(node.abspath) then\nreturn\nend\nlocal sourcename = node.relpath\nlocal objectname = \"$(OBJDIR)/\" .. node.objname .. \".o\"\nif inall then\ntable.insert(root.sourcefiles, sourcename)\ntable.insert(root.objects, objectname)\nelse\nfor cfg in project.eachconfig(prj) do\nif incfg[cfg] then\ntable.insert(configs[cfg].sourcefiles, sourcename)\ntable.insert(configs[cfg].objects, objectname)\nend\nend\nend\nelse\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = incfg[cfg]\nif filecfg then\nlocal output = project.getrelative(prj, filecfg.buildoutputs[1])\nif path.isobjectfile(output) then\ntable.insert(configs[cfg].objects, output)\nend\nend\nend\nend\nend\n})\nlocal separateCompilation = m.make.separateCompilation(prj)\nfunction listobjects(var, list)\n_p('%s \\\\', var)\nfor _, objectname in ipairs(list) do\n_x('\\t%s \\\\', objectname)\nend\n_p('')\nend\nif separateCompilation ~= \"all\" then\nlistobjects('SOURCEFILES :=', root.sourcefiles)\nend\nif separateCompilation ~= \"none\" then\nlistobjects('OBJECTS :=', root.objects, 'o')\nend\nfor cfg in project.eachconfig(prj) do\nlocal files = configs[cfg]\nif (#files.sourcefiles > 0 and separateCompilation ~= \"all\") or (#files.objects > 0 and separateCompilation ~= \"none\") then\n_x('ifeq ($(config),%s)', cfg.shortname)\nif #files.sourcefiles > 0 and separateCompilation ~= \"all\" then\nlistobjects('  SOURCEFILES +=', files.sourcefiles)\nend\nif #files.objects > 0 and separateCompilation ~= \"none\" then\nlistobjects('  OBJECTS +=', files.objects)\nend\n_p('endif')\nend\nend\n_p('')\nend\n",

	"local p = premake\nlocal m = p.modules.d\nm.monod = {}\nlocal monodevelop = p.modules.monodevelop\nlocal vstudio = p.vstudio\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nlocal tree = p.tree\nlocal md = p.action.get(\"monodevelop\")\nif md ~= nil then\ntable.insert( md.valid_languages, p.D )\nmd.valid_tools.dc = { \"dmd\", \"gdc\", \"ldc\" }\np.override(md, \"onProject\", function(oldfn, prj)\noldfn(prj)\nif project.isd(prj) then\np.generate(prj, \".dproj\", monodevelop.generate)\nend\nend)\nend\np.override(vstudio, \"projectfile\", function(oldfn, prj)\nif _ACTION == \"monodevelop\" then\nif project.isd(prj) then\nreturn p.filename(prj, \".dproj\")\nend\nend\nreturn oldfn(prj)\nend)\np.override(vstudio, \"tool\", function(oldfn, prj)\nif _ACTION == \"monodevelop\" then\nif project.isd(prj) then\nreturn \"3947E667-4C90-4C3A-BEB9-7148D6FE0D7C\"\nend\nend\nreturn oldfn(prj)\nend)\np.override(monodevelop, \"getTargetGroup\", function(oldfn, node, prj, groups)\nif project.isd(prj) then\nlocal hasbuildrule = false\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif filecfg and fileconfig.hasCustomBuildRule(filecfg) then\nhasbuildrule = true\nbreak\nend\nend\nif hasbuildrule then\nreturn groups.CustomBuild\nelseif path.isdfile(node.name) then\nreturn groups.Compile\nelseif path.isresourcefile(node.name) then\nreturn groups.ResourceCompile\nelse\nreturn groups.None\nend\nelse\nreturn oldfn(node, prj, groups)\nend\nend)\np.override(monodevelop.elements, \"projectProperties\", function(oldfn, prj)\nif project.isd(prj) then\nreturn {\nmonodevelop.cproj.projectGuid,\nm.monod.useDefaultCompiler,\nm.monod.incrementalLinking,\nm.monod.preferOneStepBuild,\nm.monod.compiler,\nmonodevelop.cproj.version,\nmonodevelop.cproj.synchWksVersion,\nmonodevelop.cproj.description,\n}\nend\nreturn oldfn(prj)\nend)\nfunction m.monod.useDefaultCompiler(prj)\n_p(2,'<UseDefaultCompiler>%s</UseDefaultCompiler>', iif(_OPTIONS.dc, 'false', 'true'))\nend\nfunction m.monod.incrementalLinking(prj)\n_p(2,'<IncrementalLinking>true</IncrementalLinking>')\nend\nfunction m.monod.preferOneStepBuild(prj)\n_p(2,'<PreferOneStepBuild>true</PreferOneStepBuild>')\nend\nfunction m.monod.baseDirectory(prj)\n_p(2,'<BaseDirectory>.</BaseDirectory>')\nend\nfunction m.monod.compiler(prj)\nlocal compiler = { dmd=\"DMD2\", gdc=\"GDC\", ldc=\"ldc2\" }\n_p(2,'<Compiler>%s</Compiler>', compiler[_OPTIONS.dc or \"dmd\"])\nend\np.override(monodevelop.elements, \"configurationProperties\", function(oldfn, cfg)\nif project.isd(cfg.project) then\nreturn {\nmonodevelop.cproj.debuginfo,\nmonodevelop.cproj.outputPath,\nm.monod.unittestMode,\nm.monod.objectsDirectory, -- TODO: should this be moved into the .cproj options?\nm.monod.debugLevel,\nmonodevelop.cproj.externalconsole,\nm.monod.target,\nm.monod.thirdParty,\nmonodevelop.cproj.outputName,\nm.monod.additionalOptions,\nm.monod.dDocDirectory,\nm.monod.versionIds,\nm.monod.debugIds,\nmonodevelop.cproj.additionalLinkOptions,\nmonodevelop.cproj.additionalDependencies,\nmonodevelop.cproj.buildEvents,\n}\nend\nreturn oldfn(cfg)\nend)\nfunction m.monod.unittestMode(cfg)\n_p(2,'<UnittestMode>%s</UnittestMode>', iif(cfg.flags.UnitTest, 'true', 'false'))\nend\nfunction m.monod.objectsDirectory(cfg)\nlocal objdir = project.getrelative(cfg.project, cfg.objdir)\n_p(2,'<ObjectsDirectory>%s</ObjectsDirectory>', path.translate(objdir))\nend\nfunction m.monod.debugLevel(cfg)\n_p(2,'<DebugLevel>%d</DebugLevel>', iif(cfg.debuglevel, cfg.debuglevel, 0))\nend\nfunction m.monod.target(cfg)\nlocal map = {\nSharedLib = \"SharedLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Executable\",\nWindowedApp = \"Executable\"\n}\n_p(2,'<Target>%s</Target>', map[cfg.kind])\nend\nfunction m.monod.thirdParty(cfg)\nlocal linkThirdParty = \"false\"\n_p(2,'<LinkinThirdPartyLibraries>%s</LinkinThirdPartyLibraries>', linkThirdParty)\nend\nfunction m.monod.additionalOptions(cfg)\nlocal opts = { }\nlocal options\nif #opts > 0 then\noptions = table.concat(opts, \" \")\nend\nif #cfg.buildopti"
	"ons > 0 then\nlocal buildOpts = table.concat(cfg.buildoptions, \" \")\noptions = (options and options .. \" \" .. buildOpts) or buildOpts\nend\nif options then\n_x(2,'<ExtraCompilerArguments>%s</ExtraCompilerArguments>', options)\nend\nend\nfunction m.monod.dDocDirectory(cfg)\nif cfg.docdir then\nlocal docdir = project.getrelative(cfg.project, cfg.docdir)\n_x(2,'<DDocDirectory>%s</DDocDirectory>', path.translate(docdir))\nend\nend\nfunction m.monod.versionIds(cfg)\nif #cfg.versionconstants > 0 then\n_x(2,'<VersionIds>')\n_x(3,'<VersionIds>')\nfor _, v in ipairs(cfg.versionconstants) do\n_x(4,'<String>%s</String>', v)\nend\n_x(3,'</VersionIds>')\n_x(2,'</VersionIds>')\nend\nend\nfunction m.monod.debugIds(cfg)\nif #cfg.debugconstants > 0 then\n_x(2,'<DebugIds>')\n_x(3,'<DebugIds>')\nfor _, d in ipairs(cfg.debugconstants) do\n_x(4,'<String>%s</String>', d)\nend\n_x(3,'</DebugIds>')\n_x(2,'</DebugIds>')\nend\nend\n",

	"local p = premake\nlocal m = p.modules.d\nm.visuald = {}\nlocal vstudio = p.vstudio\nlocal workspace = p.workspace\nlocal project = p.project\nlocal config = p.config\nlocal tree = p.tree\nfor k,v in pairs({ \"vs2005\", \"vs2008\", \"vs2010\", \"vs2012\", \"vs2013\", \"vs2015\" }) do\nlocal vs = p.action.get(v)\nif vs ~= nil then\ntable.insert( vs.valid_languages, p.D )\nvs.valid_tools.dc = { \"dmd\", \"gdc\", \"ldc\" }\np.override(vs, \"onProject\", function(oldfn, prj)\noldfn(prj)\nif project.isd(prj) then\np.generate(prj, \".visualdproj\", m.visuald.generate)\nend\nend)\nend\nend\np.override(project, \"isnative\", function(oldfn, prj)\nreturn project.isd(prj) or oldfn(prj)\nend)\np.override(vstudio, \"projectfile\", function(oldfn, prj)\nif project.isd(prj) then\nreturn p.filename(prj, \".visualdproj\")\nend\nreturn oldfn(prj)\nend)\np.override(vstudio, \"tool\", function(oldfn, prj)\nif project.isd(prj) then\nreturn \"002A2DE9-8BB6-484D-9802-7E4AD4084715\"\nend\nreturn oldfn(prj)\nend)\nm.elements.project = function(prj)\nreturn {\nm.visuald.header,\nm.visuald.globals,\nm.visuald.projectConfigurations,\nm.visuald.files,\n}\nend\nfunction m.visuald.generate(prj)\np.eol(\"\\r\\n\")\np.indent(\" \")\np.callArray(m.elements.project, prj)\n_p('</DProject>')\nend\nfunction m.visuald.header(prj)\n_p('<DProject>')\nend\nfunction m.visuald.globals(prj)\n_p(1,'<ProjectGuid>{%s}</ProjectGuid>', prj.uuid)\nend\nfunction m.visuald.projectConfigurations(prj)\nfor cfg in project.eachconfig(prj) do\nlocal prjPlatform = p.esc(vstudio.projectPlatform(cfg))\nlocal slnPlatform = vstudio.solutionPlatform(cfg)\nlocal is64bit = slnPlatform == \"x64\" -- TODO: this seems like a hack\n_p(1,'<Config name=\"%s\" platform=\"%s\">', prjPlatform, slnPlatform)\n_p(2,'<obj>0</obj>')\n_p(2,'<link>0</link>')\nlocal isWindows = false\nlocal isDebug = string.find(cfg.buildcfg, 'Debug') ~= nil\nlocal isOptimised = config.isOptimizedBuild(cfg)\nif cfg.kind == p.CONSOLEAPP then\n_p(2,'<lib>0</lib>')\n_p(2,'<subsystem>1</subsystem>')\nelseif cfg.kind == p.STATICLIB then\n_p(2,'<lib>1</lib>')\n_p(2,'<subsystem>0</subsystem>')\nelseif cfg.kind == p.SHAREDLIB then\n_p(2,'<lib>2</lib>')\n_p(2,'<subsystem>0</subsystem>') -- SHOULD THIS BE '2' (windows)??\nelse\n_p(2,'<lib>0</lib>')\n_p(2,'<subsystem>2</subsystem>')\nisWindows = true\nend\n_p(2,'<multiobj>0</multiobj>')\n_p(2,'<singleFileCompilation>0</singleFileCompilation>')\n_p(2,'<oneobj>0</oneobj>')\n_p(2,'<trace>%s</trace>', iif(cfg.flags.Profile, '1', '0'))\n_p(2,'<quiet>%s</quiet>', iif(cfg.flags.Quiet, '1', '0'))\n_p(2,'<verbose>%s</verbose>', iif(cfg.flags.Verbose, '1', '0'))\n_p(2,'<vtls>0</vtls>')\n_p(2,'<symdebug>%s</symdebug>', iif(cfg.flags.Symbols or cfg.flags.SymbolsLikeC, iif(cfg.flags.SymbolsLikeC, '2', '1'), '0'))\n_p(2,'<optimize>%s</optimize>', iif(isOptimised, '1', '0'))\n_p(2,'<cpu>0</cpu>')\n_p(2,'<isX86_64>%s</isX86_64>', iif(is64bit, '1', '0'))\n_p(2,'<isLinux>0</isLinux>')\n_p(2,'<isOSX>0</isOSX>')\n_p(2,'<isWindows>%s</isWindows>', iif(isWindows, '1', '0'))\n_p(2,'<isFreeBSD>0</isFreeBSD>')\n_p(2,'<isSolaris>0</isSolaris>')\n_p(2,'<scheduler>0</scheduler>')\n_p(2,'<useDeprecated>%s</useDeprecated>', iif(cfg.flags.Deprecated, '1', '0'))\n_p(2,'<errDeprecated>0</errDeprecated>')\n_p(2,'<useAssert>0</useAssert>')\n_p(2,'<useInvariants>0</useInvariants>')\n_p(2,'<useIn>0</useIn>')\n_p(2,'<useOut>0</useOut>')\n_p(2,'<useArrayBounds>0</useArrayBounds>')\n_p(2,'<noboundscheck>%s</noboundscheck>', iif(cfg.flags.NoBoundsCheck, '1', '0'))\n_p(2,'<useSwitchError>0</useSwitchError>')\n_p(2,'<useUnitTests>%s</useUnitTests>', iif(cfg.flags.UnitTest, '1', '0'))\n_p(2,'<useInline>%s</useInline>', iif(cfg.flags.Inline or isOptimised, '1', '0'))\n_p(2,'<release>%s</release>', iif(cfg.flags.Release or not isDebug, '1', '0'))\n_p(2,'<preservePaths>0</preservePaths>')\n_p(2,'<warnings>%s</warnings>', iif(cfg.flags.FatalCompileWarnings, '1', '0'))\n_p(2,'<infowarnings>%s</infowarnings>', iif(cfg.warnings and cfg.warnings ~= \"Off\", '1', '0'))\n_p(2,'<checkProperty>0</checkProperty>')\n_p(2,'<genStackFrame"
	">0</genStackFrame>')\n_p(2,'<pic>%s</pic>', iif(cfg.pic == \"On\", '1', '0'))\n_p(2,'<cov>%s</cov>', iif(cfg.flags.CodeCoverage, '1', '0'))\n_p(2,'<nofloat>%s</nofloat>', iif(cfg.floatingpoint and cfg.floatingpoint == \"None\", '1', '0'))\n_p(2,'<Dversion>2</Dversion>')\n_p(2,'<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>')\nlocal compiler = { dmd=\"0\", gdc=\"1\", ldc=\"2\" }\nm.visuald.element(2, \"compiler\", compiler[_OPTIONS.dc or cfg.toolset or \"dmd\"])\nm.visuald.element(2, \"otherDMD\", '0')\nm.visuald.element(2, \"program\", '$(DMDInstallDir)windows\\\\bin\\\\dmd.exe')\nm.visuald.element(2, \"imppath\", cfg.includedirs)\nm.visuald.element(2, \"fileImppath\")\nm.visuald.element(2, \"outdir\", path.translate(project.getrelative(cfg.project, cfg.buildtarget.directory)))\nm.visuald.element(2, \"objdir\", path.translate(project.getrelative(cfg.project, cfg.objdir)))\nm.visuald.element(2, \"objname\")\nm.visuald.element(2, \"libname\")\nm.visuald.element(2, \"doDocComments\", iif(cfg.flags.Documentation, '1', '0'))\nm.visuald.element(2, \"docdir\", cfg.docdir)\nm.visuald.element(2, \"docname\", cfg.docname)\nm.visuald.element(2, \"modules_ddoc\")\nm.visuald.element(2, \"ddocfiles\")\nm.visuald.element(2, \"doHdrGeneration\", iif(cfg.flags.GenerateHeader, '1', '0'))\nm.visuald.element(2, \"hdrdir\", cfg.headerdir)\nm.visuald.element(2, \"hdrname\", cfg.headername)\nm.visuald.element(2, \"doXGeneration\", iif(cfg.flags.GenerateJSON, '1', '0'))\nm.visuald.element(2, \"xfilename\", '$(IntDir)\\\\$(TargetName).json')\nm.visuald.element(2, \"debuglevel\", iif(cfg.debuglevel, tostring(cfg.debuglevel), '0'))\nm.visuald.element(2, \"debugids\", cfg.debugconstants)\nm.visuald.element(2, \"versionlevel\", iif(cfg.versionlevel, tostring(cfg.versionlevel), '0'))\nm.visuald.element(2, \"versionids\", cfg.versionconstants)\n_p(2,'<dump_source>0</dump_source>')\n_p(2,'<mapverbosity>0</mapverbosity>')\n_p(2,'<createImplib>%s</createImplib>', iif(cfg.kind ~= p.SHAREDLIB or cfg.flags.NoImportLib, '0', '1'))\n_p(2,'<defaultlibname />')\n_p(2,'<debuglibname />')\n_p(2,'<moduleDepsFile />')\n_p(2,'<run>0</run>')\n_p(2,'<runargs />')\n_p(2,'<runCv2pdb>1</runCv2pdb>') -- we will just leave this always enabled, since it's ignored if no debuginfo is written\n_p(2,'<pathCv2pdb>$(VisualDInstallDir)cv2pdb\\\\cv2pdb.exe</pathCv2pdb>')\n_p(2,'<cv2pdbPre2043>0</cv2pdbPre2043>')\n_p(2,'<cv2pdbNoDemangle>0</cv2pdbNoDemangle>')\n_p(2,'<cv2pdbEnumType>0</cv2pdbEnumType>')\n_p(2,'<cv2pdbOptions />')\n_p(2,'<objfiles />')\n_p(2,'<linkswitches />')\nlocal links\nlocal explicit = vstudio.needsExplicitLink(cfg)\nlocal toolset = config.toolset(cfg)\nif toolset then\nlinks = toolset.getlinks(cfg, not explicit)\nelse\nlocal scope = iif(explicit, \"all\", \"system\")\nlinks = config.getlinks(cfg, scope, \"fullpath\")\nend\nm.visuald.element(2, \"libfiles\", table.concat(links, \" \"))\nm.visuald.element(2, \"libpaths\", cfg.libdirs)\n_p(2,'<deffile />')\n_p(2,'<resfile />')\nlocal target = config.gettargetinfo(cfg)\n_p(2,'<exefile>$(OutDir)\\\\%s</exefile>', target.name)\n_p(2,'<useStdLibPath>1</useStdLibPath>')\nlocal runtime = 0\nif not cfg.flags.OmitDefaultLibrary then\nif config.isDebugBuild(cfg) then\nruntime = iif(cfg.flags.StaticRuntime, \"2\", \"4\")\nelse\nruntime = iif(cfg.flags.StaticRuntime, \"1\", \"3\")\nend\nend\nm.visuald.element(2, \"cRuntime\", runtime)\nlocal additionalOptions\nif #cfg.buildoptions > 0 then\nadditionalOptions = table.concat(cfg.buildoptions, \" \")\nend\nif #cfg.linkoptions > 0 then\nlocal linkOpts = table.implode(cfg.linkoptions, \"-L\", \"\", \" \")\nif additionalOptions then\nadditionalOptions = additionalOptions .. \" \" .. linkOpts\nelse\nadditionalOptions = linkOpts\nend\nend\nm.visuald.element(2, \"additionalOptions\", additionalOptions)\nif #cfg.prebuildcommands > 0 then\n_p(2,'<preBuildCommand>%s</preBuildCommand>',p.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\nelse\n_p(2,'<preBuildCommand />')\nend\nif #cfg.postbuildcommands > 0 then\n_p(2,'<postBuildCommand>%s</postBuildCommand>',p.esc"
	"(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\nelse\n_p(2,'<postBuildCommand />')\nend\n_p(2,'<filesToClean>*.obj;*.cmd;*.build;*.json;*.dep;*.o</filesToClean>')\n_p(1,'</Config>')\nend\nend\nfunction m.visuald.files(prj)\n_p(1,'<Folder name=\"%s\">', prj.name)\nlocal tr = project.getsourcetree(prj)\ntree.traverse(tr, {\nonbranchenter = function(node, depth)\n_p(depth, '<Folder name=\"%s\">', node.name)\nend,\nonbranchexit = function(node, depth)\n_p(depth, '</Folder>')\nend,\nonleaf = function(node, depth)\n_p(depth, '<File path=\"%s\" />', path.translate(node.relpath))\nend\n}, false, 2)\n_p(1,'</Folder>')\nend\nfunction m.visuald.fileConfiguration(prj, node, depth)\nend\nfunction m.visuald.element(depth, name, value, ...)\nlocal isTable = type(value) == \"table\"\nif not value or (isTable and #value == 0) then\n_p(depth, '<%s />', name)\nelse\nif isTable then\nvalue = p.esc(table.implode(value, \"\", \"\", \";\"))\n_p(depth, '<%s>%s</%s>', name, value, name)\nelse\nif select('#',...) == 0 then\nvalue = p.esc(value)\nend\n_x(depth, string.format('<%s>%s</%s>', name, value, name), ...)\nend\nend\nend\n",

	"local tdmd = {}\nlocal project = premake.project\nlocal config = premake.config\n    local d = premake.modules.d\ntdmd.gcc = {}\ntdmd.gcc.dc = \"dmd\"\ntdmd.optlink = {}\ntdmd.optlink.dc = \"dmd\"\ntdmd.gcc.ldflags = {\narchitecture = {\nx86 = { \"-m32\" },\nx86_64 = { \"-m64\" },\n},\nkind = {\nSharedLib = \"-shared\",\nStaticLib = \"-lib\",\n}\n}\nfunction tdmd.gcc.getldflags(cfg)\nlocal flags = config.mapFlags(cfg, tdmd.gcc.ldflags)\nreturn flags\nend\ntdmd.gcc.libraryDirectories = {\narchitecture = {\nx86 = \"-L-L/usr/lib\",\nx86_64 = \"-L-L/usr/lib64\",\n}\n}\nfunction tdmd.gcc.getLibraryDirectories(cfg)\nlocal flags = config.mapFlags(cfg, tdmd.gcc.libraryDirectories)\nfor _, dir in ipairs(config.getlinks(cfg, \"system\", \"directory\")) do\ntable.insert(flags, '-L-L' .. project.getrelative(cfg.project, dir))\nend\nreturn flags\nend\nfunction tdmd.gcc.getlinks(cfg, systemonly)\nlocal result = {}\nlocal links\nif not systemonly then\nlinks = config.getlinks(cfg, \"siblings\", \"object\")\nfor _, link in ipairs(links) do\nif not link.project.external then\nif link.kind == premake.STATICLIB then\ntable.insert(result, \"-L\" .. project.getrelative(cfg.project, link.linktarget.abspath))\nelse\ntable.insert(result, \"-L-l\" .. link.linktarget.basename)\nend\nend\nend\nend\nlinks = config.getlinks(cfg, \"system\", \"fullpath\")\nfor _, link in ipairs(links) do\nif path.isframework(link) then\ntable.insert(result, \"-framework \" .. path.getbasename(link))\nelseif path.isobjectfile(link) then\ntable.insert(result, \"-L\" .. link)\nelse\ntable.insert(result, \"-L-l\" .. path.getbasename(link))\nend\nend\nreturn result\nend\ntdmd.optlink.ldflags = {\narchitecture = {\nx86 = { \"-m32\" },\nx86_64 = { \"-m64\" },\n},\nkind = {\nSharedLib = \"-shared\",\nStaticLib = \"-lib\",\n}\n}\nfunction tdmd.optlink.getldflags(cfg)\nlocal flags = config.mapFlags(cfg, tdmd.optlink.ldflags)\nreturn flags\nend\nfunction tdmd.optlink.getLibraryDirectories(cfg)\nlocal flags = {}\nfor _, dir in ipairs(config.getlinks(cfg, \"system\", \"directory\")) do\ntable.insert(flags, '-Llib \"' .. project.getrelative(cfg.project, dir) .. '\"')\nend\nreturn flags\nend\nfunction tdmd.optlink.getlinks(cfg)\nlocal result = {}\nlocal links = config.getlinks(cfg, \"dependencies\", \"object\")\nfor _, link in ipairs(links) do\nif not link.project.externalname then\nlocal linkinfo = config.getlinkinfo(link)\nif link.kind == premake.STATICLIB then\ntable.insert(result, project.getrelative(cfg.project, linkinfo.abspath))\nend\nend\nend\nlinks = config.getlinks(cfg, \"system\", \"basename\")\nfor _, link in ipairs(links) do\nif path.isobjectfile(link) then\ntable.insert(result, link)\nelseif path.hasextension(link, premake.systems[cfg.system].staticlib.extension) then\ntable.insert(result, link)\nend\nend\nreturn result\nend\nif string.match( os.getversion().description, \"Windows\" ) ~= nil then\npremake.tools.dmd = tdmd.optlink\nelse\npremake.tools.dmd = tdmd.gcc\nend\nlocal dmd = premake.tools.dmd\ndmd.dflags = {\narchitecture = {\nx86 = \"-m32\",\nx86_64 = \"-m64\",\n},\nflags = {\nCodeCoverage= \"-cov\",\nDeprecated= \"-d\",\nDocumentation= \"-D\",\nFatalWarnings= \"-w\",\nGenerateHeader= \"-H\",\nGenerateJSON= \"-X\",\nGenerateMap= \"-map\",\nNoBoundsCheck= \"-noboundscheck\",\nProfile= \"-profile\",\nQuiet= \"-quiet\",\nRetainPaths= \"-op\",\nSymbols= \"-g\",\nSymbolsLikeC= \"-gc\",\nUnitTest= \"-unittest\",\nVerbose= \"-v\",\n},\nfloatingpoint = {\nNone = \"-nofloat\",\n},\noptimize = {\nOn = \"-O -inline\",\nFull = \"-O -inline\",\nSize = \"-O -inline\",\nSpeed = \"-O -inline\",\n},\npic = {\nOn = \"-fPIC\",\n},\nwarnings = {\nDefault = \"-wi\",\nExtra = \"-wi\",\n}\n}\nfunction dmd.getdflags(cfg)\nlocal flags = config.mapFlags(cfg, dmd.dflags)\nif config.isDebugBuild(cfg) then\ntable.insert(flags, \"-debug\")\nelse\ntable.insert(flags, \"-release\")\nend\nif cfg.flags.Documentation then\nif cfg.docname then\ntable.insert(flags, \"-Df\" .. premake.quoted(cfg.docname))\nend\nif cfg.docdir then\ntable.insert(flags, \"-Dd\" .. premake.quoted(cfg.docdir))\nend\nen"
	"d\nif cfg.flags.GenerateHeader then\nif cfg.headername then\ntable.insert(flags, \"-Hf\" .. premake.quoted(cfg.headername))\nend\nif cfg.headerdir then\ntable.insert(flags, \"-Hd\" .. premake.quoted(cfg.headerdir))\nend\nend\nreturn flags\nend\nfunction dmd.getversions(versions, level)\nlocal result = {}\nfor _, version in ipairs(versions) do\ntable.insert(result, '-version=' .. version)\nend\nif level then\ntable.insert(result, '-version=' .. level)\nend\nreturn result\nend\nfunction dmd.getdebug(constants, level)\nlocal result = {}\nfor _, constant in ipairs(constants) do\ntable.insert(result, '-debug=' .. constant)\nend\nif level then\ntable.insert(result, '-debug=' .. level)\nend\nreturn result\nend\nfunction dmd.getimportdirs(cfg, dirs)\nlocal result = {}\nfor _, dir in ipairs(dirs) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(result, '-I' .. premake.quoted(dir))\nend\nreturn result\nend\nfunction dmd.gettarget(name)\nreturn \"-of\" .. name\nend\ndmd.makesettings = {\n}\nfunction dmd.getmakesettings(cfg)\nlocal settings = config.mapFlags(cfg, dmd.makesettings)\nreturn table.concat(settings)\nend\ndmd.tools = {\n}\nfunction dmd.gettoolname(cfg, tool)\nlocal names = dmd.tools[cfg.architecture] or dmd.tools[cfg.system] or {}\nlocal name = names[tool]\nreturn name or dmd[tool]\nend\n",

	"premake.tools.gdc = { }\nlocal gdc = premake.tools.gdc\nlocal project = premake.project\nlocal config = premake.config\n    local d = premake.modules.d\ngdc.dc = \"gdc\"\ngdc.dflags = {\narchitecture = {\nx86 = \"-m32\",\nx86_64 = \"-m64\",\n},\nflags = {\nDeprecated= \"-fdeprecated\",\nDocumentation= \"-fdoc\",\nFatalWarnings= \"-Werror\",\nGenerateHeader= \"-fintfc\",\nGenerateJSON= \"-fX\",\nNoBoundsCheck= \"-fno-bounds-check\",\nRetainPaths= \"-op\",\nSymbols= \"-g\",\nSymbolsLikeC= \"-fdebug-c\",\nUnitTest= \"-funittest\",\nVerbose= \"-fd-verbose\",\n},\nfloatingpoint = {\nFast = \"-ffast-math\",\nStrict = \"-ffloat-store\",\n},\noptimize = {\nOff = \"-O0\",\nOn = \"-O2 -finline-functions\",\nDebug = \"-Og\",\nFull = \"-O3 -finline-functions\",\nSize = \"-Os -finline-functions\",\nSpeed = \"-O3 -finline-functions\",\n},\npic = {\nOn = \"-fPIC\",\n},\nvectorextensions = {\nAVX = \"-mavx\",\nSSE = \"-msse\",\nSSE2 = \"-msse2\",\n},\nwarnings = {\nExtra = \"-Wall -Wextra\",\n}\n}\nfunction gdc.getdflags(cfg)\nlocal flags = config.mapFlags(cfg, gdc.dflags)\nif config.isDebugBuild(cfg) then\ntable.insert(flags, \"-fdebug\")\nelse\ntable.insert(flags, \"-frelease\")\nend\nif cfg.flags.Documentation then\nif cfg.docname then\ntable.insert(flags, \"-fdoc-file=\" .. premake.quoted(cfg.docname))\nend\nif cfg.docdir then\ntable.insert(flags, \"-fdoc-dir=\" .. premake.quoted(cfg.docdir))\nend\nend\nif cfg.flags.GenerateHeader then\nif cfg.headername then\ntable.insert(flags, \"-fintfc-file=\" .. premake.quoted(cfg.headername))\nend\nif cfg.headerdir then\ntable.insert(flags, \"-fintfc-dir=\" .. premake.quoted(cfg.headerdir))\nend\nend\nreturn flags\nend\nfunction gdc.getversions(versions, level)\nlocal result = {}\nfor _, version in ipairs(versions) do\ntable.insert(result, '-fversion=' .. version)\nend\nif level then\ntable.insert(result, '-fversion=' .. level)\nend\nreturn result\nend\nfunction gdc.getdebug(constants, level)\nlocal result = {}\nfor _, constant in ipairs(constants) do\ntable.insert(result, '-fdebug=' .. constant)\nend\nif level then\ntable.insert(result, '-fdebug=' .. level)\nend\nreturn result\nend\nfunction gdc.getimportdirs(cfg, dirs)\nlocal result = {}\nfor _, dir in ipairs(dirs) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(result, '-I' .. premake.quoted(dir))\nend\nreturn result\nend\nfunction gdc.gettarget(name)\nreturn \"-o \" .. name\nend\ngdc.ldflags = {\narchitecture = {\nx86 = { \"-m32\" },\nx86_64 = { \"-m64\" },\n},\nkind = {\nSharedLib = function(cfg)\nlocal r = { iif(cfg.system == premake.MACOSX, \"-dynamiclib\", \"-shared\") }\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(r, '-Wl,--out-implib=\"' .. cfg.linktarget.relpath .. '\"')\nend\nreturn r\nend,\nWindowedApp = function(cfg)\nif cfg.system == premake.WINDOWS then return \"-mwindows\" end\nend,\n},\n}\nfunction gdc.getldflags(cfg)\nlocal flags = config.mapFlags(cfg, gdc.ldflags)\nreturn flags\nend\ngdc.libraryDirectories = {\narchitecture = {\nx86 = \"-L/usr/lib\",\nx86_64 = \"-L/usr/lib64\",\n}\n}\nfunction gdc.getLibraryDirectories(cfg)\nlocal flags = config.mapFlags(cfg, gdc.libraryDirectories)\nfor _, dir in ipairs(config.getlinks(cfg, \"system\", \"directory\")) do\ntable.insert(flags, '-Wl,-L' .. project.getrelative(cfg.project, dir))\nend\nreturn flags\nend\nfunction gdc.getlinks(cfg, systemonly)\nlocal result = {}\nlocal links\nif not systemonly then\nlinks = config.getlinks(cfg, \"siblings\", \"object\")\nfor _, link in ipairs(links) do\nif not link.project.external then\nif link.kind == premake.STATICLIB then\ntable.insert(result, \"-Wl,\" .. project.getrelative(cfg.project, link.linktarget.abspath))\nelse\ntable.insert(result, \"-Wl,-l\" .. link.linktarget.basename)\nend\nend\nend\nend\nlinks = config.getlinks(cfg, \"system\", \"fullpath\")\nfor _, link in ipairs(links) do\nif path.isframework(link) then\ntable.insert(result, \"-framework \" .. path.getbasename(link))\nelseif path.isobjectfile(link) then\ntable.insert(result, \"-Wl,\" .. link)\nelse\ntable.insert(result, \"-Wl,-l\""
	" .. path.getbasename(link))\nend\nend\nreturn result\nend\ngdc.makesettings = {\n}\nfunction gdc.getmakesettings(cfg)\nlocal settings = config.mapFlags(cfg, gdc.makesettings)\nreturn table.concat(settings)\nend\ngdc.tools = {\nps3 = {\ndc = \"ppu-lv2-gdc\",\nar = \"ppu-lv2-ar\",\n},\n}\nfunction gdc.gettoolname(cfg, tool)\nlocal names = gdc.tools[cfg.architecture] or gdc.tools[cfg.system] or {}\nlocal name = names[tool]\nreturn name or gdc[tool]\nend\n",

	"premake.tools.ldc = { }\nlocal ldc = premake.tools.ldc\nlocal project = premake.project\nlocal config = premake.config\n    local d = premake.modules.d\nldc.namestyle = \"posix\"\nldc.dflags = {\narchitecture = {\nx86 = \"-m32\",\nx86_64 = \"-m64\",\n},\nflags = {\nDeprecated= \"-d\",\nDocumentation= \"-D\",\nFatalWarnings= \"-w\", -- Use LLVM flag? : \"-fatal-assembler-warnings\",\nGenerateHeader= \"-H\",\nGenerateJSON= \"-X\",\nNoBoundsCheck= \"-disable-boundscheck\",\nRetainPaths= \"-op\",\nSymbols= \"-g\",\nSymbolsLikeC= \"-gc\",\nUnitTest= \"-unittest\",\nVerbose= \"-v\",\n},\nfloatingpoint = {\nFast = \"-fp-contract=fast -enable-unsafe-fp-math\",\n},\noptimize = {\nOff = \"-O0\",\nOn = \"-O2\",\nDebug = \"-O0\",\nFull = \"-O3\",\nSize = \"-Oz\",\nSpeed = \"-O3\",\n},\npic = {\nOn = \"-relocation-model=pic\",\n},\nvectorextensions = {\nAVX = \"-mattr=+avx\",\nSSE = \"-mattr=+sse\",\nSSE2 = \"-mattr=+sse2\",\n},\nwarnings = {\nDefault = \"-wi\",\nExtra = \"-wi\",-- TODO: is there a way to get extra warnings?\n}\n}\nfunction ldc.getdflags(cfg)\nlocal flags = config.mapFlags(cfg, ldc.dflags)\nif config.isDebugBuild(cfg) then\ntable.insert(flags, \"-d-debug\")\nelse\ntable.insert(flags, \"-release\")\nend\nif cfg.flags.Documentation then\nif cfg.docname then\ntable.insert(flags, \"-Df=\" .. premake.quoted(cfg.docname))\nend\nif cfg.docdir then\ntable.insert(flags, \"-Dd=\" .. premake.quoted(cfg.docdir))\nend\nend\nif cfg.flags.GenerateHeader then\nif cfg.headername then\ntable.insert(flags, \"-Hf=\" .. premake.quoted(cfg.headername))\nend\nif cfg.headerdir then\ntable.insert(flags, \"-Hd=\" .. premake.quoted(cfg.headerdir))\nend\nend\nreturn flags\nend\nfunction ldc.getversions(versions, level)\nlocal result = {}\nfor _, version in ipairs(versions) do\ntable.insert(result, '-d-version=' .. version)\nend\nif level then\ntable.insert(result, '-d-version=' .. level)\nend\nreturn result\nend\nfunction ldc.getdebug(constants, level)\nlocal result = {}\nfor _, constant in ipairs(constants) do\ntable.insert(result, '-d-debug=' .. constant)\nend\nif level then\ntable.insert(result, '-d-debug=' .. level)\nend\nreturn result\nend\nfunction ldc.getimportdirs(cfg, dirs)\nlocal result = {}\nfor _, dir in ipairs(dirs) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(result, '-I=' .. premake.quoted(dir))\nend\nreturn result\nend\nfunction ldc.gettarget(name)\nreturn \"-of=\" .. name\nend\nldc.ldflags = {\narchitecture = {\nx86 = { \"-m32\" },\nx86_64 = { \"-m64\" },\n},\nkind = {\nSharedLib = \"-shared\",\nStaticLib = \"-lib\",\n},\n}\nfunction ldc.getldflags(cfg)\nlocal flags = config.mapFlags(cfg, ldc.ldflags)\nreturn flags\nend\nldc.libraryDirectories = {\narchitecture = {\nx86 = \"-L=-L/usr/lib\",\nx86_64 = \"-L=-L/usr/lib64\",\n}\n}\nfunction ldc.getLibraryDirectories(cfg)\nlocal flags = config.mapFlags(cfg, ldc.libraryDirectories)\nfor _, dir in ipairs(config.getlinks(cfg, \"system\", \"directory\")) do\ntable.insert(flags, '-L=-L' .. project.getrelative(cfg.project, dir))\nend\nreturn flags\nend\nfunction ldc.getlinks(cfg, systemonly)\nlocal result = {}\nlocal links\nif not systemonly then\nlinks = config.getlinks(cfg, \"siblings\", \"object\")\nfor _, link in ipairs(links) do\nif not link.project.external then\nif link.kind == premake.STATICLIB then\ntable.insert(result, \"-L=\" .. project.getrelative(cfg.project, link.linktarget.abspath))\nelse\ntable.insert(result, \"-L=-l\" .. link.linktarget.basename)\nend\nend\nend\nend\nlinks = config.getlinks(cfg, \"system\", \"fullpath\")\nfor _, link in ipairs(links) do\nif path.isframework(link) then\ntable.insert(result, \"-framework \" .. path.getbasename(link))\nelseif path.isobjectfile(link) then\ntable.insert(result, \"-L=\" .. link)\nelse\ntable.insert(result, \"-L=-l\" .. path.getbasename(link))\nend\nend\nreturn result\nend\nldc.makesettings = {\n}\nfunction ldc.getmakesettings(cfg)\nlocal settings = config.mapFlags(cfg, ldc.makesettings)\nreturn table.concat(settings)\nend\nldc.tools = {\ndc = \"ldc2\",\nar = \"ar\",\n}\nfunction ldc.gettoolname(cfg, tool)\nretur"
	"n ldc.tools[tool]\nend\n",

	"local p = premake\nnewaction\n{\ntrigger         = \"monodevelop\", -- TODO: I'd kinda like an alias 'xamarinstudio' aswell...\nshortname       = \"MonoDevelop\",\ndescription     = \"Generate MonoDevelop/Xamarin Studio project files\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"gcc\" },\ndotnet = { \"mono\", \"msnet\" },\n},\nonWorkspace = function(wks)\np.vstudio.vs2005.generateWorkspace(wks)\nend,\nonProject = function(prj)\np.modules.monodevelop.generateProject(prj)\nend,\nonCleanWorkspace = function(wks)\np.vstudio.cleanWorkspace(wks)\nend,\nonCleanProject = function(prj)\np.vstudio.cleanProject(prj)\nend,\nonCleanTarget = function(prj)\np.vstudio.cleanTarget(prj)\nend,\nvstudio = {\ncsprojSchemaVersion = \"2.0\",\nproductVersion      = \"10.0.0\",\nsolutionVersion     = \"12\",\nversionName         = \"2012\",\ntargetFramework     = \"4.5\",\ntoolsVersion        = \"4.0\",\n},\n}\nreturn function(cfg)\nreturn (_ACTION == \"monodevelop\")\nend\n",

	"local p = premake\np.modules.monodevelop = {}\nlocal m = p.modules.monodevelop\nm._VERSION = p._VERSION\nm.elements = {}\nlocal vs2010 = p.vstudio.vs2010\nlocal vstudio = p.vstudio\nlocal sln2005 = p.vstudio.sln2005\nlocal project = p.project\nlocal config = p.config\nfunction m.MonoDevelopProperties(wks)\n_p('\\tGlobalSection(MonoDevelopProperties) = preSolution')\nif wks.startproject then\nfor prj in p.workspace.eachproject(wks) do\nif prj.name == wks.startproject then\nend\nend\nend\n_p('\\tEndGlobalSection')\nend\np.override(vstudio, \"projectPlatform\", function(oldfn, cfg)\nif _ACTION == \"monodevelop\" then\nif cfg.platform then\nreturn cfg.buildcfg .. \" \" .. cfg.platform\nelse\nreturn cfg.buildcfg\nend\nend\nreturn oldfn(cfg)\nend)\np.override(vstudio, \"archFromConfig\", function(oldfn, cfg, win32)\nif _ACTION == \"monodevelop\" then\nreturn \"Any CPU\"\nend\nreturn oldfn(cfg, win32)\nend)\np.override(sln2005, \"solutionSections\", function(oldfn, wks)\nif _ACTION == \"monodevelop\" then\nreturn {\n\"ConfigurationPlatforms\",\n\"MonoDevelopProperties\",\n\"NestedProjects\",\n}\nend\nreturn oldfn(prj)\nend)\nsln2005.sectionmap.MonoDevelopProperties = m.MonoDevelopProperties\np.override(vstudio, \"projectfile\", function(oldfn, prj)\nif _ACTION == \"monodevelop\" then\nif project.iscpp(prj) then\nreturn p.filename(prj, \".cproj\")\nend\nend\nreturn oldfn(prj)\nend)\np.override(vstudio, \"tool\", function(oldfn, prj)\nif _ACTION == \"monodevelop\" then\nif project.iscpp(prj) then\nreturn \"2857B73E-F847-4B02-9238-064979017E93\"\nend\nend\nreturn oldfn(prj)\nend)\nfunction m.generateProject(prj)\np.eol(\"\\r\\n\")\np.indent(\"  \")\np.escaper(vs2010.esc)\nif project.isdotnet(prj) then\np.generate(prj, \".csproj\", vstudio.cs2005.generate)\np.generate(prj, \".csproj.user\", vstudio.cs2005.generate_user)\nelseif project.iscpp(prj) then\np.generate(prj, \".cproj\", m.generate)\nend\nend\ninclude(\"monodevelop_cproj.lua\")\nreturn m\n",

	"local p = premake\nlocal m = p.modules.monodevelop\nm.cproj = {}\nlocal vstudio = p.vstudio\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nlocal tree = p.tree\nfunction m.generate(prj)\nm.header(\"Build\")\nm.projectProperties(prj)\nfor cfg in project.eachconfig(prj) do\nm.configurationProperties(cfg)\nend\nm.files(prj)\n_p('</Project>')\nend\nfunction m.header(target)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\nlocal defaultTargets = \"\"\nif target then\ndefaultTargets = string.format(' DefaultTargets=\"%s\"', target)\nend\n_p('<Project%s ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">', defaultTargets)\nend\nm.elements.projectProperties = function(prj)\nif project.iscpp(prj) then\nreturn {\nm.cproj.productVersion,\nm.cproj.schemaVersion,\nm.cproj.projectGuid,\nm.cproj.compiler,\nm.cproj.language,\nm.cproj.target,\nm.cproj.version,\nm.cproj.synchSlnVersion,\nm.cproj.description,\n}\nend\nend\nfunction m.projectProperties(prj)\n_p(1,'<PropertyGroup>')\n_p(2,'<Configuration Condition=\" \\'$(Configuration)\\' == \\'\\' \">%s</Configuration>', 'Debug')\n_p(2,'<Platform Condition=\" \\'$(Platform)\\' == \\'\\' \">%s</Platform>', 'AnyCPU')\np.callArray(m.elements.projectProperties, prj)\n_p(1,'</PropertyGroup>')\nend\nm.elements.configurationProperties = function(cfg)\nif project.iscpp(cfg.project) then\nreturn {\nm.cproj.debuginfo,\nm.cproj.outputPath,\nm.cproj.outputName,\nm.cproj.config_type,\nm.cproj.preprocessorDefinitions,\nm.cproj.sourceDirectory,\nm.cproj.warnings,\nm.cproj.optimization,\nm.cproj.externalconsole,\nm.cproj.additionalOptions,\nm.cproj.additionalLinkOptions,\nm.cproj.additionalIncludeDirectories,\nm.cproj.additionalLibraryDirectories,\nm.cproj.additionalDependencies,\nm.cproj.buildEvents,\n}\nend\nend\nfunction m.configurationProperties(cfg)\n_p(1,'<PropertyGroup %s>', m.condition(cfg))\np.callArray(m.elements.configurationProperties, cfg)\n_p(1,'</PropertyGroup>')\nend\nfunction m.condition(cfg)\nreturn string.format('Condition=\" \\'$(Configuration)|$(Platform)\\' == \\'%s|AnyCPU\\' \"', p.esc(vstudio.projectPlatform(cfg)))\nend\nfunction m.files(prj)\nm.filegroup(prj, \"Include\", \"None\")\nm.filegroup(prj, \"Compile\", \"Compile\")\nm.filegroup(prj, \"Folder\", \"None\")\nm.filegroup(prj, \"None\", \"None\")\nm.filegroup(prj, \"ResourceCompile\", \"None\")\nm.filegroup(prj, \"CustomBuild\", \"None\")\nend\nfunction m.filegroup(prj, group, action)\nlocal files = m.getfilegroup(prj, group)\nif #files > 0  then\n_p(1,'<ItemGroup>')\nfor _, file in ipairs(files) do\nm.putfile(action, file)\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction m.putfile(action, file)\nlocal filename = file.relpath\nif not string.startswith(filename, '..') then\n_x(2,'<%s Include=\\\"%s\\\" />', action, path.translate(filename))\nelse\n_x(2,'<%s Include=\\\"%s\\\">', action, path.translate(filename))\nwhile string.startswith(filename, '..') do\nfilename = filename:sub(4)\nend\n_x(3,'<Link>%s</Link>', filename)\n_x(2,'</%s>', action)\nend\nend\nfunction m.getTargetGroup(node, prj, groups)\nlocal hasbuildrule = false\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif filecfg and fileconfig.hasCustomBuildRule(filecfg) then\nhasbuildrule = true\nbreak\nend\nend\nif hasbuildrule then\nreturn groups.CustomBuild\nelseif path.iscppfile(node.name) then\nreturn groups.Compile\nelseif path.iscppheader(node.name) then\nreturn groups.Include\nelseif path.isresourcefile(node.name) then\nreturn groups.ResourceCompile\nelse\nreturn groups.None\nend\nend\nfunction m.getfilegroup(prj, group)\nlocal groups = prj.monodevelop_file_groups\nif not groups then\ngroups = {\nCompile = {},\nInclude = {},\nFolder = {},\nNone = {},\nResourceCompile = {},\nCustomBuild = {},\n}\nprj.monodevelop_file_groups = groups\nlocal tr = project.getsourcetree(prj)\ntree.traverse(tr, {\nonleaf = function(node)\ntable.insert(m.getTargetGroup(node, prj, groups), node)\nend\n})\nend\nreturn groups[group]\nend\nfunction m.projectReferences(prj)\nlocal d"
	"eps = project.getdependencies(prj)\nif #deps > 0 then\nlocal prjpath = project.getlocation(prj)\n_p(1,'<ItemGroup>')\nfor _, dep in ipairs(deps) do\nlocal relpath = path.getrelative(prjpath, vstudio.projectfile(dep))\n_x(2,'<ProjectReference Include=\\\"%s\\\">', path.translate(relpath))\n_p(3,'<Project>{%s}</Project>', dep.uuid)\n_p(2,'</ProjectReference>')\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction m.cproj.productVersion(prj)\nlocal action = p.action.current()\n_p(2,'<ProductVersion>%s</ProductVersion>', action.vstudio.productVersion)\nend\nfunction m.cproj.schemaVersion(prj)\nlocal action = p.action.current()\n_p(2,'<SchemaVersion>%s</SchemaVersion>', action.vstudio.csprojSchemaVersion)\nend\nfunction m.cproj.projectGuid(prj)\n_p(2,'<ProjectGuid>{%s}</ProjectGuid>', prj.uuid)\nend\nfunction m.cproj.compiler(prj)\n_p(2,'<Compiler>')\n_p(3,'<Compiler ctype=\"%s\" />', iif(prj.language == 'C', 'GccCompiler', 'GppCompiler'))\n_p(2,'</Compiler>')\nend\nfunction m.cproj.language(prj)\n_p(2,'<Language>%s</Language>', iif(prj.language == 'C', 'C', 'CPP'))\nend\nfunction m.cproj.target(prj)\n_p(2,'<Target>%s</Target>', 'Bin')\nend\nfunction m.cproj.version(prj)\nend\nfunction m.cproj.synchSlnVersion(prj)\nend\nfunction m.cproj.description(prj)\nend\nfunction m.cproj.debuginfo(cfg)\nif cfg.flags.Symbols then\n_p(2,'<DebugSymbols>%s</DebugSymbols>', iif(cfg.flags.Symbols, 'true', 'false'))\nend\nend\nfunction m.cproj.outputPath(cfg)\nlocal outdir = project.getrelative(cfg.project, cfg.buildtarget.directory)\n_x(2,'<OutputPath>%s</OutputPath>', path.translate(outdir))\nend\nfunction m.cproj.outputName(cfg)\n_x(2,'<OutputName>%s</OutputName>', cfg.buildtarget.name)\nend\nfunction m.cproj.config_type(cfg)\nlocal map = {\nSharedLib = \"SharedLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Bin\",\nWindowedApp = \"Bin\"\n}\n_p(2,'<CompileTarget>%s</CompileTarget>', map[cfg.kind])\nend\nfunction m.cproj.preprocessorDefinitions(cfg)\nlocal defines = cfg.defines\nif #defines > 0 then\ndefines = table.concat(defines, ' ')\n_x(2,'<DefineSymbols>%s</DefineSymbols>', defines)\nend\nend\nfunction m.cproj.sourceDirectory(cfg)\n_x(2,'<SourceDirectory>%s</SourceDirectory>', '.')\nend\nfunction m.cproj.warnings(cfg)\nlocal map = { Off = \"None\", Extra = \"All\" }\nif cfg.warnings ~= nil and map[cfg.warnings] ~= nil then\n_p(2,'<WarningLevel>%s</WarningLevel>', map[cfg.warnings])\nend\nif cfg.warnings ~= \"Off\" and cfg.flags.FatalCompileWarnings then\n_p(2,'<WarningsAsErrors>%s</WarningsAsErrors>', iif(cfg.flags.FatalCompileWarnings, 'true', 'false'))\nend\nend\nfunction m.cproj.optimization(cfg)\nlocal map = { Off = \"0\", On = \"2\", Debug = \"0\", Size = \"2\", Speed = \"3\", Full = \"3\" }\nif cfg.optimize ~= nil and map[cfg.optimize] then\n_p(2,'<OptimizationLevel>%s</OptimizationLevel>', map[cfg.optimize])\nend\nend\nfunction m.cproj.externalconsole(cfg)\n_x(2,'<Externalconsole>%s</Externalconsole>', 'true')\nend\nfunction m.cproj.additionalOptions(cfg)\nlocal opts = { }\nif cfg.project.language == 'C++' then\nif cfg.exceptionhandling == p.OFF then\ntable.insert(opts, \"-fno-exceptions\")\nend\nif cfg.rtti == p.OFF then\ntable.insert(opts, \"-fno-rtti\")\nend\nend\nif cfg.vectorextensions == \"SSE2\" then\ntable.insert(opts, \"-msse2\")\nelseif cfg.vectorextensions == \"SSE\" then\ntable.insert(opts, \"-msse\")\nend\nlocal options\nif #opts > 0 then\noptions = table.concat(opts, \" \")\nend\nif #cfg.buildoptions > 0 then\nlocal buildOpts = table.concat(cfg.buildoptions, \" \")\nif options then\noptions = options .. \" \" .. buildOpts\nelse\noptions = buildOpts\nend\nend\nif options then\n_x(2,'<ExtraCompilerArguments>%s</ExtraCompilerArguments>', options)\nend\nend\nfunction m.cproj.additionalLinkOptions(cfg)\nif #cfg.linkoptions > 0 then\nlocal opts = table.concat(cfg.linkoptions, \" \")\n_x(2, '<ExtraLinkerArguments>%s</ExtraLinkerArguments>', opts)\nend\nend\nfunction m.cproj.additionalIncludeDirectories(cfg)\nif #cfg.includedirs > 0 then\n_x(2,'<Includes>')\n_x(3,'<Includes>')\nfor _, i in ipairs(project.getrelative(cfg.p"
	"roject, cfg.includedirs)) do\n_x(4,'<Include>%s</Include>', path.translate(i))\nend\n_x(3,'</Includes>')\n_x(2,'</Includes>')\nend\nend\nfunction m.cproj.additionalLibraryDirectories(cfg)\nif #cfg.libdirs > 0 then\n_x(2,'<LibPaths>')\n_x(3,'<LibPaths>')\nfor _, l in ipairs(project.getrelative(cfg.project, cfg.libdirs)) do\n_x(4,'<LibPath>%s</LibPath>', path.translate(l))\nend\n_x(3,'</LibPaths>')\n_x(2,'</LibPaths>')\nend\nend\nfunction m.cproj.additionalDependencies(cfg)\nlocal links\nlocal toolset = config.toolset(cfg)\nif toolset then\nlinks = toolset.getlinks(cfg, false)\nelse\nlinks = config.getlinks(cfg, \"all\", \"fullpath\")\nend\nif #links > 0 then\n_x(2,'<Libs>')\n_x(3,'<Libs>')\nfor _, lib in ipairs(links) do\n_x(4,'<Lib>%s</Lib>', path.translate(lib))\nend\n_x(3,'</Libs>')\n_x(2,'</Libs>')\nend\nend\nfunction m.cproj.buildEvents(cfg)\nif #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then\n_x(2,'<CustomCommands>')\n_x(3,'<CustomCommands>')\nfor _, c in ipairs(cfg.prebuildcommands) do\n_x(4,'<Command type=\"BeforeBuild\" command=\"%s\" />', c)\nend\nfor _, c in ipairs(cfg.postbuildcommands) do\n_x(4,'<Command type=\"AfterBuild\" command=\"%s\" />', c)\nend\n_x(3,'</CustomCommands>')\n_x(2,'</CustomCommands>')\nend\nend\n",

	"local p = premake\np.api.register {\nname = \"xcodebuildsettings\",\nscope = \"config\",\nkind = \"key-array\",\n}\np.api.register {\nname = \"xcodebuildresources\",\nscope = \"config\",\nkind = \"list\",\n}\nnewaction {\ntrigger     = \"xcode4\",\nshortname   = \"Apple Xcode 4\",\ndescription = \"Generate Apple Xcode 4 project files\",\nos = \"macosx\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"SharedLib\", \"StaticLib\", \"Makefile\", \"None\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools     = {\ncc = { \"gcc\", \"clang\" },\n},\nonWorkspace = function(wks)\np.generate(wks, \".xcworkspace/contents.xcworkspacedata\", p.modules.xcode.generateWorkspace)\nend,\nonProject = function(prj)\np.generate(prj, \".xcodeproj/project.pbxproj\", p.modules.xcode.generateProject)\nend,\n}\nreturn function(cfg)\nreturn (_ACTION == \"xcode4\")\nend\n",

	"local p = premake\np.modules.xcode = {}\nlocal m = p.modules.xcode\nm._VERSION = p._VERSION\nm.elements = {}\ninclude(\"xcode_common.lua\")\ninclude(\"xcode4_workspace.lua\")\ninclude(\"xcode_project.lua\")\nreturn m\n",

	"local p = premake\nlocal m = p.modules.xcode\nm.elements.workspace = function(wks)\nreturn {\nm.xmlDeclaration,\nm.workspace,\nm.workspaceFileRefs,\nm.workspaceTail,\n}\nend\nfunction m.generateWorkspace(wks)\nm.prepareWorkspace(wks)\np.callArray(m.elements.workspace, wks)\nend\nfunction m.workspace()\np.push('<Workspace')\np.w('version = \"1.0\">')\nend\nfunction m.workspaceTail()\npremake.out('</Workspace>')\nend\nm.elements.workspaceFileRef = function(prj)\nreturn {\nm.workspaceLocation,\n}\nend\nfunction m.workspaceFileRefs(wks)\nfor prj in p.workspace.eachproject(wks) do\np.push('<FileRef')\nlocal contents = p.capture(function()\np.callArray(m.elements.workspaceFileRef, prj)\nend)\np.outln(contents .. \">\")\np.pop('</FileRef>')\nend\nend\nfunction m.workspaceLocation(prj)\nlocal fname = p.filename(prj, \".xcodeproj\")\nfname = path.getrelative(prj.workspace.location, fname)\np.w('location = \"group:%s\"', fname)\nend\nfunction m.xmlDeclaration()\np.xmlUtf8(true)\nend\n",

	"local p = premake\nlocal xcode = p.modules.xcode\nlocal tree  = p.tree\n    local workspace = p.workspace\nlocal project = p.project\n    local config = p.config\nlocal fileconfig = p.fileconfig\nfunction xcode.getbuildcategory(node)\nlocal categories = {\n[\".a\"] = \"Frameworks\",\n[\".c\"] = \"Sources\",\n[\".cc\"] = \"Sources\",\n[\".cpp\"] = \"Sources\",\n[\".cxx\"] = \"Sources\",\n[\".dylib\"] = \"Frameworks\",\n[\".framework\"] = \"Frameworks\",\n[\".m\"] = \"Sources\",\n[\".mm\"] = \"Sources\",\n[\".strings\"] = \"Resources\",\n[\".nib\"] = \"Resources\",\n[\".xib\"] = \"Resources\",\n[\".storyboard\"] = \"Resources\",\n[\".icns\"] = \"Resources\",\n[\".s\"] = \"Sources\",\n[\".S\"] = \"Sources\",\n}\nif node.isResource then\nreturn \"Resources\"\nend\nreturn categories[path.getextension(node.name)]\nend\nfunction xcode.isItemResource(project, node)\nlocal res;\nif project and project.xcodebuildresources then\nif type(project.xcodebuildresources) == \"table\" then\nres = project.xcodebuildresources\nend\nend\nlocal function checkItemInList(item, list)\nif item then\nif list then\nif type(list) == \"table\" then\nfor _,v in pairs(list) do\nif string.find(item, v) then\nreturn true\nend\nend\nend\nend\nend\nreturn false\nend\nif (checkItemInList(node.path, res)) then\nreturn true\nend\nreturn false\nend\nfunction xcode.getfiletype(node, cfg)\nif node.configs then\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif filecfg then\nif filecfg.language == \"ObjC\" then\nreturn \"sourcecode.c.objc\"\nelseif filecfg.language == \"ObjCpp\" then\nreturn \"sourcecode.cpp.objcpp\"\nend\nend\nend\nlocal types = {\n[\".c\"]         = \"sourcecode.c.c\",\n[\".cc\"]        = \"sourcecode.cpp.cpp\",\n[\".cpp\"]       = \"sourcecode.cpp.cpp\",\n[\".css\"]       = \"text.css\",\n[\".cxx\"]       = \"sourcecode.cpp.cpp\",\n[\".S\"]         = \"sourcecode.asm.asm\",\n[\".framework\"] = \"wrapper.framework\",\n[\".gif\"]       = \"image.gif\",\n[\".h\"]         = \"sourcecode.c.h\",\n[\".html\"]      = \"text.html\",\n[\".lua\"]       = \"sourcecode.lua\",\n[\".m\"]         = \"sourcecode.c.objc\",\n[\".mm\"]        = \"sourcecode.cpp.objc\",\n[\".nib\"]       = \"wrapper.nib\",\n[\".storyboard\"] = \"file.storyboard\",\n[\".pch\"]       = \"sourcecode.c.h\",\n[\".plist\"]     = \"text.plist.xml\",\n[\".strings\"]   = \"text.plist.strings\",\n[\".xib\"]       = \"file.xib\",\n[\".icns\"]      = \"image.icns\",\n[\".s\"]         = \"sourcecode.asm\",\n[\".bmp\"]       = \"image.bmp\",\n[\".wav\"]       = \"audio.wav\",\n[\".xcassets\"]  = \"folder.assetcatalog\",\n}\nreturn types[path.getextension(node.path)] or \"text\"\nend\nlocal function xcodePrintUserConfigReferences(offset, cfg, tr, kind)\nlocal referenceName\nif kind == \"project\" then\nreferenceName = cfg.xcodeconfigreferenceproject\nelseif kind == \"target\" then\nreferenceName = cfg.xcodeconfigreferencetarget\nend\ntree.traverse(tr, {\nonleaf = function(node)\nfilename = node.name\nif node.id and path.getextension(filename) == \".xcconfig\" then\nif filename == referenceName then\n_p(offset, 'baseConfigurationReference = %s /* %s */;', node.id, filename)\nreturn\nend\nend\nend\n}, false)\nend\nlocal escapeSpecialChars = {\n['\\n'] = '\\\\n',\n['\\r'] = '\\\\r',\n['\\t'] = '\\\\t',\n}\nlocal function escapeChar(c)\nreturn escapeSpecialChars[c] or '\\\\'..c\nend\nlocal function escapeArg(value)\nvalue = value:gsub('[\\'\"\\\\\\n\\r\\t ]', escapeChar)\nreturn value\nend\nlocal function escapeSetting(value)\nvalue = value:gsub('[\"\\\\\\n\\r\\t]', escapeChar)\nreturn value\nend\nlocal function stringifySetting(value)\nvalue = value..''\nif not value:match('^[%a%d_./]+$') then\nvalue = '\"'..escapeSetting(value)..'\"'\nend\nreturn value\nend\nlocal function customStringifySetting(value)\nvalue = value..''\nlocal test = value:match('^[%a%d_./%+]+$')\nif test then\nvalue = '\"'..escapeSetting(value)..'\"'\nend\nreturn value\nend\nlocal function printSetting(level, name, value)\nif type(value) == 'function' then\nvalue(level, name)\nelseif type(value) ~= 'table' then\n_p(level, '%s ="
	" %s;', stringifySetting(name), stringifySetting(value))\nelseif #value >= 1 then\n_p(level, '%s = (', stringifySetting(name))\nfor _, item in ipairs(value) do\n_p(level + 1, '%s,', stringifySetting(item))\nend\n_p(level, ');')\nend\nend\nlocal function printSettingsTable(level, settings)\nlocal keys = table.keys(settings)\ntable.sort(keys)\nfor _, k in ipairs(keys) do\nprintSetting(level, k, settings[k])\nend\nend\nlocal function overrideSettings(settings, overrides)\nif type(overrides) == 'table' then\nfor name, value in pairs(overrides) do\nsettings[name] = iif(value ~= false, value, nil)\nend\nend\nend\nfunction xcode.getproducttype(node)\nlocal types = {\nConsoleApp  = \"com.apple.product-type.tool\",\nWindowedApp = \"com.apple.product-type.application\",\nStaticLib   = \"com.apple.product-type.library.static\",\nSharedLib   = \"com.apple.product-type.library.dynamic\",\n}\nreturn types[node.cfg.kind]\nend\nfunction xcode.gettargettype(node)\nlocal types = {\nConsoleApp  = \"\\\"compiled.mach-o.executable\\\"\",\nWindowedApp = \"wrapper.application\",\nStaticLib   = \"archive.ar\",\nSharedLib   = \"\\\"compiled.mach-o.dylib\\\"\",\n}\nreturn types[node.cfg.kind]\nend\nfunction xcode.getxcodeprojname(prj)\nlocal fname = premake.filename(prj, \".xcodeproj\")\nreturn fname\nend\nfunction xcode.isframework(fname)\nreturn (path.getextension(fname) == \".framework\")\nend\nfunction xcode.newid(...)\nlocal name = ''\nfor i, v in pairs(arg) do\nname = name..v..'****'\nend\nreturn (\"%08X%08X%08X\"):format(name:hash(16777619), name:hash(2166136261), name:hash(46577619))\nend\nfunction xcode.prepareWorkspace(wks)\nwks.xcode = { }\nfor prj in premake.workspace.eachproject(wks) do\nlocal cfg = project.getconfig(prj, prj.configurations[1], prj.platforms[1])\nlocal bundlepath = cfg.buildtarget.bundlename ~= \"\" and cfg.buildtarget.bundlename or cfg.buildtarget.name;\nif (prj.external) then\nbundlepath = cfg.project.name\nend\nlocal node = premake.tree.new(path.getname(bundlepath))\nnode.cfg = cfg\nnode.id = xcode.newid(node.name, \"product\")\nnode.targetid = xcode.newid(node.name, \"target\")\nprj.xcode = {}\nprj.xcode.projectnode = node\nend\nend\nfunction xcode.PBXBuildFile(tr)\nlocal settings = {};\ntree.traverse(tr, {\nonnode = function(node)\nif node.buildid then\nsettings[node.buildid] = function(level)\n_p(level,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };',\nnode.buildid, node.name, xcode.getbuildcategory(node), node.id, node.name)\nend\nend\nend\n})\nif not table.isempty(settings) then\n_p('/* Begin PBXBuildFile section */')\nprintSettingsTable(2, settings);\n_p('/* End PBXBuildFile section */')\n_p('')\nend\nend\nfunction xcode.PBXContainerItemProxy(tr)\nlocal settings = {}\nfor _, node in ipairs(tr.projects.children) do\nsettings[node.productproxyid] = function()\n_p(2,'%s /* PBXContainerItemProxy */ = {', node.productproxyid)\n_p(3,'isa = PBXContainerItemProxy;')\n_p(3,'containerPortal = %s /* %s */;', node.id, path.getrelative(node.parent.parent.project.location, node.path))\n_p(3,'proxyType = 2;')\n_p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.id)\n_p(3,'remoteInfo = %s;', stringifySetting(node.project.xcode.projectnode.name))\n_p(2,'};')\nend\nsettings[node.targetproxyid] = function()\n_p(2,'%s /* PBXContainerItemProxy */ = {', node.targetproxyid)\n_p(3,'isa = PBXContainerItemProxy;')\n_p(3,'containerPortal = %s /* %s */;', node.id, path.getrelative(node.parent.parent.project.location, node.path))\n_p(3,'proxyType = 1;')\n_p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.targetid)\n_p(3,'remoteInfo = %s;', stringifySetting(node.project.xcode.projectnode.name))\n_p(2,'};')\nend\nend\nif not table.isempty(settings) then\n_p('/* Begin PBXContainerItemProxy section */')\nprintSettingsTable(2, settings);\n_p('/* End PBXContainerItemProxy section */')\n_p('')\nend\nend\nfunction xcode.PBXFileReference(tr)\nlocal cfg = project.getfirstconfig(tr.project)\nlocal settings = {}\ntree.traverse(tr, {\nonleaf = function(node)\nif not node.path then\nreturn\nend\nif node."
	"kind == \"product\" then\nsettings[node.id] = function(level)\n_p(level,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = %s; path = %s; sourceTree = BUILT_PRODUCTS_DIR; };',\nnode.id, node.name, xcode.gettargettype(node), stringifySetting(node.name), stringifySetting(path.getname(node.cfg.buildtarget.bundlename ~= \"\" and node.cfg.buildtarget.bundlename or node.cfg.buildtarget.relpath)))\nend\nelseif node.parent.parent == tr.projects then\nsettings[node.parent.id] = function(level)\nlocal relpath = path.getrelative(path.getabsolute(tr.project.location), path.getabsolute(node.parent.project.location))\n_p(level,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = %s; path = %s; sourceTree = SOURCE_ROOT; };',\nnode.parent.id, node.name, customStringifySetting(node.parent.name), stringifySetting(path.join(relpath, node.parent.name)))\nend\nelse\nsettings[node.id] = function(level)\nlocal pth, src\nif xcode.isframework(node.path) then\nlocal nodePath = node.path\nlocal _, matchEnd, variable = string.find(nodePath, \"^%$%((.+)%)/\")\nif variable then\nnodePath = string.sub(nodePath, matchEnd + 1)\nend\nif string.find(nodePath,'/')  then\nif string.find(nodePath,'^%.')then\npth = path.getrelative(tr.project.location, node.path)\nsrc = \"SOURCE_ROOT\"\nvariable = src\nelse\npth = nodePath\nsrc = \"<absolute>\"\nend\nend\nif variable then\nsrc = variable\nif string.find(pth, '^/') then\npth = string.sub(pth, 2)\nend\nelse\npth = \"System/Library/Frameworks/\" .. node.path\nsrc = \"SDKROOT\"\nend\nelse\nsrc = \"<group>\"\nif node.abspath then\npth = path.getrelative(tr.project.location, node.abspath)\nelse\npth = node.path\nend\nend\n_p(level,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = %s; path = %s; sourceTree = %s; };',\nnode.id, node.name, xcode.getfiletype(node, cfg), stringifySetting(node.name), stringifySetting(pth), stringifySetting(src))\nend\nend\nend\n})\nif not table.isempty(settings) then\n_p('/* Begin PBXFileReference section */')\nprintSettingsTable(2, settings)\n_p('/* End PBXFileReference section */')\n_p('')\nend\nend\nfunction xcode.PBXFrameworksBuildPhase(tr)\n_p('/* Begin PBXFrameworksBuildPhase section */')\n_p(2,'%s /* Frameworks */ = {', tr.products.children[1].fxstageid)\n_p(3,'isa = PBXFrameworksBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\ntree.traverse(tr.frameworks, {\nonleaf = function(node)\nif node.buildid then\n_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)\nend\nend\n})\ntree.traverse(tr.projects, {\nonleaf = function(node)\nif node.buildid then\n_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)\nend\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;')\n_p(2,'};')\n_p('/* End PBXFrameworksBuildPhase section */')\n_p('')\nend\nfunction xcode.PBXGroup(tr)\nlocal settings = {}\ntree.traverse(tr, {\nonnode = function(node)\nif (node.path and #node.children == 0) or node.kind == \"vgroup\" then\nreturn\nend\nsettings[node.productgroupid or node.id] = function()\nif node.parent == tr.projects then\n_p(2,'%s /* Products */ = {', node.productgroupid)\nelse\n_p(2,'%s /* %s */ = {', node.id, node.name)\nend\n_p(3,'isa = PBXGroup;')\n_p(3,'children = (')\nfor _, childnode in ipairs(node.children) do\n_p(4,'%s /* %s */,', childnode.id, childnode.name)\nend\n_p(3,');')\nif node.parent == tr.projects then\n_p(3,'name = Products;')\nelse\n_p(3,'name = %s;', stringifySetting(node.name))\nlocal vpath = project.getvpath(tr.project, node.name)\nif node.path and node.name ~= vpath then\nlocal p = node.path\nif node.parent.path then\np = path.getrelative(node.parent.path, node.path)\nend\n_p(3,'path = %s;', stringifySetting(p))\nend\nend\n_p(3,'sourceTree = \"<group>\";')\n_p(2,'};')\nend\nend\n}, true)\nif not table.isempty(settings) then\n_p('/* Begin PBXGroup section */')\nprintSettingsTable(2, settings)\n_p('/* End PBXGroup section */')\n_p('')\nend\nend\nfunction xcode.PBXNativeTarget(tr)\n_p('/* Begin PBXNativeTarget section */')\nfor _, node"
	" in ipairs(tr.products.children) do\nlocal name = tr.project.name\nlocal function hasBuildCommands(which)\nif #tr.project[which] > 0 then\nreturn true\nend\nfor _, cfg in ipairs(tr.configs) do\nif #cfg[which] > 0 then\nreturn true\nend\nend\nend\n_p(2,'%s /* %s */ = {', node.targetid, name)\n_p(3,'isa = PBXNativeTarget;')\n_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget \"%s\" */;', node.cfgsection, escapeSetting(name))\n_p(3,'buildPhases = (')\nif hasBuildCommands('prebuildcommands') then\n_p(4,'9607AE1010C857E500CD1376 /* Prebuild */,')\nend\n_p(4,'%s /* Resources */,', node.resstageid)\n_p(4,'%s /* Sources */,', node.sourcesid)\nif hasBuildCommands('prelinkcommands') then\n_p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,')\nend\n_p(4,'%s /* Frameworks */,', node.fxstageid)\nif hasBuildCommands('postbuildcommands') then\n_p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,')\nend\n_p(3,');')\n_p(3,'buildRules = (')\n_p(3,');')\n_p(3,'dependencies = (')\nfor _, node in ipairs(tr.projects.children) do\n_p(4,'%s /* PBXTargetDependency */,', node.targetdependid)\nend\n_p(3,');')\n_p(3,'name = %s;', stringifySetting(name))\nlocal p\nif node.cfg.kind == \"ConsoleApp\" then\np = \"$(HOME)/bin\"\nelseif node.cfg.kind == \"WindowedApp\" then\np = \"$(HOME)/Applications\"\nend\nif p then\n_p(3,'productInstallPath = %s;', stringifySetting(p))\nend\n_p(3,'productName = %s;', stringifySetting(name))\n_p(3,'productReference = %s /* %s */;', node.id, node.name)\n_p(3,'productType = %s;', stringifySetting(xcode.getproducttype(node)))\n_p(2,'};')\nend\n_p('/* End PBXNativeTarget section */')\n_p('')\nend\nfunction xcode.PBXProject(tr)\n_p('/* Begin PBXProject section */')\n_p(2,'08FB7793FE84155DC02AAC07 /* Project object */ = {')\n_p(3,'isa = PBXProject;')\n_p(3,'buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \"%s\" */;', tr.name)\n_p(3,'compatibilityVersion = \"Xcode 3.2\";')\n_p(3,'hasScannedForEncodings = 1;')\n_p(3,'mainGroup = %s /* %s */;', tr.id, tr.name)\n_p(3,'projectDirPath = \"\";')\nif #tr.projects.children > 0 then\n_p(3,'projectReferences = (')\nfor _, node in ipairs(tr.projects.children) do\n_p(4,'{')\n_p(5,'ProductGroup = %s /* Products */;', node.productgroupid)\n_p(5,'ProjectRef = %s /* %s */;', node.id, path.getname(node.path))\n_p(4,'},')\nend\n_p(3,');')\nend\n_p(3,'projectRoot = \"\";')\n_p(3,'targets = (')\nfor _, node in ipairs(tr.products.children) do\n_p(4,'%s /* %s */,', node.targetid, node.name)\nend\n_p(3,');')\n_p(2,'};')\n_p('/* End PBXProject section */')\n_p('')\nend\nfunction xcode.PBXReferenceProxy(tr)\nlocal settings = {}\ntree.traverse(tr.projects, {\nonleaf = function(node)\nsettings[node.id] = function()\n_p(2,'%s /* %s */ = {', node.id, node.name)\n_p(3,'isa = PBXReferenceProxy;')\n_p(3,'fileType = %s;', xcode.gettargettype(node))\n_p(3,'path = %s;', stringifySetting(node.name))\n_p(3,'remoteRef = %s /* PBXContainerItemProxy */;', node.parent.productproxyid)\n_p(3,'sourceTree = BUILT_PRODUCTS_DIR;')\n_p(2,'};')\nend\nend\n})\nif not table.isempty(settings) then\n_p('/* Begin PBXReferenceProxy section */')\nprintSettingsTable(2, settings)\n_p('/* End PBXReferenceProxy section */')\n_p('')\nend\nend\nfunction xcode.PBXResourcesBuildPhase(tr)\n_p('/* Begin PBXResourcesBuildPhase section */')\nfor _, target in ipairs(tr.products.children) do\n_p(2,'%s /* Resources */ = {', target.resstageid)\n_p(3,'isa = PBXResourcesBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\ntree.traverse(tr, {\nonnode = function(node)\nif xcode.getbuildcategory(node) == \"Resources\" then\n_p(4,'%s /* %s in Resources */,', node.buildid, node.name)\nend\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;')\n_p(2,'};')\nend\n_p('/* End PBXResourcesBuildPhase section */')\n_p('')\nend\nfunction xcode.PBXShellScriptBuildPhase(tr)\nlocal wrapperWritten = false\nlocal function doblock(id, name, which)\nlocal prjcmds = tr.project[which]\nlocal commands = table.join(prjcmds, {})\nfor _, cfg in ipairs(tr.configs) do\nlocal cfg"
	"cmds = cfg[which]\nif #cfgcmds > #prjcmds then\ntable.insert(commands, 'if [ \"${CONFIGURATION}\" = \"' .. cfg.buildcfg .. '\" ]; then')\nfor i = #prjcmds + 1, #cfgcmds do\ntable.insert(commands, cfgcmds[i])\nend\ntable.insert(commands, 'fi')\nend\nend\nif #commands > 0 then\ncommands = os.translateCommands(commands, p.MACOSX)\nif not wrapperWritten then\n_p('/* Begin PBXShellScriptBuildPhase section */')\nwrapperWritten = true\nend\n_p(2,'%s /* %s */ = {', id, name)\n_p(3,'isa = PBXShellScriptBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\n_p(3,');')\n_p(3,'inputPaths = (');\n_p(3,');');\n_p(3,'name = %s;', name);\n_p(3,'outputPaths = (');\n_p(3,');');\n_p(3,'runOnlyForDeploymentPostprocessing = 0;');\n_p(3,'shellPath = /bin/sh;');\n_p(3,'shellScript = %s;', stringifySetting(table.concat(commands, '\\n')))\n_p(2,'};')\nend\nend\ndoblock(\"9607AE1010C857E500CD1376\", \"Prebuild\", \"prebuildcommands\")\ndoblock(\"9607AE3510C85E7E00CD1376\", \"Prelink\", \"prelinkcommands\")\ndoblock(\"9607AE3710C85E8F00CD1376\", \"Postbuild\", \"postbuildcommands\")\nif wrapperWritten then\n_p('/* End PBXShellScriptBuildPhase section */')\nend\nend\nfunction xcode.PBXSourcesBuildPhase(tr)\n_p('/* Begin PBXSourcesBuildPhase section */')\nfor _, target in ipairs(tr.products.children) do\n_p(2,'%s /* Sources */ = {', target.sourcesid)\n_p(3,'isa = PBXSourcesBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\ntree.traverse(tr, {\nonleaf = function(node)\nif xcode.getbuildcategory(node) == \"Sources\" then\n_p(4,'%s /* %s in Sources */,', node.buildid, node.name)\nend\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;')\n_p(2,'};')\nend\n_p('/* End PBXSourcesBuildPhase section */')\n_p('')\nend\nfunction xcode.PBXVariantGroup(tr)\nlocal settings = {}\ntree.traverse(tr, {\nonbranch = function(node)\nsettings[node.id] = function()\nif node.kind == \"vgroup\" then\n_p(2,'%s /* %s */ = {', node.id, node.name)\n_p(3,'isa = PBXVariantGroup;')\n_p(3,'children = (')\nfor _, lang in ipairs(node.children) do\n_p(4,'%s /* %s */,', lang.id, lang.name)\nend\n_p(3,');')\n_p(3,'name = %s;', node.name)\n_p(3,'sourceTree = \"<group>\";')\n_p(2,'};')\nend\nend\nend\n})\nif not table.isempty(settings) then\n_p('/* Begin PBXVariantGroup section */')\nprintSettingsTable(2, settings)\n_p('/* End PBXVariantGroup section */')\n_p('')\nend\nend\nfunction xcode.PBXTargetDependency(tr)\nlocal settings = {}\ntree.traverse(tr.projects, {\nonleaf = function(node)\nsettings[node.parent.targetdependid] = function()\n_p(2,'%s /* PBXTargetDependency */ = {', node.parent.targetdependid)\n_p(3,'isa = PBXTargetDependency;')\n_p(3,'name = %s;', stringifySetting(node.name))\n_p(3,'targetProxy = %s /* PBXContainerItemProxy */;', node.parent.targetproxyid)\n_p(2,'};')\nend\nend\n})\nif not table.isempty(settings) then\n_p('/* Begin PBXTargetDependency section */')\nprintSettingsTable(2, settings)\n_p('/* End PBXTargetDependency section */')\n_p('')\nend\nend\nfunction xcode.XCBuildConfiguration_Target(tr, target, cfg)\nlocal settings = {}\nsettings['ALWAYS_SEARCH_USER_PATHS'] = 'NO'\nif not cfg.flags.Symbols then\nsettings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym'\nend\nif cfg.kind ~= \"StaticLib\" and cfg.buildtarget.prefix ~= '' then\nsettings['EXECUTABLE_PREFIX'] = cfg.buildtarget.prefix\nend\nlocal outdir = path.getrelative(tr.project.location, path.getdirectory(cfg.buildtarget.relpath))\nif outdir ~= \".\" then\nsettings['CONFIGURATION_BUILD_DIR'] = outdir\nend\nsettings['GCC_DYNAMIC_NO_PIC'] = 'NO'\nif tr.infoplist then\nsettings['INFOPLIST_FILE'] = config.findfile(cfg, path.getextension(tr.infoplist.name))\nend\ninstallpaths = {\nConsoleApp = '/usr/local/bin',\nWindowedApp = '\"$(HOME)/Applications\"',\nSharedLib = '/usr/local/lib',\nStaticLib = '/usr/local/lib',\n}\nsettings['INSTALL_PATH'] = installpaths[cfg.kind]\nlocal fileNameList = {}\nlocal file_tree = project.getsourcetree(tr.project)\ntree.traverse(tr, {\nonnode = function(node)\nif node.buildid and not node.isResource and node.abspath then\nlocal fi"
	"lecfg = fileconfig.getconfig(node, cfg)\nif filecfg and filecfg.flags.ExcludeFromBuild then\ntable.insert(fileNameList, escapeArg(node.name))\nend\nend\nend\n})\nif not table.isempty(fileNameList) then\nsettings['EXCLUDED_SOURCE_FILE_NAMES'] = fileNameList\nend\nsettings['PRODUCT_NAME'] = cfg.buildtarget.basename\noverrideSettings(settings, cfg.xcodebuildsettings)\n_p(2,'%s /* %s */ = {', cfg.xcode.targetid, cfg.buildcfg)\n_p(3,'isa = XCBuildConfiguration;')\n_p(3,'buildSettings = {')\nprintSettingsTable(4, settings)\n_p(3,'};')\nprintSetting(3, 'name', cfg.buildcfg);\n_p(2,'};')\nend\nfunction xcode.XCBuildConfiguration_Project(tr, cfg)\nlocal settings = {}\nlocal archs = {\nNative = \"$(NATIVE_ARCH_ACTUAL)\",\nx86    = \"i386\",\nx86_64 = \"x86_64\",\nUniversal32 = \"$(ARCHS_STANDARD_32_BIT)\",\nUniversal64 = \"$(ARCHS_STANDARD_64_BIT)\",\nUniversal = \"$(ARCHS_STANDARD_32_64_BIT)\",\n}\nsettings['ARCHS'] = archs[cfg.platform or \"Native\"]\nlocal targetdir = path.getdirectory(cfg.buildtarget.relpath)\nif targetdir ~= \".\" then\nsettings['CONFIGURATION_BUILD_DIR'] = '$(SYMROOT)'\nend\nsettings['CONFIGURATION_TEMP_DIR'] = '$(OBJROOT)'\nif cfg.flags.Symbols then\nsettings['COPY_PHASE_STRIP'] = 'NO'\nend\nsettings['GCC_C_LANGUAGE_STANDARD'] = 'gnu99'\nif cfg.exceptionhandling == p.OFF then\nsettings['GCC_ENABLE_CPP_EXCEPTIONS'] = 'NO'\nend\nif cfg.rtti == p.OFF then\nsettings['GCC_ENABLE_CPP_RTTI'] = 'NO'\nend\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\nsettings['GCC_ENABLE_FIX_AND_CONTINUE'] = 'YES'\nend\nif cfg.exceptionhandling == p.OFF then\nsettings['GCC_ENABLE_OBJC_EXCEPTIONS'] = 'NO'\nend\nlocal optimizeMap = { On = 3, Size = 's', Speed = 3, Full = 'fast', Debug = 1 }\nsettings['GCC_OPTIMIZATION_LEVEL'] = optimizeMap[cfg.optimize] or 0\nif cfg.pchheader and not cfg.flags.NoPCH then\nsettings['GCC_PRECOMPILE_PREFIX_HEADER'] = 'YES'\nsettings['GCC_PREFIX_HEADER'] = cfg.pchheader\nend\nsettings['GCC_PREPROCESSOR_DEFINITIONS'] = cfg.defines\nsettings[\"GCC_SYMBOLS_PRIVATE_EXTERN\"] = 'NO'\nif cfg.flags.FatalWarnings then\nsettings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'\nend\nsettings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'YES'\nsettings['GCC_WARN_UNUSED_VARIABLE'] = 'YES'\nlocal includedirs = project.getrelative(cfg.project, cfg.includedirs)\nfor i,v in ipairs(includedirs) do\ncfg.includedirs[i] = premake.quoted(v)\nend\nsettings['USER_HEADER_SEARCH_PATHS'] = cfg.includedirs\nfor i,v in ipairs(cfg.libdirs) do\ncfg.libdirs[i] = premake.project.getrelative(cfg.project, cfg.libdirs[i])\nend\nsettings['LIBRARY_SEARCH_PATHS'] = cfg.libdirs\nlocal objDir = path.getrelative(tr.project.location, cfg.objdir)\nsettings['OBJROOT'] = objDir\nsettings['ONLY_ACTIVE_ARCH'] = iif(premake.config.isDebugBuild(cfg), 'YES', 'NO')\nlocal checks = {\n[\"-ffast-math\"]          = cfg.flags.FloatFast,\n[\"-ffloat-store\"]        = cfg.flags.FloatStrict,\n[\"-fomit-frame-pointer\"] = cfg.flags.NoFramePointer,\n}\nlocal flags = { }\nfor flag, check in pairs(checks) do\nif check then\ntable.insert(flags, flag)\nend\nend\nsettings['OTHER_CFLAGS'] = table.join(flags, cfg.buildoptions)\nflags = { }\nfor _, lib in ipairs(config.getlinks(cfg, \"system\")) do\nif not xcode.isframework(lib) then\ntable.insert(flags, \"-l\" .. lib)\nend\nend\nfor _, lib in ipairs(config.getlinks(cfg, \"dependencies\", \"object\")) do\nif (lib.external) then\nif not xcode.isframework(lib.linktarget.basename) then\ntable.insert(flags, \"-l\" .. escapeArg(lib.linktarget.basename))\nend\nend\nend\nsettings['OTHER_LDFLAGS'] = table.join(flags, cfg.linkoptions)\nif cfg.flags.StaticRuntime then\nsettings['STANDARD_C_PLUS_PLUS_LIBRARY_TYPE'] = 'static'\nend\nif targetdir ~= \".\" then\nsettings['SYMROOT'] = path.getrelative(tr.project.location, targetdir)\nend\nif cfg.warnings == \"Extra\" then\nsettings['WARNING_CFLAGS'] = '-Wall -Wextra'\nend\noverrideSettings(settings, cfg.xcodebuildsettings)\n_p(2,'%s /* %s */ = {', cfg.xcode.projectid, cfg.buildcfg)\n_p(3,'isa = XCBuildConfiguration;')\n_p(3,'buildSettings = {')\nprintSettingsTable(4, settings)\n_p(3,'};')\n"
	"printSetting(3, 'name', cfg.buildcfg);\n_p(2,'};')\nend\nfunction xcode.XCBuildConfiguration(tr)\nlocal settings = {}\nfor _, target in ipairs(tr.products.children) do\nfor _, cfg in ipairs(tr.configs) do\nsettings[cfg.xcode.targetid] = function()\nxcode.XCBuildConfiguration_Target(tr, target, cfg)\nend\nend\nend\nfor _, cfg in ipairs(tr.configs) do\nsettings[cfg.xcode.projectid] = function()\nxcode.XCBuildConfiguration_Project(tr, cfg)\nend\nend\nif not table.isempty(settings) then\n_p('/* Begin XCBuildConfiguration section */')\nprintSettingsTable(0, settings)\n_p('/* End XCBuildConfiguration section */')\n_p('')\nend\nend\nfunction xcode.XCBuildConfigurationList(tr)\nlocal wks = tr.project.workspace\nlocal defaultCfgName = stringifySetting(tr.configs[1].buildcfg)\nlocal settings = {}\nfor _, target in ipairs(tr.products.children) do\nsettings[target.cfgsection] = function()\n_p(2,'%s /* Build configuration list for PBXNativeTarget \"%s\" */ = {', target.cfgsection, target.name)\n_p(3,'isa = XCConfigurationList;')\n_p(3,'buildConfigurations = (')\nfor _, cfg in ipairs(tr.configs) do\n_p(4,'%s /* %s */,', cfg.xcode.targetid, cfg.buildcfg)\nend\n_p(3,');')\n_p(3,'defaultConfigurationIsVisible = 0;')\n_p(3,'defaultConfigurationName = %s;', defaultCfgName)\n_p(2,'};')\nend\nend\nsettings['1DEB928908733DD80010E9CD'] = function()\n_p(2,'1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \"%s\" */ = {', tr.name)\n_p(3,'isa = XCConfigurationList;')\n_p(3,'buildConfigurations = (')\nfor _, cfg in ipairs(tr.configs) do\n_p(4,'%s /* %s */,', cfg.xcode.projectid, cfg.buildcfg)\nend\n_p(3,');')\n_p(3,'defaultConfigurationIsVisible = 0;')\n_p(3,'defaultConfigurationName = %s;', defaultCfgName)\n_p(2,'};')\nend\n_p('/* Begin XCConfigurationList section */')\nprintSettingsTable(2, settings)\n_p('/* End XCConfigurationList section */')\nend\n",

	"local p = premake\nlocal m = p.modules.xcode\nlocal xcode = p.modules.xcode\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nlocal tree = p.tree\nfunction xcode.buildprjtree(prj)\nlocal tr = project.getsourcetree(prj, nil , false)\ntr.project = prj\ntr.configs = {}\nfor cfg in project.eachconfig(prj) do\ncfg.xcode = {}\ncfg.xcode.targetid = xcode.newid(prj.xcode.projectnode.name, cfg.buildcfg, \"target\")\ncfg.xcode.projectid = xcode.newid(tr.name, cfg.buildcfg)\ntable.insert(tr.configs, cfg)\nend\n        -- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)\n tree.traverse(tr, {\n onbranch = function(node)\n if path.getextension(node.name) == \".lproj\" then\n local lang = path.getbasename(node.name)  -- \"English\", \"French\", etc.\n -- create a new language group for each file it contains\n for _, filenode in ipairs(node.children) do\n local grpnode = node.parent.children[filenode.name]\n if not grpnode then\n grpnode = tree.insert(node.parent, tree.new(filenode.name))\n grpnode.kind = \"vgroup\"\n end\n -- convert the file node to a language node and add to the group\n filenode.name = path.getbasename(lang)\n tree.insert(grpnode, filenode)\n end\n tree.remove(node)\n end\n end\n })\n        -- the special folder \"Frameworks\" lists all linked frameworks\ntr.frameworks = tree.new(\"Frameworks\")\nfor cfg in project.eachconfig(prj) do\nfor _, link in ipairs(config.getlinks(cfg, \"system\", \"fullpath\")) do\nlocal name = path.getname(link)\nif xcode.isframework(name) and not tr.frameworks.children[name] then\nnode = tree.insert(tr.frameworks, tree.new(name))\nnode.path = link\n end\n end\n end\nif #tr.frameworks.children > 0 then\ntree.insert(tr, tr.frameworks)\nend\n tr.products = tree.insert(tr, tree.new(\"Products\"))\n tr.projects = tree.new(\"Projects\")\n for _, dep in ipairs(project.getdependencies(prj, \"sibling\", \"object\")) do\n -- create a child node for the dependency's xcodeproj\n local xcpath = xcode.getxcodeprojname(dep)\n local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath)))\n xcnode.path = xcpath\n xcnode.project = dep\n xcnode.productgroupid = xcode.newid(xcnode.name, \"prodgrp\")\n xcnode.productproxyid = xcode.newid(xcnode.name, \"prodprox\")\n xcnode.targetproxyid  = xcode.newid(xcnode.name, \"targprox\")\n xcnode.targetdependid = xcode.newid(xcnode.name, \"targdep\")\n local lprj = premake.workspace.findproject(prj.workspace, dep.name)\n local cfg = project.findClosestMatch(lprj, prj.configurations[1])\n node = tree.insert(xcnode, tree.new(cfg.linktarget.name))\n node.path = cfg.linktarget.fullpath\n node.cfg = cfg\nend\n if #tr.projects.children > 0 then\n tree.insert(tr, tr.projects)\n end\n        -- Final setup\n tree.traverse(tr, {\n onnode = function(node)\n -- assign IDs to every node in the tree\n node.id = xcode.newid(node.name, nil, node.path)\n node.isResource = xcode.isItemResource(prj, node)\n -- assign build IDs to buildable files\n if xcode.getbuildcategory(node) then\n node.buildid = xcode.newid(node.name, \"build\", node.path)\n end\n -- remember key files that are needed elsewhere\n if string.endswith(node.name, \"Info.plist\") then\n tr.infoplist = node\n end\n end\n }, true)\n        -- Plug in the product node into the Products folder in the tree. The node\nnode = tree.insert(tr.products, prj.xcode.projectnode)\nnode.kind = \"product\"\nnode.path = node.cfg.buildtarget.fullpath\nnode.cfgsection = xcode.newid(node.name, \"cfg\")\nnode.resstageid = xcode.newid(node.name, \"rez\")\nnode.sourcesid  = xcode.newid(node.name, \"src\")\nnode.fxstageid  = xcode.newid(node.name, \"fxs\")\nreturn tr\nend\nm.elements.project = function(prj)\nreturn {\nm.header,\n}\nend\nfunction m.generateProject(prj)\nlocal tr = xcode.buildprjtree(prj)\np.callArray(m.elements.project, prj)\nxcode.PBXBuildFile(tr)\nxcode.PBXContainerItemProxy(tr)\nxcode.PBXFileReference(tr)\nxcode.PBXFrameworksBuildPhase(tr)\nxcode.PBXGroup(tr)\nxcode.PBXNativeTarget(tr)\nxcode.PBXProject(tr)\nxcode.PBXReferenceProxy(tr)\nxcode.P"
	"BXResourcesBuildPhase(tr)\nxcode.PBXShellScriptBuildPhase(tr)\nxcode.PBXSourcesBuildPhase(tr)\nxcode.PBXTargetDependency(tr)\nxcode.PBXVariantGroup(tr)\nxcode.XCBuildConfiguration(tr)\nxcode.XCBuildConfigurationList(tr)\nxcode.footer(prj)\nend\nfunction m.header(prj)\np.w('// !$*UTF8*$!')\np.push('{')\np.w('archiveVersion = 1;')\np.w('classes = {')\np.w('};')\np.w('objectVersion = 46;')\np.push('objects = {')\np.w()\nend\nfunction xcode.footer(prj)\np.pop('};')\np.w('rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;')\np.pop('}')\nend\n",

	"premake = premake or {}\npremake._VERSION = _PREMAKE_VERSION\npackage.loaded[\"premake\"] = premake\npremake.modules = {}\npremake.extensions = premake.modules\nlocal p = premake\nlocal _warnings = {}\nlocal _aliases = {}\npremake.C           = \"C\"\npremake.C7          = \"c7\"\npremake.CLANG       = \"clang\"\npremake.CONSOLEAPP  = \"ConsoleApp\"\npremake.CPP         = \"C++\"\npremake.CSHARP      = \"C#\"\npremake.GCC         = \"gcc\"\npremake.HAIKU       = \"haiku\"\npremake.LINUX       = \"linux\"\npremake.MACOSX      = \"macosx\"\npremake.MAKEFILE    = \"Makefile\"\npremake.NONE        = \"None\"\npremake.DEFAULT     = \"Default\"\npremake.ON          = \"On\"\npremake.OFF         = \"Off\"\npremake.POSIX       = \"posix\"\npremake.PS3         = \"ps3\"\npremake.SHAREDLIB   = \"SharedLib\"\npremake.STATICLIB   = \"StaticLib\"\npremake.UNIVERSAL   = \"universal\"\npremake.UTILITY     = \"Utility\"\npremake.WINDOWEDAPP = \"WindowedApp\"\npremake.WINDOWS     = \"windows\"\npremake.X86         = \"x86\"\npremake.X86_64      = \"x86_64\"\npremake.XBOX360     = \"xbox360\"\nfunction p.alias(scope, canonical, alias)\nscope, canonical = p.resolveAlias(scope, canonical)\nif not scope[canonical] then\nerror(\"unable to alias '\" .. canonical .. \"'; no such function\", 2)\nend\n_aliases[scope] = _aliases[scope] or {}\n_aliases[scope][alias] = canonical\nscope[alias] = function(...)\nreturn scope[canonical](...)\nend\nend\nfunction premake.callArray(funcs, ...)\nif type(funcs) == \"function\" then\nfuncs = funcs(...)\nend\nfor i = 1, #funcs do\nfuncs[i](...)\nend\nend\nfunction premake.callarray(namespace, array, ...)\nlocal n = #array\nfor i = 1, n do\nlocal fn = namespace[array[i]]\nif not fn then\n                error(string.format(\"Unable to find function '%s'\", array[i]))\nend\nfn(...)\nend\nend\nfunction p.checkVersion(version, checks)\nif not version then\nreturn false\nend\nlocal function parse(str)\nlocal major, minor, patch, dev = str:match(\"^(%d+)%.?(%d*)%.?(%d*)(.-)$\")\nmajor = tonumber(major) or 0\nminor = tonumber(minor) or 0\npatch = tonumber(patch) or 0\ndev = dev or \"\"\nreturn { major, minor, patch, dev }\nend\nlocal function compare(a, b)\nfor i=1,4 do\nif a[i] > b[i] then return 1 end\nif a[i] < b[i] then return -1 end\nend\nreturn 0\nend\nlocal function eq(r) return r == 0 end\nlocal function le(r) return r <= 0 end\nlocal function lt(r) return r < 0  end\nlocal function ge(r) return r >= 0 end\nlocal function gt(r) return r > 0  end\nversion = parse(version)\nchecks = string.explode(checks, \" \", true)\nfor i = 1, #checks do\nlocal check = checks[i]\nlocal func\nif check:startswith(\">=\") then\nfunc = ge\ncheck = check:sub(3)\nelseif check:startswith(\">\") then\nfunc = gt\ncheck = check:sub(2)\nelseif check:startswith(\"<=\") then\nfunc = le\ncheck = check:sub(3)\nelseif check:startswith(\"<\") then\nfunc = lt\ncheck = check:sub(2)\nelseif check:startswith(\"=\") then\nfunc = eq\ncheck = check:sub(2)\nelse\nfunc = ge\nend\ncheck = parse(check)\nif not func(compare(version, check)) then\nreturn false\nend\nend\nreturn true\nend\nfunction premake.clearWarnings()\n_warnings = {}\nend\nfunction premake.error(message, ...)\nerror(string.format(\"** Error: \" .. message, ...), 0)\nend\nfunction premake.findProjectScript(fname)\nreturn os.locate(fname, fname .. \".lua\", path.join(fname, \"premake5.lua\"), path.join(fname, \"premake4.lua\"))\nend\nfunction iif(condition, trueValue, falseValue)\nif condition then\nreturn trueValue\nelse\nreturn falseValue\nend\nend\nfunction premake.override(scope, name, repl)\nscope, name = p.resolveAlias(scope, name)\nlocal original = scope[name]\nif not original then\nerror(\"unable to override '\" .. name .. \"'; no such function\", 2)\nend\nscope[name] = function(...)\nreturn repl(original, ...)\nend\nif scope == premake.main then\ntable.replace(premake.main.elements, original, scope[name])\nend\nend\nfunction p.resolveAlias(scope, name)\nlocal aliases = _aliases[scope]\nif aliases then\nwhile aliases[name] do\nname = aliases[name]\nend\nend\nreturn scope, name\ne"
	"nd\nfunction premake.warn(message, ...)\nmessage = string.format(message, ...)\nif _OPTIONS.fatal then\nerror(message)\nelse\nio.stderr:write(string.format(\"** Warning: \" .. message .. \"\\n\", ...))\nend\nend\nfunction premake.warnOnce(key, message, ...)\nif not _warnings[key] then\n_warnings[key] = true\npremake.warn(message, ...)\nend\nend\nfunction printf(msg, ...)\nprint(string.format(msg, ...))\nend\nfunction verbosef(msg, ...)\nif _OPTIONS.verbose then\nprint(string.format(msg, ...))\nend\nend\n",

	"function string.capitalized(self)\nreturn self:gsub(\"^%l\", string.upper)\nend\nfunction string.contains(s, match)\nreturn string.find(s, match, 1, true) ~= nil\nend\nfunction string.explode(s, pattern, plain, maxTokens)\nif (pattern == '') then return false end\nlocal pos = 0\nlocal arr = { }\nfor st,sp in function() return s:find(pattern, pos, plain) end do\ntable.insert(arr, s:sub(pos, st-1))\npos = sp + 1\nif maxTokens ~= nil and maxTokens > 0 then\nmaxTokens = maxTokens - 1\nif maxTokens == 0 then\nbreak\nend\nend\nend\ntable.insert(arr, s:sub(pos))\nreturn arr\nend\nfunction string.findlast(s, pattern, plain)\nlocal curr = 0\nrepeat\nlocal next = s:find(pattern, curr + 1, plain)\nif (next) then curr = next end\nuntil (not next)\nif (curr > 0) then\nreturn curr\nend\nend\nfunction string.lines(s)\nlocal trailing, n = s:gsub('.-\\n', '')\nif #trailing > 0 then\nn = n + 1\nend\nreturn n\nend\nfunction string:plural()\nif self:endswith(\"y\") then\nreturn self:sub(1, #self - 1) .. \"ies\"\nelse\nreturn self .. \"s\"\nend\nend\n",

	"function table.arraycopy(object)\nlocal result = {}\nfor i, value in ipairs(object) do\nresult[i] = value\nend\nreturn result\nend\nfunction table.contains(t, value)\nfor _,v in pairs(t) do\nif (v == value) then\nreturn true\nend\nend\nreturn false\nend\nfunction table.deepcopy(object)\nlocal seen = {}\nlocal function copy(object)\nif type(object) ~= \"table\" then\nreturn object\nelseif seen[object] then\nreturn seen[object]\nend\nlocal clone = {}\nseen[object] = clone\nfor key, value in pairs(object) do\nclone[key] = copy(value)\nend\nreturn clone\nend\nreturn copy(object)\nend\nfunction table.extract(arr, fname)\nlocal result = { }\nfor _,v in ipairs(arr) do\ntable.insert(result, v[fname])\nend\nreturn result\nend\nfunction table.filter(arr, fn)\nlocal result = { }\ntable.foreachi(arr, function(val)\nif fn(val) then\ntable.insert(result, val)\nend\nend)\nreturn result\nend\nfunction table.flatten(arr)\nlocal result = {}\nlocal function flatten(arr)\nlocal n = #arr\nfor i = 1, n do\nlocal v = arr[i]\nif type(v) == \"table\" then\nflatten(v)\nelseif v then\ntable.insert(result, v)\nend\nend\nend\nflatten(arr)\nreturn result\nend\nfunction table.foreachi(arr, func)\nif arr then\nlocal n = #arr\nfor i = 1, n do\nlocal v = arr[i]\nif v then\nfunc(v)\nend\nend\nend\nend\nfunction table.fold(list1, list2)\nlocal result = {}\nfor _, item1 in ipairs(list1 or {}) do\nif list2 and #list2 > 0 then\nfor _, item2 in ipairs(list2) do\ntable.insert(result, { item1, item2 })\nend\nelse\ntable.insert(result, { item1 })\nend\nend\nreturn result\nend\nfunction table.implode(arr, before, after, between)\nlocal result = \"\"\nfor _,v in ipairs(arr) do\nif (result ~= \"\" and between) then\nresult = result .. between\nend\nresult = result .. before .. v .. after\nend\nreturn result\nend\nfunction table.indexof(tbl, obj)\nfor k, v in pairs(tbl) do\nif v == obj then\nreturn k\nend\nend\nend\nfunction table.insertafter(tbl, after, value)\nlocal i = table.indexof(tbl, after)\nif i then\ntable.insert(tbl, i + 1, value)\nelse\ntable.insert(tbl, value)\nend\nend\nfunction table.insertflat(tbl, values)\nif values == nil then\nreturn\nelseif type(values) == \"table\" then\nfor _, value in ipairs(values) do\ntable.insertflat(tbl, value)\nend\nelse\ntable.insert(tbl, values)\nend\nreturn tbl\nend\nfunction table.insertkeyed(tbl, pos, value)\nif value == nil then\nvalue = pos\npos = #tbl + 1\nend\ntable.insert(tbl, pos, value)\ntbl[value] = value\nend\nfunction table.insertsorted(tbl, value, fn)\nif value == nil then\nreturn\nelse\nfn = fn or function(a, b) return a < b end\nlocal minindex = 1\nlocal maxindex = #tbl + 1\nwhile minindex < maxindex do\nlocal index = minindex + bit32.arshift(maxindex - minindex, 1)\nlocal test = tbl[index]\nif fn(value, test) then\nmaxindex = index\nelse\nminindex = index + 1\nif not fn(test, value) then\nbreak\nend\nend\nend\ntable.insert(tbl, minindex, value)\nend\nreturn tbl\nend\nfunction table.isempty(t)\nreturn next(t) == nil\nend\nfunction table.join(...)\nlocal result = { }\nlocal arg = {...}\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor _,v in ipairs(t) do\ntable.insert(result, v)\nend\nelse\ntable.insert(result, t)\nend\nend\nreturn result\nend\nfunction table.keys(tbl)\nlocal keys = {}\nfor k, _ in pairs(tbl) do\ntable.insert(keys, k)\nend\nreturn keys\nend\nfunction table.merge(...)\nlocal result = {}\nlocal arg = {...}\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor k,v in pairs(t) do\nif type(result[k]) == \"table\" and type(v) == \"table\" then\nresult[k] = table.merge(result[k], v)\nelse\nresult[k] = v\nend\nend\nelse\nerror(\"invalid value\")\nend\nend\nreturn result\nend\nfunction table.replace(self, value, replacement)\nfor i = 1, #self do\nif self[i] == value then\nself[i] = replacement\nend\nend\nend\nfunction table.translate(arr, translation)\nif not translation then return {} end\nlocal result = {}\nfor _, value in ipairs(arr) do\nlocal tvalue\nif type(translation) == \"function\" then\ntvalue = translation(value)\nelse\ntvalue = translation[value]\nend\nif (tvalue) then"
	"\ntable.insert(result, tvalue)\nend\nend\nreturn result\nend\nfunction table.tostring(tab, recurse, indent)\nlocal res = ''\nif not indent then\nindent = 0\nend\nlocal format_value = function(k, v, i)\nformatting = string.rep(\"\\t\", i)\nif k then\nif type(k) == \"table\" then\nk = '[table]'\nend\nformatting = formatting .. k .. \": \"\nend\nif not v then\nreturn formatting .. '(nil)'\nelseif type(v) == \"table\" then\nif recurse then\nreturn formatting .. '\\n' .. table.tostring(v, recurse, i+1)\nelse\nreturn formatting .. \"<table>\"\nend\nelseif type(v) == \"function\" then\nreturn formatting .. tostring(v)\nelseif type(v) == \"userdata\" then\nreturn formatting .. \"<userdata>\"\nelseif type(v) == \"boolean\" then\nif v then\nreturn formatting .. 'true'\nelse\nreturn formatting .. 'false'\nend\nelse\nreturn formatting .. v\nend\nend\nif type(tab) == \"table\" then\nlocal first = true\nfor k, v in pairs(tab) do\nif not first then\nres = res .. '\\n'\nend\nres = res .. format_value(k, v, indent)\nfirst = false\nend\nelse\nres = res .. format_value(nil, tab, indent)\nend\nreturn res\nend\nfunction table.unique(tab)\nlocal elems = { }\nlocal result = { }\ntable.foreachi(tab, function(elem)\nif not elems[elem] then\ntable.insert(result, elem)\nelems[elem] = true\nend\nend)\nreturn result\nend\nfunction table.filterempty(dirs)\nreturn table.translate(dirs, function(val)\nif val and #val > 0 then\nreturn val\nelse\nreturn nil\nend\nend)\nend\n",

	"function path.appendExtension(p, ext)\nif not ext or ext == \"\" then\nreturn p\nend\nlocal endquote\nif p:endswith('\"') then\np = p:sub(1, -2)\nendquote = '\"'\nend\nif not p:endswith(ext) then\np = p .. ext\nend\nif endquote then\np = p .. endquote\nend\nreturn p\nend\npath.appendextension = path.appendExtension\nfunction path.getbasename(p)\nlocal name = path.getname(p)\nlocal i = name:findlast(\".\", true)\nif (i) then\nreturn name:sub(1, i - 1)\nelse\nreturn name\nend\nend\nfunction path.getdirectory(p)\nlocal i = p:findlast(\"/\", true)\nif (i) then\nif i > 1 then i = i - 1 end\nreturn p:sub(1, i)\nelse\nreturn \".\"\nend\nend\nfunction path.getdrive(p)\nlocal ch1 = p:sub(1,1)\nlocal ch2 = p:sub(2,2)\nif ch2 == \":\" then\nreturn ch1\nend\nend\nfunction path.getextension(p)\nlocal i = p:findlast(\".\", true)\nif (i) then\nreturn p:sub(i)\nelse\nreturn \"\"\nend\nend\nfunction path.getname(p)\nlocal i = p:findlast(\"[/\\\\]\")\nif (i) then\nreturn p:sub(i + 1)\nelse\nreturn p\nend\nend\nfunction path.hasextension(fname, extensions)\nlocal fext = path.getextension(fname):lower()\nif type(extensions) == \"table\" then\nfor _, extension in pairs(extensions) do\nif fext == extension then\nreturn true\nend\nend\nreturn false\nelse\nreturn (fext == extensions)\nend\nend\nfunction path.iscfile(fname)\nreturn path.hasextension(fname, { \".c\", \".s\", \".m\" })\nend\nfunction path.iscppfile(fname)\nreturn path.hasextension(fname, { \".cc\", \".cpp\", \".cxx\", \".c\", \".s\", \".m\", \".mm\" })\nend\nfunction path.iscppheader(fname)\nreturn path.hasextension(fname, { \".h\", \".hh\", \".hpp\", \".hxx\" })\nend\nfunction path.isframework(fname)\nreturn path.hasextension(fname, \".framework\")\nend\nfunction path.islinkable(fname)\nreturn path.hasextension(fname, { \".o\", \".obj\", \".a\", \".lib\", \".so\" })\nend\nfunction path.isobjectfile(fname)\nreturn path.hasextension(fname, { \".o\", \".obj\" })\nend\nfunction path.isresourcefile(fname)\nreturn path.hasextension(fname, \".rc\")\nend\nfunction path.isidlfile(fname)\nreturn path.hasextension(fname, \".idl\")\nend\nfunction path.rebase(p, oldbase, newbase)\np = path.getabsolute(path.join(oldbase, p))\np = path.getrelative(newbase, p)\nreturn p\nend\nfunction path.replaceextension(p, newext)\nlocal ext = path.getextension(p)\nif not ext then\nreturn p\nend\nif not newext:findlast(\".\", true) then\nnewext = \".\"..newext\nend\nreturn p:match(\"^(.*)\"..ext..\"$\")..newext\nend\nfunction path.wildcards(pattern)\npattern = pattern:gsub(\"([%+%.%-%^%$%(%)%%])\", \"%%%1\")\npattern = pattern:gsub(\"%*%*\", \"\\001\")\npattern = pattern:gsub(\"%*\", \"\\002\")\npattern = pattern:gsub(\"\\001\", \".*\")\npattern = pattern:gsub(\"\\002\", \"[^/]*\")\nreturn pattern\nend\n",

	"premake.override(os, \"execute\", function(base, cmd)\ncmd = path.normalize(cmd)\ncmd = os.translateCommands(cmd)\nreturn base(cmd)\nend)\nfunction os.executef(cmd, ...)\ncmd = string.format(cmd, ...)\nreturn os.execute(cmd)\nend\nlocal function parse_ld_so_conf(conf_file)\nlocal first, last\nlocal dirs = { }\nfor line in io.lines(conf_file) do\nfirst = line:find(\"#\", 1, true)\nif first ~= nil then\nline = line:sub(1, first - 1)\nend\nif line ~= \"\" then\nfirst, last = line:find(\"include%s+\")\nif first ~= nil then\nlocal include_glob = line:sub(last + 1)\nlocal includes = os.matchfiles(include_glob)\nfor _, v in ipairs(includes) do\ndirs = table.join(dirs, parse_ld_so_conf(v))\nend\nelse\ntable.insert(dirs, line)\nend\nend\nend\nreturn dirs\nend\nfunction os.findlib(libname, libdirs)\nlocal path, formats\nif os.is(\"windows\") then\nformats = { \"%s.dll\", \"%s\" }\npath = os.getenv(\"PATH\") or \"\"\nelseif os.is(\"haiku\") then\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LIBRARY_PATH\") or \"\"\nelse\nif os.is(\"macosx\") then\nformats = { \"lib%s.dylib\", \"%s.dylib\" }\npath = os.getenv(\"DYLD_LIBRARY_PATH\") or \"\"\nelse\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LD_LIBRARY_PATH\") or \"\"\nfor _, prefix in ipairs({\"\", \"/opt\"}) do\nlocal conf_file = prefix .. \"/etc/ld.so.conf\"\nif os.isfile(conf_file) then\nfor _, v in ipairs(parse_ld_so_conf(conf_file)) do\nif (#path > 0) then\npath = path .. \":\" .. v\nelse\npath = v\nend\nend\nend\nend\nend\ntable.insert(formats, \"%s\")\npath = path or \"\"\nlocal archpath = \"/lib:/usr/lib:/usr/local/lib\"\nif os.is64bit() then\narchpath = \"/lib64:/usr/lib64/:usr/local/lib64\" .. \":\" .. archpath\nend\nif (#path > 0) then\npath = path .. \":\" .. archpath\nelse\npath = archpath\nend\nend\nlocal userpath = \"\"\nif type(libdirs) == \"string\" then\nuserpath = libdirs\nelseif type(libdirs) == \"table\" then\nuserpath = table.implode(libdirs, \"\", \"\", \":\")\nend\nif (#userpath > 0) then\nif (#path > 0) then\npath = userpath .. \":\" .. path\nelse\npath = userpath\nend\nend\nfor _, fmt in ipairs(formats) do\nlocal name = string.format(fmt, libname)\nlocal result = os.pathsearch(name, path)\nif result then return result end\nend\nend\nfunction os.get()\nreturn _OPTIONS.os or _OS\nend\nfunction os.is(id)\nreturn (os.get():lower() == id:lower())\nend\npremake.override(os, \"isdir\", function(base, p)\np = path.normalize(p)\nreturn base(p)\nend)\npremake.override(os, \"isfile\", function(base, p)\np = path.normalize(p)\nreturn base(p)\nend)\nlocal _is64bit\nlocal _64BitHostTypes = {\n\"x86_64\",\n\"ia64\",\n\"amd64\",\n\"ppc64\",\n\"powerpc64\",\n\"sparc64\"\n}\nfunction os.is64bit()\nif _is64bit ~= nil then\nreturn _is64bit\nend\n_is64bit = false\nif (os._is64bit()) then\n_is64bit = true\nelse\nlocal arch\nif _OS == \"windows\" then\narch = os.getenv(\"PROCESSOR_ARCHITECTURE\")\nelseif _OS == \"macosx\" then\narch = os.outputof(\"echo $HOSTTYPE\")\nelse\narch = os.outputof(\"uname -m\")\nend\narch = arch:lower()\nfor _, hosttype in ipairs(_64BitHostTypes) do\nif arch:find(hosttype) then\n_is64bit = true\nend\nend\nend\nreturn _is64bit\nend\nfunction os.match(mask)\nmask = path.normalize(mask)\nlocal starpos = mask:find(\"%*\")\nlocal before = path.getdirectory(starpos and mask:sub(1, starpos - 1) or mask)\nlocal slashpos = starpos and mask:find(\"/\", starpos)\nlocal after = slashpos and mask:sub(slashpos + 1)\nlocal recurse = starpos and\nmask:sub(starpos + 1, starpos + 1) == '*' and\n(starpos == 1 or mask:sub(starpos - 1, starpos - 1) == '/')\nlocal results = { }\nif recurse then\nlocal submask = mask:sub(1, starpos) .. mask:sub(starpos + 2)\nresults = os.match(submask)\nlocal pattern = mask:sub(1, starpos)\nlocal m = os.matchstart(pattern)\nwhile os.matchnext(m) do\nif not os.matchisfile(m) then\nlocal matchpath = path.join(before, os.matchname(m), mask:sub(starpos))\nresults = table.join(results, os.match(matchpath, after))\nend\nend\nos.matchdone(m)\nelse\nlocal pattern = mask:sub(1, slashpos and slashpos - 1)\nlocal m = os.matchst"
	"art(pattern)\nwhile os.matchnext(m) do\nif not (slashpos and os.matchisfile(m)) then\nlocal matchpath = path.join(before, matchpath, os.matchname(m))\nif after then\nresults = table.join(results, os.match(path.join(matchpath, after)))\nelse\ntable.insert(results, matchpath)\nend\nend\nend\nos.matchdone(m)\nend\nreturn results\nend\nfunction os.matchdirs(mask)\nlocal results = os.match(mask)\nfor i = #results, 1, -1 do\nif not os.isdir(results[i]) then\ntable.remove(results, i)\nend\nend\nreturn results\nend\nfunction os.matchfiles(mask)\nlocal results = os.match(mask)\nfor i = #results, 1, -1 do\nif not os.isfile(results[i]) then\ntable.remove(results, i)\nend\nend\nreturn results\nend\nlocal builtin_mkdir = os.mkdir\nfunction os.mkdir(p)\np = path.normalize(p)\nlocal dir = iif(p:startswith(\"/\"), \"/\", \"\")\nfor part in p:gmatch(\"[^/]+\") do\ndir = dir .. part\nif (part ~= \"\" and not path.isabsolute(part) and not os.isdir(dir)) then\nlocal ok, err = builtin_mkdir(dir)\nif (not ok) then\nreturn nil, err\nend\nend\ndir = dir .. \"/\"\nend\nreturn true\nend\nfunction os.outputof(cmd)\ncmd = path.normalize(cmd)\nlocal pipe = io.popen(cmd)\nlocal result = pipe:read('*a')\nlocal b, exitcode = pipe:close()\nif not b then\nexitcode = -1\nend\nif result then\nresult = string.gsub(result, \"[\\r\\n]+$\", \"\")\nend\nreturn result, exitcode\nend\nlocal builtin_remove = os.remove\nfunction os.remove(f)\nif type(f) == \"string\" then\nlocal p = os.matchfiles(f)\nfor _, v in pairs(p) do\nlocal ok, err = builtin_remove(v)\nif not ok then\nreturn ok, err\nend\nend\nelseif type(f) == \"table\" then\nfor _, v in pairs(f) do\nlocal ok, err = os.remove(v)\nif not ok then\nreturn ok, err\nend\nend\nend\nend\nlocal builtin_rmdir = os.rmdir\nfunction os.rmdir(p)\nlocal dirs = os.matchdirs(p .. \"/*\")\nfor _, dname in ipairs(dirs) do\nos.rmdir(dname)\nend\nlocal files = os.matchfiles(p .. \"/*\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nbuiltin_rmdir(p)\nend\npremake.override(os, \"stat\", function(base, p)\np = path.normalize(p)\nreturn base(p)\nend)\nos.commandTokens = {\n_ = {\nchdir = function(v)\nreturn \"cd \" .. v\nend,\ncopy = function(v)\nreturn \"cp -rf \" .. v\nend,\ndelete = function(v)\nreturn \"rm -f \" .. v\nend,\necho = function(v)\nreturn \"echo \" .. v\nend,\nmkdir = function(v)\nreturn \"mkdir -p \" .. v\nend,\nmove = function(v)\nreturn \"mv -f \" .. v\nend,\nrmdir = function(v)\nreturn \"rm -rf \" .. v\nend,\ntouch = function(v)\nreturn \"touch \" .. v\nend,\n},\nwindows = {\nchdir = function(v)\nreturn \"chdir \" .. path.translate(v)\nend,\ncopy = function(v)\nv = path.translate(v)\nlocal src = string.match(v, '^\".-\"') or string.match(v, '^.- ') or v\nsrc = string.match(src, '^.*%S')\nreturn \"IF EXIST \" .. src .. \"\\\\ (xcopy /Q /E /Y /I \" .. v .. \" > nul) ELSE (xcopy /Q /Y /I \" .. v .. \" > nul)\"\nend,\ndelete = function(v)\nreturn \"del \" .. path.translate(v)\nend,\necho = function(v)\nreturn \"echo \" .. v\nend,\nmkdir = function(v)\nreturn \"mkdir \" .. path.translate(v)\nend,\nmove = function(v)\nreturn \"move /Y \" .. path.translate(v)\nend,\nrmdir = function(v)\nreturn \"rmdir /S /Q \" .. path.translate(v)\nend,\ntouch = function(v)\nv = path.translate(v)\nreturn string.format(\"type nul >> %s && copy /b %s+,, %s\", v, v, v)\nend,\n}\n}\nfunction os.translateCommands(cmd, map)\nmap = map or os.get()\nif type(map) == \"string\" then\nmap = os.commandTokens[map] or os.commandTokens[\"_\"]\nend\nlocal processOne = function(cmd)\nlocal token = cmd:match(\"^{.+}\")\nif token then\ntoken = token:sub(2, #token - 1):lower()\nlocal args = cmd:sub(#token + 4)\nlocal func = map[token] or os.commandTokens[\"_\"][token]\nif func then\ncmd = func(args)\nend\nend\nreturn cmd\nend\nif type(cmd) == \"table\" then\nlocal result = {}\nfor i = 1, #cmd do\nresult[i] = processOne(cmd[i])\nend\nreturn result\nelse\nreturn processOne(cmd)\nend\nend\nos._uuids = {}\nlocal builtin_uuid = os.uuid\nfunction os.uuid(name)\nlocal id = builtin_uuid(name)\nif name then\nif os._uuids[id] and os._uuids[id] ~= name t"
	"hen\npremake.warnOnce(id, \"UUID clash between %s and %s\", os._uuids[id], name)\nend\nos._uuids[id] = name\nend\nreturn id\nend\n",

	"premake.override(io, \"open\", function(base, fname, mode)\nif mode and (mode:find(\"w\") or mode:find(\"a\"))  then\nlocal dir = path.getdirectory(fname)\nok, err = os.mkdir(dir)\nif not ok then\nerror(err, 0)\nend\nend\nreturn base(fname, mode)\nend)\n",

	"local p = premake\np.tools = {}\nfunction p.tools.canonical(identifier)\nlocal parts\nif identifier:startswith(\"v\") then -- TODO: this should be deprecated?\nparts = { \"msc\", identifier }\nelse\nparts = identifier:explode(\"-\", true, 1)\nif parts[2] ~= nil then\nif parts[1] == \"msc\" and tonumber(parts[2]:sub(1,3)) ~= nil then\nparts[2] = \"v\" .. parts[2]\nend\nif parts[2]:startswith(\"llvm-vs\") then\nparts[2] = \"LLVM-\" .. parts[2]:sub(6)\nend\nend\nend\nreturn p.tools[parts[1]], parts[2]\nend\n",

	"premake.tree = {}\nlocal tree = premake.tree\nfunction tree.new(n)\nlocal t = {\nname = n,\nchildren = {}\n}\nreturn t\nend\nfunction tree.add(tr, p, extraFields)\nif p == \".\" or p == \"/\" then\nreturn tr\nend\nlocal parentnode = tree.add(tr, path.getdirectory(p), extraFields)\nlocal childname = path.getname(p)\nlocal childnode = parentnode.children[childname]\nif not childnode or childnode.path ~= p then\nchildnode = tree.insert(parentnode, tree.new(childname))\nchildnode.path = p\nif extraFields then\nfor k,v in pairs(extraFields) do\nchildnode[k] = v\nend\nend\nend\nreturn childnode\nend\nfunction tree.insert(parent, child)\ntable.insert(parent.children, child)\nif child.name then\nparent.children[child.name] = child\nend\nchild.parent = parent\nreturn child\nend\nfunction tree.getlocalpath(node)\nif node.parent.path then\nreturn node.name\nelseif node.cfg then\nreturn node.cfg.name\nelse\nreturn node.path\nend\nend\nfunction tree.hasbranches(tr)\nlocal n = #tr.children\nif n > 0 then\nfor i = 1, n do\nif #tr.children[i].children > 0 then\nreturn true\nend\nend\nend\nreturn false\nend\nfunction tree.isparent(n, child)\nlocal p = child.parent\nwhile p do\nif p == n then\nreturn true\nend\np = p.parent\nend\nreturn false\nend\nfunction tree.remove(node)\nlocal children = node.parent.children\nfor i = 1, #children do\nif children[i] == node then\ntable.remove(children, i)\nend\nend\nnode.children = {}\nend\nfunction tree.sort(tr, fn)\nif not fn then\nfn = function(a,b) return a.name < b.name end\nend\ntree.traverse(tr, {\nonnode = function(node)\ntable.sort(node.children, fn)\nend\n}, true)\nend\nfunction tree.traverse(t, fn, includeroot, initialdepth)\nlocal donode, dochildren\ndonode = function(node, fn, depth)\nif node.isremoved then\nreturn\nend\nif fn.onnode then\nfn.onnode(node, depth)\nend\nif #node.children > 0 then\nif fn.onbranchenter then\nfn.onbranchenter(node, depth)\nend\nif fn.onbranch then\nfn.onbranch(node, depth)\nend\ndochildren(node, fn, depth + 1)\nif fn.onbranchexit then\nfn.onbranchexit(node, depth)\nend\nelse\nif fn.onleaf then\nfn.onleaf(node, depth)\nend\nend\nend\ndochildren = function(parent, fn, depth)\nlocal i = 1\nwhile i <= #parent.children do\nlocal node = parent.children[i]\ndonode(node, fn, depth)\nif node == parent.children[i] then\ni = i + 1\nend\nend\nend\nif not initialdepth then\ninitialdepth = 0\nend\nif includeroot then\ndonode(t, fn, initialdepth)\nelse\ndochildren(t, fn, initialdepth)\nend\nend\nfunction tree.trimroot(tr)\nlocal trimmed\nwhile #tr.children == 1 do\nlocal node = tr.children[1]\nif #node.children == 0 or node.trim == false then\nbreak\nend\ntrimmed = true\nlocal numChildren = #node.children\nfor i = 1, numChildren do\nlocal child = node.children[i]\nchild.parent = node.parent\ntr.children[i] = child\nend\nend\nlocal dotdot\nlocal count = #tr.children\nrepeat\ndotdot = false\nfor i = 1, count do\nlocal node = tr.children[i]\nif node.name == \"..\" and #node.children == 1 then\nlocal child = node.children[1]\nchild.parent = node.parent\ntr.children[i] = child\ntrimmed = true\ndotdot = true\nend\nend\nuntil not dotdot\nif trimmed then\ntree.traverse(tr, {\nonnode = function(node)\nif node.parent.path then\nnode.path = path.join(node.parent.path, node.name)\nelse\nnode.path = node.name\nend\nend\n}, false)\nend\nend\n",

	"function dofileopt(fname)\nif type(fname) == \"string\" then fname = {fname} end\nfor i = 1, #fname do\nlocal found = os.locate(fname[i])\nif not found then\nfound = os.locate(fname[i] .. \".lua\")\nend\nif found then\ndofile(found)\nreturn true\nend\nend\nend\nio._includedFiles = {}\nfunction include(fname)\nlocal fullPath = premake.findProjectScript(fname)\nfname = fullPath or fname\nif not io._includedFiles[fname] then\nio._includedFiles[fname] = true\nreturn dofile(fname)\nend\nend\npremake.override(_G, \"require\", function(base, modname, versions)\nlocal result, mod = pcall(base,modname)\nif not result then\nerror( mod, 3 )\nend\nif mod and versions and not premake.checkVersion(mod._VERSION, versions) then\nerror(string.format(\"module %s %s does not meet version criteria %s\",\nmodname, mod._VERSION or \"(none)\", versions), 3)\nend\nreturn mod\nend)\n",

	"premake.field = {}\nlocal field = premake.field\nfield._list = {}\nfield._loweredList = {}\nfield._sortedList = nil\nfield._kinds = {}\npremake.fields = field._list\nfield._accessors = {}\nfunction field.new(f)\nif f.kind:startswith(\"key-\") then\nf.kind = f.kind:sub(5)\nf.keyed = true\nend\nif f.kind:endswith(\"-list\") then\nf.kind = f.kind:sub(1, -6)\nf.list = true\nend\nlocal kind = f.kind\nif kind == \"object\" or kind == \"array\" then\nkind = \"table\"\nend\nif f.list then\nkind = \"list:\" .. kind\nend\nif f.keyed then\nkind = \"keyed:\" .. kind\nend\nf._kind = kind\nif type(f.scope) == \"table\" then\nf.scopes = f.scope\nelse\nf.scopes = { f.scope }\nend\nif not field.accessor(f, \"store\") then\nreturn nil, \"invalid field kind '\" .. f._kind .. \"'\"\nend\nfield._list[f.name] = f\nfield._loweredList[f.name:lower()] = f\nfield._sortedList = nil\nreturn f\nend\nfunction field.unregister(f)\nfield._list[f.name] = nil\nfield._loweredList[f.name:lower()] = nil\nfield._sortedList = nil\nend\nfunction field.each()\nlocal index\nreturn function ()\nindex = next(field._list, index)\nreturn field._list[index]\nend\nend\nfunction field.eachOrdered()\nif not field._sortedList then\nlocal keys = table.keys(field._list)\ntable.sort(keys)\nfield._sortedList = {}\nfor i = 1, #keys do\nfield._sortedList[i] = field._list[keys[i]]\nend\nend\nlocal i = 0\nreturn function ()\ni = i + 1\nreturn field._sortedList[i]\nend\nend\nfunction field.kind(tag, settings)\nif settings then\nfield._kinds[tag] = settings\nend\nreturn field._kinds[tag]\nend\nfunction field.accessor(f, method)\nfield._accessors[method] = field._accessors[method] or {}\nlocal cache = field._accessors[method]\nlocal function accessorForKind(kind)\nif kind == \"\" then\nreturn nil\nend\nif cache[kind] then\nreturn cache[kind]\nend\nlocal thisKind = kind:match('(.-):') or kind\nlocal nextKind = kind:sub(#thisKind + 2)\nlocal functions = field._kinds[thisKind]\nif not functions then\nreturn nil, \"Invalid field kind '\" .. thisKind .. \"'\"\nend\nlocal processor = functions[method]\nif not processor then\nreturn nil\nend\nlocal nextAccessor = accessorForKind(nextKind)\naccessor = function(f, current, value)\nreturn processor(f, current, value, nextAccessor)\nend\ncache[kind] = accessor\nreturn accessor\nend\nreturn accessorForKind(f._kind)\nend\nfunction field.compare(f, a, b)\nlocal processor = field.accessor(f, \"compare\")\nif processor then\nreturn processor(f, a, b)\nelse\nreturn (a == b)\nend\nend\nfunction field.get(name)\nreturn field._list[name] or field._loweredList[name:lower()]\nend\nfunction field.merge(f, current, value)\nlocal processor = field.accessor(f, \"merge\")\nif processor then\nreturn processor(f, current, value)\nelse\nreturn value\nend\nend\nfunction field.merges(f)\nreturn (field.accessor(f, \"merge\") ~= nil)\nend\nfunction field.property(f, tag)\nlocal kinds = string.explode(f._kind, \":\", true)\nfor i, kind in ipairs(kinds) do\nlocal value = field._kinds[kind][tag]\nif value ~= nil then\nreturn value\nend\nend\nend\nfunction field.override(fieldName, accessorName, func)\nlocal kind = field.kind(fieldName)\npremake.override(kind, accessorName, func)\nfield._accessors = {}\nend\nfunction field.remove(f, current, value)\nlocal processor = field.accessor(f, \"remove\")\nif processor then\nreturn processor(f, current, value)\nelse\nreturn value\nend\nend\nfunction field.removes(f)\nreturn (field.accessor(f, \"merge\") ~= nil and field.accessor(f, \"remove\") ~= nil)\nend\nfunction field.store(f, current, value)\nlocal processor = field.accessor(f, \"store\")\nif processor then\nreturn processor(f, current, value)\nelse\nreturn value\nend\nend\nfunction field.translate(f, value)\nlocal processor = field.accessor(f, \"translate\")\nif processor then\nreturn processor(f, value, nil)[1]\nelse\nreturn value\nend\nend\nfunction field.translates(f)\nreturn (field.accessor(f, \"translate\") ~= nil)\nend\n",

	"local p = premake\np.criteria = criteria  -- criteria namespace is defined in C host\nlocal criteria = p.criteria\ncriteria._validPrefixes = {\n_action = true,\naction = true,\narchitecture = true,\nconfigurations = true,\nfiles = true,\nkind = true,\nlanguage = true,\n_options = true,\noptions = true,\nplatforms = true,\nsystem = true,\n}\nfunction criteria.new(terms, unprefixed)\nterms = table.flatten(terms)\nlocal patterns = {}\nfor i, term in ipairs(terms) do\nterm = term:lower()\nlocal pattern = {}\nlocal prefix = iif(unprefixed, nil, \"configurations\")\nlocal words = term:explode(\" or \")\nfor _, word in ipairs(words) do\nword, prefix = criteria._word(word, prefix)\nif prefix and not criteria._validPrefixes[prefix] then\nreturn nil, string.format(\"Invalid field prefix '%s'\", prefix)\nend\nif prefix then\nlocal fld = p.field.get(prefix)\nif fld and fld.aliases then\nword[1] = fld.aliases[word[1]] or word[1]\nend\nend\ntable.insert(pattern, word)\nend\ntable.insert(patterns, pattern)\nend\nlocal crit = {}\ncrit.patterns = patterns\ncrit.data = criteria._compile(patterns)\nreturn crit\nend\nfunction criteria._word(word, prefix)\nlocal wildcard\nlocal assertion = true\nwhile (true) do\nif word:startswith(\"not \") then\nassertion = not assertion\nword = word:sub(5)\nelse\nlocal i = word:find(\":\", 1, true)\nif prefix and i then\nprefix = word:sub(1, i - 1)\nword = word:sub(i + 1)\nelse\nwildcard = (word:find(\"*\", 1, true) ~= nil)\nif wildcard then\nword = path.wildcards(word)\nend\nbreak\nend\nend\nend\nreturn { word, prefix, assertion, wildcard }, prefix\nend\nfunction criteria.allowPrefix(prefix)\ncriteria._validPrefixes[prefix:lower()] = true\nend\n",

	"premake.detoken = {}\nlocal p = premake\nlocal detoken = p.detoken\nfunction detoken.expand(value, environ, field, basedir)\nfield = field or {}\nlocal varMap = {}\nif field.pathVars then\nlocal action = p.action.current()\nif action then\nvarMap = action.pathVars or {}\nend\nend\nsetmetatable(environ, {__index = _G})\nfunction expandtoken(token, environ)\nlocal func, err = loadstring(\"return \" .. token)\nif not func then\nreturn nil, err\nend\nsetfenv(func, environ)\nlocal result = func() or \"\"\nlocal isAbs = path.isabsolute(result)\nif isAbs and not field.paths and basedir then\nresult = path.getrelative(basedir, result)\nend\nif varMap[token] then\nresult = varMap[token]\nif type(result) == \"function\" then\nresult = result(environ)\nend\nisAbs = path.isabsolute(result)\nend\nif isAbs and field.paths then\nresult = \"\\0\" .. result\nend\nreturn result\nend\nfunction expandvalue(value)\nif type(value) ~= \"string\" then\nreturn value\nend\nlocal count\nrepeat\nvalue, count = value:gsub(\"%%{(.-)}\", function(token)\nlocal result, err = expandtoken(token:gsub(\"\\\\\", \"\\\\\\\\\"), environ)\nif not result then\nerror(err, 0)\nend\nreturn result\nend)\nuntil count == 0\nif field.paths then\nlocal i, j\nrepeat\ni, j = value:find(\"\\0\")\nif i then\nvalue = value:sub(i + 1)\nend\nuntil not i\nend\nreturn value\nend\nfunction recurse(value)\nif type(value) == \"table\" then\nlocal res_table = {}\nfor k, v in pairs(value) do\nif tonumber(k) ~= nil then\nres_table[k] = recurse(v, e)\nelse\nlocal nk = recurse(k, e);\nres_table[nk] = recurse(v, e)\nend\nend\nreturn res_table\nelse\nreturn expandvalue(value)\nend\nend\nreturn recurse(value)\nend\n",

	"local p = premake\np.configset = {}\nlocal configset = p.configset\nlocal criteria = p.criteria\nfunction configset.new(parent)\nlocal cset = {}\ncset.parent = parent\ncset.blocks = {}\ncset.current = nil\ncset.compiled = false\nreturn cset\nend\nfunction configset.fetch(cset, field, filter, ctx, origin)\nfilter = filter or {}\nctx = ctx or {}\nif p.field.merges(field) then\nreturn configset._fetchMerged(cset, field, filter, ctx, origin)\nelse\nreturn configset._fetchDirect(cset, field, filter, ctx, origin)\nend\nend\nfunction configset._fetchDirect(cset, field, filter, ctx, origin)\nif origin and origin ~= cset and not origin.compiled then\nreturn configset._fetchDirect(origin, field, filter, ctx, origin)\nend\nlocal abspath = filter.files\nlocal basedir\nlocal key = field.name\nlocal blocks = cset.blocks\nlocal n = #blocks\nfor i = n, 1, -1 do\nlocal block = blocks[i]\nif not origin or block._origin == origin then\nlocal value = block[key]\nif value ~= nil and abspath and not cset.compiled and block._basedir and block._basedir ~= basedir then\nbasedir = block._basedir\nfilter.files = path.getrelative(basedir, abspath)\nend\nif value ~= nil and (cset.compiled or criteria.matches(block._criteria, filter)) then\nif type(value) == \"table\" then\nvalue = table.deepcopy(value)\nend\nif field.tokens and ctx.environ then\nvalue = p.detoken.expand(value, ctx.environ, field, ctx._basedir)\nend\nreturn value\nend\nend\nend\nfilter.files = abspath\nif cset.parent then\nreturn configset._fetchDirect(cset.parent, field, filter, ctx, origin)\nend\nend\nfunction configset._fetchMerged(cset, field, filter, ctx, origin)\nif origin and origin ~= cset and not origin.compiled then\nreturn configset._fetchMerged(origin, field, filter, ctx, origin)\nend\nlocal result = {}\nlocal function remove(patterns)\nfor _, pattern in ipairs(patterns) do\nif field.tokens and ctx.environ then\npattern = p.detoken.expand(pattern, ctx.environ, field, ctx._basedir)\nend\npattern = path.wildcards(pattern):lower()\nlocal j = 1\nwhile j <= #result do\nlocal value = result[j]:lower()\nif value:match(pattern) == value then\nresult[result[j]] = nil\ntable.remove(result, j)\nelse\nj = j + 1\nend\nend\nend\nend\nif cset.parent then\nresult = configset._fetchMerged(cset.parent, field, filter, ctx, origin)\nend\nlocal abspath = filter.files\nlocal basedir\nlocal key = field.name\nlocal blocks = cset.blocks\nlocal n = #blocks\nfor i = 1, n do\nlocal block = blocks[i]\nif not origin or block._origin == origin then\nif abspath and block._basedir and block._basedir ~= basedir and not cset.compiled then\nbasedir = block._basedir\nfilter.files = path.getrelative(basedir, abspath)\nend\nif cset.compiled or criteria.matches(block._criteria, filter) then\nif block._removes and block._removes[key] then\nremove(block._removes[key])\nend\nlocal value = block[key]\nif type(value) == \"table\" then\nvalue = table.deepcopy(value)\nend\nif value then\nif field.tokens and ctx.environ then\nvalue = p.detoken.expand(value, ctx.environ, field, ctx._basedir)\nend\nif field and p.field.translates(field) then\nvalue = p.field.translate(field, value)\nend\nresult = p.field.merge(field, result, value)\nend\nend\nend\nend\nfilter.files = abspath\nreturn result\nend\nfunction configset.metatable(cset)\nreturn {\n__newindex = function(tbl, key, value)\nlocal f = p.field.get(key)\nif f then\nlocal status, err = configset.store(cset, f, value)\nif err then\nerror(err, 2)\nend\nelse\nrawset(tbl, key, value)\nreturn value\nend\nend,\n__index = function(tbl, key)\nlocal f = p.field.get(key)\nif f then\nreturn configset.fetch(cset, f)\nelse\nreturn nil\nend\nend\n}\nend\nfunction configset.addblock(cset, terms, basedir)\nconfigset.addFilter(cset, terms, basedir, true)\nreturn cset.current\nend\nfunction configset.addFilter(cset, terms, basedir, unprefixed)\nlocal crit, err = criteria.new(terms, unprefixed)\nif not crit then\nreturn nil, err\nend\nlocal block = {}\nblock._criteria = crit\nblock._origin = cset\nif basedir then\nblock._basedir = basedir:lower()\nend\ntable.insert(cset.blocks, block)\ncs"
	"et.current = block\nreturn true\nend\nfunction configset.getFilter(cset)\nreturn {\n_criteria = cset.current._criteria,\n_basedir = cset.current._basedir\n}\nend\nfunction configset.setFilter(cset, filter)\nlocal block = {}\nblock._criteria = filter._criteria\nblock._basedir = filter._basedir\nblock._origin = cset\ntable.insert(cset.blocks, block)\ncset.current = block;\nend\nfunction configset.store(cset, field, value)\nif not cset.current then\nconfigset.addblock(cset, {})\nend\nlocal key = field.name\nlocal current = cset.current\nlocal status, result = pcall(function ()\ncurrent[key] = p.field.store(field, current[key], value)\nend)\nif not status then\nif type(result) == \"table\" then\nresult = result.msg\nend\nreturn nil, result\nend\nreturn true\nend\nfunction configset.remove(cset, field, values)\nlocal block = {}\nblock._basedir = cset.current._basedir\nblock._criteria = cset.current._criteria\nblock._origin = cset\ntable.insert(cset.blocks, block)\ncset.current = block\nvalues = p.field.remove(field, {}, values)\ncurrent = cset.current\ncurrent._removes = {}\ncurrent._removes[field.name] = values\nend\nfunction configset.empty(cset)\nreturn (#cset.blocks == 0)\nend\nfunction configset.compile(cset, filter)\nlocal result\nif cset.parent then\nresult = configset.compile(cset.parent, filter)\nelse\nresult = configset.new()\nend\nlocal blocks = cset.blocks\nlocal n = #blocks\nlocal abspath = filter.files\nlocal basedir\nfor i = 1, n do\nlocal block = blocks[i]\nif block._origin == cset then\nblock._origin = result\nend\nif abspath and block._basedir and block._basedir ~= basedir then\nbasedir = block._basedir\nfilter.files = path.getrelative(basedir, abspath)\nend\nif criteria.matches(block._criteria, filter) then\ntable.insert(result.blocks, block)\nend\nend\nfilter.files = abspath\nresult.compiled = true\nreturn result\nend\n",

	"local p = premake\np.context = {}\nlocal context = p.context\nlocal configset = p.configset\nfunction context.new(cfgset, environ)\nlocal ctx = {}\nctx._cfgset = cfgset\nctx.environ = environ or {}\nctx.terms = {}\nctx._basedir = os.getcwd()\nsetmetatable(ctx, context.__mt)\nreturn ctx\nend\nfunction context.addFilter(ctx, key, value)\nif type(value) == \"table\" then\nfor i = 1, #value do\nvalue[i] = value[i]:lower()\nend\nelseif value then\nvalue = value:lower()\nend\nctx.terms[key:lower()] = value\nend\nfunction context.copyFilters(ctx, src)\nctx.terms = table.deepcopy(src.terms)\nend\nfunction context.mergeFilters(ctx, src)\nctx.terms = table.merge(ctx.terms, table.deepcopy(src.terms))\nend\nfunction context.basedir(ctx, basedir)\nctx._basedir = basedir or ctx._basedir\nreturn ctx._basedir\nend\nfunction context.compile(ctx)\nctx._cfgset = configset.compile(ctx._cfgset, ctx.terms)\nend\nfunction context.empty(ctx)\nreturn configset.empty(ctx._cfgset)\nend\nfunction context.fetchvalue(ctx, key, onlylocal)\nif not onlylocal then\nlocal value = rawget(ctx, key)\nif value ~= nil then\nreturn value\nend\nend\nlocal field = p.field.get(key)\nif not field then\nreturn nil\nend\nlocal value = configset.fetch(ctx._cfgset, field, ctx.terms, ctx, onlylocal and ctx._cfgset)\nif value then\nctx[key] = value\nend\nreturn value\nend\ncontext.__mt = {\n__index = context.fetchvalue\n}\n",

	"local p = premake\np.container = {}\nlocal container = p.container\ncontainer.classes = {}\nfunction container.newClass(name, parent, extraScopes)\nlocal class = p.configset.new(parent)\nclass.name = name\nclass.pluralName = name:plural()\nclass.containedClasses = {}\nclass.extraScopes = extraScopes\nif parent then\ntable.insert(parent.containedClasses, class)\nend\ncontainer.classes[name] = class\nreturn class\nend\nfunction container.new(class, name)\nlocal self = p.configset.new()\nsetmetatable(self, p.configset.metatable(self))\nself.class = class\nself.name = name\nself.filename = name\nself.script = _SCRIPT\nself.basedir = os.getcwd()\nself.external = false\nfor childClass in container.eachChildClass(class) do\nself[childClass.pluralName] = {}\nend\nreturn self\nend\nfunction container.addChild(self, child)\nlocal children = self[child.class.pluralName]\ntable.insert(children, child)\nchildren[child.name] = child\nchild.parent = self\nchild[self.class.name] = self\nif self.class.alias then\nchild[self.class.alias] = self\nend\nend\nfunction container.bake(self)\nif self._isBaked then\nreturn self\nend\nself._isBaked = true\nlocal ctx = p.context.new(self)\nfor key, value in pairs(self) do\nctx[key] = value\nend\nlocal parent = self.parent\nctx[parent.class.name] = parent\nfor class in container.eachChildClass(self.class) do\nfor child in container.eachChild(self, class) do\nchild.parent = ctx\nchild[self.class.name] = ctx\nend\nend\nif type(self.class.bake) == \"function\" then\nself.class.bake(ctx)\nend\nreturn ctx\nend\nfunction container.bakeChildren(self)\nfor class in container.eachChildClass(self.class) do\nlocal children = self[class.pluralName]\ntable.sort(children, function(a,b) \nreturn a.name < b.name\nend)\nfor i = 1, #children do\nlocal ctx = container.bake(children[i])\nchildren[i] = ctx\nchildren[ctx.name] = ctx\nend\nend\nend\nfunction container.classCanContain(class, scope)\nif type(scope) == \"table\" then\nfor i = 1, #scope do\nif container.classCanContain(class, scope[i]) then\nreturn true\nend\nend\nreturn false\nend\nfor child in container.eachChildClass(class) do\nif (container.classCanContain(child, scope)) then\nreturn true\nend\nend\nif class.name == scope or class.alias == scope then\nreturn true\nend\nif class.extraScopes and table.contains(class.extraScopes, scope) then\nreturn true\nend\nreturn false\nend\nfunction container.classIsA(class, scope)\nwhile class do\nif class.name == scope or class.alias == scope then\nreturn true\nend\nclass = class.parent\nend\nreturn false\nend\nfunction container.eachChildClass(class)\nlocal children = class.containedClasses\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #children then\nreturn children[i]\nend\nend\nend\nfunction container.eachChild(self, class)\nlocal children = self[class.pluralName]\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #children then\nreturn children[i]\nend\nend\nend\nfunction container.getChild(self, class, name)\nlocal children = self[class.pluralName]\nreturn children[name]\nend\nfunction container.getClass(name)\nreturn container.classes[name]\nend\nfunction container.hasChild(self, class, func)\nfor child in container.eachChild(self, class) do\nif func(child) then\nreturn true\nend\nend\nend\nfunction container.validate(self)\nif type(self.class.validate) == \"function\" then\nself.class.validate(self)\nend\nend\nfunction container.validateChildren(self)\nfor class in container.eachChildClass(self.class) do\nlocal children = self[class.pluralName]\nfor i = 1, #children do\ncontainer.validate(children[i])\nend\nend\nend\n",

	"premake.option = {}\nlocal m = premake.option\nlocal _OPTIONS_metatable = {\n__index = function(tbl, key)\nif type(key) == \"string\" then\nkey = key:lower()\nend\nreturn rawget(tbl, key)\nend,\n__newindex = function(tbl, key, value)\nif type(key) == \"string\" then\nkey = key:lower()\nend\nrawset(tbl, key, value)\nend\n}\n_OPTIONS = {}\nsetmetatable(_OPTIONS, _OPTIONS_metatable)\nfor i, arg in ipairs(_ARGV) do\nlocal key, value\nlocal i = arg:find(\"=\", 1, true)\nif i then\nkey = arg:sub(1, i - 1)\nvalue = arg:sub(i + 1)\nelse\nkey = arg\nvalue = \"\"\nend\nif key:startswith(\"/\") then\n_OPTIONS[key:sub(2)] = value\nelseif key:startswith(\"--\") then\n_OPTIONS[key:sub(3)] = value\nend\nend\nm.list = {}\nfunction m.add(opt)\nlocal missing\nfor _, field in ipairs({ \"description\", \"trigger\" }) do\nif (not opt[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"option needs a \" .. missing, 3)\nend\npremake.option.list[opt.trigger:lower()] = opt\nif opt.default and not _OPTIONS[opt.trigger] then\n_OPTIONS[opt.trigger] = opt.default\nend\nend\nfunction m.get(name)\nreturn premake.option.list[name]\nend\nfunction m.each()\nlocal keys = { }\nfor _, option in pairs(premake.option.list) do\ntable.insert(keys, option.trigger)\nend\ntable.sort(keys)\nlocal i = 0\nreturn function()\ni = i + 1\nreturn premake.option.list[keys[i]]\nend\nend\nfunction m.validate(values)\nfor key, value in pairs(values) do\nlocal opt = premake.option.get(key)\nif (not opt) then\nreturn false, \"invalid option '\" .. key .. \"'\"\nend\nif (opt.value and value == \"\") then\nreturn false, \"no value specified for option '\" .. key .. \"'\"\nend\nif opt.allowed then\nlocal found = false\nfor _, match in ipairs(opt.allowed) do\nif match[1] == value then\nfound = true\nbreak\nend\nend\nif not found then\nreturn false, string.format(\"invalid value '%s' for option '%s'\", value, key)\nend\nend\nend\nreturn true\nend\n",

	"local p = premake\np.action = {}\nlocal action = premake.action\n_ACTION = nil\n_ARGS = {}\nfor i, arg in ipairs(_ARGV) do\nif not arg:startswith(\"/\") and not arg:startswith(\"--\") then\nif not _ACTION then\n_ACTION = arg\nelse\ntable.insert(_ARGS, arg)\n_ARGS[arg] = arg\nend\nend\nend\naction._list = {}\nfunction action.add(act)\nlocal missing\nfor _, field in ipairs({\"description\", \"trigger\"}) do\nif not act[field] then\nmissing = field\nend\nend\nif missing then\nlocal name = act.trigger or \"\"\nerror(string.format('action \"%s\" needs a  %s', name, missing), 3)\nend\naction._list[act.trigger] = act\nend\nfunction action.call(name)\nlocal a = action._list[name]\nif a.onStart then\na.onStart()\nend\nfor wks in p.global.eachWorkspace() do\nlocal onWorkspace = a.onWorkspace or a.onSolution or a.onsolution\nif onWorkspace and not wks.external then\nonWorkspace(wks)\nend\nfor prj in p.workspace.eachproject(wks) do\nlocal onProject = a.onProject or a.onproject\nif onProject and not prj.external then\nonProject(prj)\nend\nend\nend\nfor rule in p.global.eachRule() do\nlocal onRule = a.onRule or a.onrule\nif onRule and not rule.external then\nonRule(rule)\nend\nend\nif a.execute then\na.execute()\nend\nif a.onEnd then\na.onEnd()\nend\nend\nfunction action.current()\nreturn action.get(_ACTION)\nend\nfunction action.get(name)\nif name and name:endswith(\"ng\") then\nname = name:sub(1, -3)\nend\nreturn action._list[name]\nend\nfunction action.each()\nlocal keys = { }\nfor _, act in pairs(action._list) do\ntable.insert(keys, act.trigger)\nend\ntable.sort(keys)\nlocal i = 0\nreturn function()\ni = i + 1\nreturn action._list[keys[i]]\nend\nend\nfunction action.isConfigurable(self)\nif not self then\nself = action.current() or {}\nend\nif self.onSolution or self.onsolution then\nreturn true\nend\nif self.onProject or self.onproject then\nreturn true\nend\nreturn false\nend\nfunction action.set(name)\n_ACTION = name\nlocal act = action.get(name)\nif act then\n_OS = act.os or _OS\nend\nif act and act.module then\nrequire(act.module)\nend\nend\nfunction action.supports(feature)\nif not feature then\nreturn true\nend\nlocal self = action.current()\nif not self then\nreturn false\nend\nif not self.valid_languages and not self.valid_kinds then\nreturn true\nend\nif self.valid_languages then\nif table.contains(self.valid_languages, feature) then\nreturn true\nend\nend\nif self.valid_kinds then\nif table.contains(self.valid_kinds, feature) then\nreturn true\nend\nend\nreturn false\nend\nfunction premake.action.supportsconfig(action, cfg)\nif not action then\nreturn false\nend\nif action.supportsconfig then\nreturn action.supportsconfig(cfg)\nend\nreturn true\nend\n",

	"local p = premake\np.api = {}\nlocal api = premake.api\nlocal configset = p.configset\napi.scope = {}\nfunction api.container(containerName, parentContainer, extraScopes)\nlocal class, err = p.container.newClass(containerName, parentContainer, extraScopes)\nif not class then\nerror(err, 2)\nend\n_G[containerName] = function(name)\nlocal c = api._setContainer(class, name)\nif api._isIncludingExternal then\nc.external = true\nend\nreturn c\nend\n_G[\"external\" .. containerName] = function(name)\nlocal c = _G[containerName](name)\nc.external = true\nreturn c\nend\np.alias(_G, \"external\" .. containerName, \"external\" .. containerName:capitalized())\nreturn class\nend\nfunction includeexternal(fname)\nlocal fullPath = premake.findProjectScript(fname)\napi._isIncludingExternal = true\nfname = fullPath or fname\ndofile(fname)\napi._isIncludingExternal = nil\nend\np.alias(_G, \"includeexternal\", \"includeExternal\")\nfunction api.rootContainer()\nreturn api.scope.global\nend\nfunction api._setContainer(class, name)\nlocal instance\nif name == \"*\" then\nreturn api._setContainer(class.parent)\nend\nif not name then\ninstance = api.scope[class.name]\nif not instance then\nerror(\"no \" .. class.name .. \" in scope\", 3)\nend\nend\nlocal parent\nif not instance and class.parent then\nparent = api.scope[class.parent.name]\nif not parent then\nerror(\"no \" .. class.parent.name .. \" in scope\", 3)\nend\ninstance = p.container.getChild(parent, class, name)\nend\nif instance then\nconfigset.addFilter(instance, {}, os.getcwd())\nend\nif not instance then\ninstance = class.new(name)\nif parent then\np.container.addChild(parent, instance)\nend\nend\napi._clearContainerChildren(class)\nif not class.placeholder then\napi.scope.current = instance\nend\nwhile instance do\napi.scope[instance.class.name] = instance\nif instance.class.alias then\napi.scope[instance.class.alias] = instance\nend\ninstance = instance.parent\nend\nreturn api.scope.current\nend\nfunction api._clearContainerChildren(class)\nfor childClass in p.container.eachChildClass(class) do\napi.scope[childClass.name] = nil\nif childClass.alias then\napi.scope[childClass.alias] = nil\nend\napi._clearContainerChildren(childClass)\nend\nend\nfunction api.register(field)\nlocal name = field.name\nif not name then\nerror(\"missing name\", 2)\nend\nif rawget(_G, name) then\nerror(\"name '\" .. name .. \"' in use\", 2)\nend\nfield, err = premake.field.new(field)\nif not field then\nerror(err)\nend\nfield.paths = premake.field.property(field, \"paths\")\nif type(field.allowed) == \"table\" then\nfor i, item in ipairs(field.allowed) do\nfield.allowed[item:lower()] = item\nend\nend\nif type(field.aliases) == \"table\" then\nlocal keys = table.keys(field.aliases)\nfor i, key in ipairs(keys) do\nfield.aliases[key:lower()] = field.aliases[key]\nend\nend\n_G[name] = function(value)\nreturn api.storeField(field, value)\nend\nif premake.field.removes(field) then\n_G[\"remove\" .. name] = function(value)\nreturn api.remove(field, value)\nend\nend\nreturn field\nend\nfunction api.unregister(field)\nif type(field) == \"string\" then\nfield = premake.field.get(field)\nend\npremake.field.unregister(field)\n_G[field.name] = nil\n_G[\"remove\" .. field.name] = nil\nend\n     function api.alias(original, alias)\n     p.alias(_G, original, alias)\n     if _G[\"remove\" .. original] then\n     p.alias(_G, \"remove\" .. original, \"remove\" .. alias)\n     end\n     end\nfunction api.addAllowed(fieldName, value)\nlocal field = premake.field.get(fieldName)\nif not field then\nerror(\"No such field: \" .. fieldName, 2)\nend\nif type(value) == \"table\" then\nfor i, item in ipairs(value) do\napi.addAllowed(fieldName, item)\nend\nelse\nfield.allowed = field.allowed or {}\ntable.insert(field.allowed, value)\nfield.allowed[value:lower()] = value\nend\nend\nfunction api.addAliases(fieldName, value)\nlocal field = premake.field.get(fieldName)\nif not field then\nerror(\"No such field: \" .. fieldName, 2)\nend\nfield.aliases = field.aliases or {}\nfor k, v in pairs(value) do\nfield.aliases[k] = v\nfield.alias"
	"es[k:lower()] = v\nend\nend\nfunction api.deprecateField(name, message, handler)\npremake.fields[name].deprecated = {\nhandler = handler,\nmessage = message\n}\nend\nfunction api.deprecateValue(name, value, message, addHandler, removeHandler)\nif type(value) == \"table\" then\nfor _, v in pairs(value) do\napi.deprecateValue(name, v, message, addHandler, removeHandler)\nend\nelse\nlocal field = premake.fields[name]\nfield.deprecated = field.deprecated or {}\nfield.deprecated[value] = {\nadd = addHandler,\nremove = removeHandler,\nmessage = message\n}\nend\nend\nfunction api.deprecations(value)\nvalue = value:lower()\nif not table.contains({ \"on\", \"off\", \"error\"}, value) then\nerror(\"Invalid value: \" .. value, 2)\nend\napi._deprecations = value:lower()\nend\napi._deprecations = \"on\"\nfunction api.target(field)\nif p.container.classCanContain(api.scope.current.class, field.scope) then\nreturn api.scope.current\nend\nreturn nil\nend\nfunction api.storeField(field, value)\nif value == nil then\nreturn\nend\nif field.deprecated and type(field.deprecated.handler) == \"function\" then\nfield.deprecated.handler(value)\nif field.deprecated.message and api._deprecations ~= \"off\" then\npremake.warnOnce(field.name, \"the field %s has been deprecated.\\n   %s\", field.name, field.deprecated.message)\nif api._deprecations == \"error\" then error(\"deprecation errors enabled\", 3) end\nend\nend\nlocal target = api.target(field)\nif not target then\nlocal err = string.format(\"unable to set %s in %s scope, should be %s\", field.name, api.scope.current.class.name, table.concat(field.scopes, \", \"))\nerror(err, 3)\nend\nlocal status, err = configset.store(target, field, value)\nif err then\nerror(err, 3)\nend\nend\nfunction api.remove(field, value)\nif value == nil then return end\nlocal target = api.target(field)\nif not target then\nlocal err = string.format(\"unable to remove %s from %s scope, should be %s\", field.name, api.scope.current.class.name, table.concat(field.scopes, \", \"))\nerror(err, 3)\nend\nlocal hasDeprecatedValues = (type(field.deprecated) == \"table\")\nlocal removes = {}\nfunction check(value)\nif field.deprecated[value] then\nlocal handler = field.deprecated[value]\nif handler.remove then handler.remove(value) end\nif handler.message and api._deprecations ~= \"off\" then\nlocal key = field.name .. \"_\" .. value\npremake.warnOnce(key, \"the %s value %s has been deprecated.\\n   %s\", field.name, value, handler.message)\nif api._deprecations == \"error\" then\nerror { msg=\"deprecation errors enabled\" }\nend\nend\nend\nend\nlocal function recurse(value)\nif type(value) == \"table\" then\ntable.foreachi(value, recurse)\nelseif hasDeprecatedValues and value:contains(\"*\") then\nlocal current = configset.fetch(target, field)\nlocal mask = path.wildcards(value)\nfor _, item in ipairs(current) do\nif item:match(mask) == item then\nrecurse(item)\nend\nend\ntable.insert(removes, value)\nelse\nlocal value, err, additional = api.checkValue(field, value)\nif err then\nerror { msg=err }\nend\nif field.deprecated then\ncheck(value)\nend\ntable.insert(removes, value)\nif additional then\ntable.insert(removes, additional)\nend\nend\nend\nlocal ok, err = pcall(function ()\nrecurse(value)\nend)\nif not ok then\nif type(err) == \"table\" then\nerr = err.msg\nend\nerror(err, 3)\nend\nconfigset.remove(target, field, removes)\nend\nfunction api.checkValue(field, value, kind)\nif not field.allowed then\nreturn value\nend\nlocal canonical, result\nlocal lowerValue = value:lower()\nif field.aliases then\ncanonical = field.aliases[lowerValue]\nend\nif not canonical then\nif type(field.allowed) == \"function\" then\ncanonical = field.allowed(value, kind or \"string\")\nelse\ncanonical = field.allowed[lowerValue]\nend\nend\nif not canonical then\nreturn nil, \"invalid value '\" .. value .. \"' for \" .. field.name\nend\nif field.deprecated and field.deprecated[canonical] then\nlocal handler = field.deprecated[canonical]\nhandler.add(canonical)\nif handler.message and api._deprecations ~= \"off\" then\nlocal key = field.name .. "
	"\"_\" .. value\npremake.warnOnce(key, \"the %s value %s has been deprecated.\\n   %s\", field.name, canonical, handler.message)\nif api._deprecations == \"error\" then\nreturn nil, \"deprecation errors enabled\"\nend\nend\nend\nreturn canonical\nend\nfunction api.reset()\nfor containerClass in p.container.eachChildClass(p.global) do\napi.scope.global[containerClass.pluralName] = {}\nend\nend\npremake.field.kind(\"array\", {\nstore = function(field, current, value, processor)\nif type(value) ~= \"table\" then\nvalue = { value }\nend\nfor i, item in ipairs(value) do\nvalue[i] = processor(field, nil, value[i])\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nif a == nil or b == nil or #a ~= #b then\nreturn false\nend\nfor i = 1, #a do\nif not processor(field, a[i], b[i]) then\nreturn false\nend\nend\nreturn true\nend\n})\npremake.field.kind(\"boolean\", {\nstore = function(field, current, value, processor)\nlocal mapping = {\n[\"false\"] = false,\n[\"no\"] = false,\n[\"off\"] = false,\n[\"on\"] = true,\n[\"true\"] = true,\n[\"yes\"] = true,\n}\nif type(value) == \"string\" then\nvalue = mapping[value:lower()]\nif value == nil then\nerror { msg=\"expected boolean; got \" .. value }\nend\nreturn value\nend\nif type(value) == \"boolean\" then\nreturn value\nend\nif type(value) == \"number\" then\nreturn (value ~= 0)\nend\nreturn (value ~= nil)\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\npremake.field.kind(\"directory\", {\npaths = true,\nstore = function(field, current, value, processor)\nreturn path.getabsolute(value)\nend,\nremove = function(field, current, value, processor)\nreturn path.getabsolute(value)\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend,\ntranslate = function(field, current, _, processor)\nif current:find(\"*\") then\nreturn os.matchdirs(current)\nend\nreturn { current }\nend\n})\npremake.field.kind(\"file\", {\npaths = true,\nstore = function(field, current, value, processor)\nreturn path.getabsolute(value)\nend,\nremove = function(field, current, value, processor)\nreturn path.getabsolute(value)\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend,\ntranslate = function(field, current, _, processor)\nif current:find(\"*\") then\nreturn os.matchfiles(current)\nend\nreturn { current }\nend\n})\npremake.field.kind(\"function\", {\nstore = function(field, current, value, processor)\nlocal t = type(value)\nif t ~= \"function\" then\nerror { msg=\"expected function; got \" .. t }\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\npremake.field.kind(\"integer\", {\nstore = function(field, current, value, processor)\nlocal t = type(value)\nif t ~= \"number\" then\nerror { msg=\"expected number; got \" .. t }\nend\nif math.floor(value) ~= value then\nerror { msg=\"expected integer; got \" .. tostring(value) }\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\nlocal function storeKeyed(field, current, value, processor)\ncurrent = current or {}\nfor k, v in pairs(value) do\nif processor then\nv = processor(field, current[k], v)\nend\ncurrent[k] = v\nend\nreturn current\nend\nlocal function mergeKeyed(field, current, value, processor)\nvalue = value or {}\nfor k, v in pairs(value) do\ncurrent[k] = v\nend\nreturn current\nend\npremake.field.kind(\"keyed\", {\nstore = storeKeyed,\nmerge = mergeKeyed,\ncompare = function(field, a, b, processor)\nif a == nil or b == nil then\nreturn false\nend\nfor k in pairs(a) do\nif not processor(field, a[k], b[k]) then\nreturn false\nend\nend\nreturn true\nend,\ntranslate = function(field, current, _, processor)\nif not processor then\nreturn { current }\nend\nfor k, v in pairs(current) do\ncurrent[k] = processor(field, v, nil)[1]\nend\nreturn { current }\nend\n})\nlocal function storeListItem(current, item)\nif current[item] then\ntable.remove(current, table.indexof(current, item))\nend\ntable.insert(current, item)\ncurrent[item] = item\nend\nlocal function storeList(field, current, value, processor)"
	"\nif type(value) == \"table\" then\nif #value > 0 then\nfor i = 1, #value do\ncurrent = storeList(field, current, value[i], processor)\nend\nreturn current\nend\nif table.isempty(value) then\nreturn current\nend\nend\ncurrent = current or {}\nif processor then\nvalue = processor(field, nil, value)\nend\nif type(value) == \"table\" then\nif #value > 0 then\nfor i = 1, #value do\nstoreListItem(current, value[i])\nend\nelseif not table.isempty(value) then\nstoreListItem(current, value)\nend\nelseif value then\nstoreListItem(current, value)\nend\nreturn current\nend\nlocal function mergeList(field, current, value, processor)\nvalue = value or {}\nfor i = 1, #value do\nstoreListItem(current, value[i])\nend\nreturn current\nend\npremake.field.kind(\"list\", {\nstore = storeList,\nremove = storeList,\nmerge = mergeList,\ncompare = function(field, a, b, processor)\nif a == nil or b == nil or #a ~= #b then\nreturn false\nend\nfor i = 1, #a do\nif not processor(field, a[i], b[i]) then\nreturn false\nend\nend\nreturn true\nend,\ntranslate = function(field, current, _, processor)\nif not processor then\nreturn { current }\nend\nlocal ret = {}\nfor _, value in ipairs(current) do\nfor _, processed in ipairs(processor(field, value, nil)) do\ntable.insert(ret, processed)\nend\nend\nreturn { ret }\nend\n})\npremake.field.kind(\"mixed\", {\npaths = true,\nstore = function(field, current, value, processor)\nif type(value) == \"string\" and value:find('/', nil, true) then\nif string.sub(value, 1, 2) ~= \"%{\" then\nvalue = path.getabsolute(value)\nend\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\npremake.field.kind(\"number\", {\nstore = function(field, current, value, processor)\nlocal t = type(value)\nif t ~= \"number\" then\nerror { msg=\"expected number; got \" .. t }\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\npremake.field.kind(\"path\", {\npaths = true,\nstore = function(field, current, value, processor)\nif string.sub(value, 1, 2) == \"%{\" then\nreturn value\nend\nreturn path.getabsolute(value)\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\npremake.field.kind(\"string\", {\nstore = function(field, current, value, processor)\nif type(value) == \"table\" then\nerror { msg=\"expected string; got table\" }\nend\nif value ~= nil then\nlocal err\nvalue, err = api.checkValue(field, value)\nif err then\nerror { msg=err }\nend\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nreturn (a == b)\nend\n})\npremake.field.kind(\"table\", {\nstore = function(field, current, value, processor)\nif type(value) ~= \"table\" then\nvalue = { value }\nend\nreturn value\nend,\ncompare = function(field, a, b, processor)\nreturn true\nend\n})\nfunction configuration(terms)\nif terms then\nif (type(terms) == \"table\" and #terms == 1 and terms[1] == \"*\") or\n   (terms == \"*\")\nthen\nterms = nil\nend\nconfigset.addblock(api.scope.current, {terms}, os.getcwd())\nend\nreturn api.scope.current\nend\nfunction filter(terms)\nif terms then\nif (type(terms) == \"table\" and #terms == 1 and terms[1] == \"*\") or\n   (terms == \"*\")\nthen\nterms = nil\nend\nlocal ok, err = configset.addFilter(api.scope.current, {terms}, os.getcwd())\nif not ok then\nerror(err, 2)\nend\nend\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n",

	"local p = premake\np.global = p.api.container(\"global\")\nlocal global = p.global\nfunction global.new(name)\nreturn p.container.new(p.global, name)\nend\nfunction global.eachRule()\nlocal root = p.api.rootContainer()\nreturn p.container.eachChild(root, p.rule)\nend\nfunction global.eachWorkspace()\nlocal root = p.api.rootContainer()\nreturn p.container.eachChild(root, p.workspace)\nend\np.alias(global, \"eachWorkspace\", \"eachSolution\")\nfunction global.getRule(key)\nlocal root = p.api.rootContainer()\nreturn root.rules[key]\nend\nfunction global.getRuleForFile(fname, rules)\nlocal ext = path.getextension(fname):lower()\nfor rule in global.eachRule() do\nif not rules or table.contains(rules, rule.name) then\nif rule.fileextension == ext then\nreturn rule\nend\nend\nend\nend\nfunction global.getWorkspace(key)\nlocal root = p.api.rootContainer()\nreturn root.workspaces[key]\nend\np.alias(global, \"getWorkspace\", \"getSolution\")\n",

	"local p = premake\np.workspace = p.api.container(\"workspace\", p.global)\nlocal workspace = p.workspace\np.solution = workspace\nworkspace.alias = \"solution\"\np.alias(_G, \"workspace\", \"solution\")\np.alias(_G, \"externalworkspace\", \"externalsolution\")\nfunction workspace.new(name)\nlocal wks = p.container.new(workspace, name)\nreturn wks\nend\nfunction workspace.eachconfig(self)\nself = p.oven.bakeWorkspace(self)\nlocal i = 0\nreturn function()\ni = i + 1\nif i > #self.configs then\nreturn nil\nelse\nreturn self.configs[i]\nend\nend\nend\nfunction workspace.eachproject(self)\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #self.projects then\nreturn p.workspace.getproject(self, i)\nend\nend\nend\nfunction workspace.findproject(self, name)\nname = name:lower()\nfor _, prj in ipairs(self.projects) do\nif name == prj.name:lower() then\nreturn prj\nend\nend\nreturn nil\nend\nfunction workspace.grouptree(self)\nif self.grouptree then\nreturn self.grouptree\nend\nlocal tr = p.tree.new()\nfor prj in workspace.eachproject(self) do\nlocal prjpath = path.join(prj.group, prj.name)\nlocal node = p.tree.add(tr, prjpath)\nnode.project = prj\nend\np.tree.traverse(tr, {\nonnode = function(node)\nnode.uuid = os.uuid(node.path)\nend\n})\nself.grouptree = tr\nreturn tr\nend\nfunction workspace.getproject(self, idx)\nself = p.oven.bakeWorkspace(self)\nreturn self.projects[idx]\nend\nfunction workspace.hasProject(self, func)\nreturn p.container.hasChild(self, p.project, func)\nend\n",

	"local p = premake\np.group = p.api.container(\"group\", p.workspace)\nlocal group = p.group\ngroup.placeholder = true\nfunction group.new(name)\nreturn p.container.new(group, name)\nend\n",

	"local p = premake\np.project = p.api.container(\"project\", p.workspace, { \"config\" })\nlocal project = p.project\nlocal tree = p.tree\nexternal = externalproject\nfunction project.new(name)\nlocal prj = p.container.new(project, name)\nprj.uuid = os.uuid(name)\nif p.api.scope.group then\nprj.group = p.api.scope.group.name\nelse\nprj.group = \"\"\nend\nreturn prj\nend\nfunction project.eachconfig(prj)\nlocal configs = prj._cfglist\nlocal count = #configs\nlocal seen = {}\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= count then\nlocal cfg = project.getconfig(prj, configs[i][1], configs[i][2])\nif not seen[cfg] then\nseen[cfg] = true\nreturn cfg\nelse\ni = i + 1\nend\nend\nend\nend\nfunction project.findClosestMatch(prj, buildcfg, platform)\nbuildcfg = project.mapconfig(prj, buildcfg)[1]\nplatform = project.mapconfig(prj, platform)[1]\nif not table.contains(prj.configurations, buildcfg) then\nbuildcfg = prj.configurations[1]\nend\nif not table.contains(prj.platforms, platform) then\nplatform = prj.platforms[1]\nend\nreturn project.getconfig(prj, buildcfg, platform)\nend\nfunction project.getconfig(prj, buildcfg, platform)\nif not buildcfg then\nreturn prj\nend\nlocal pairing = project.mapconfig(prj, buildcfg, platform)\nbuildcfg = pairing[1]\nplatform = pairing[2]\nlocal key = (buildcfg or \"*\") .. (platform or \"\")\nreturn prj.configs[key]\nend\nfunction project.getdependencies(prj, mode)\nif not prj.dependencies then\nprj.dependencies = {}\nend\nlocal m = mode or 'all'\nlocal result = prj.dependencies[m]\nif result then\nreturn result\nend\nlocal function add_to_project_list(cfg, depproj, result)\nlocal dep = p.workspace.findproject(cfg.workspace, depproj)\nif dep and not table.contains(result, dep) then\ntable.insert(result, dep)\nend\nend\nlocal linkOnly = m == 'linkOnly'\nlocal depsOnly = m == 'dependOnly'\nresult = {}\nfor cfg in project.eachconfig(prj) do\nif not depsOnly then\nfor _, link in ipairs(cfg.links) do\n    if link ~= prj.name then\n    add_to_project_list(cfg, link, result)\n    end\nend\nend\nif not linkOnly then\nfor _, depproj in ipairs(cfg.dependson) do\nadd_to_project_list(cfg, depproj, result)\nend\nend\nend\nprj.dependencies[m] = result\nreturn result\nend\nfunction project.getfirstconfig(prj)\nlocal iter = project.eachconfig(prj)\nlocal first = iter()\nreturn first\nend\nfunction project.getrelative(prj, filename)\nif type(filename) == \"table\" then\nlocal result = {}\nfor i, name in ipairs(filename) do\nresult[i] = project.getrelative(prj, name)\nend\nreturn result\nelse\nif filename then\nreturn path.getrelative(prj.location, filename)\nend\nend\nend\nfunction project.getsourcetree(prj, sorter)\nif prj._.sourcetree then\nreturn prj._.sourcetree\nend\nlocal tr = tree.new(prj.name)\ntable.foreachi(prj._.files, function(fcfg)\nlocal flags\nif fcfg.vpath ~= fcfg.relpath then\nflags = { trim = false }\nend\nlocal parent = tree.add(tr, path.getdirectory(fcfg.vpath), flags)\nlocal node = tree.insert(parent, tree.new(path.getname(fcfg.vpath)))\nsetmetatable(node, { __index = fcfg })\nend)\ntree.trimroot(tr)\ntree.sort(tr, sorter)\nprj._.sourcetree = tr\nreturn tr\nend\nfunction project.getvpath(prj, abspath)\nlocal vpath = abspath\nlocal fname = path.getname(abspath)\nlocal max = abspath:len() - fname:len()\nfor _, vpaths in ipairs(prj.vpaths) do\nfor replacement, patterns in pairs(vpaths) do\nfor _, pattern in ipairs(patterns) do\nlocal i = abspath:find(path.wildcards(pattern))\nif i == 1 then\ni = pattern:find(\"*\", 1, true) or (pattern:len() + 1)\nlocal leaf\nif i < max then\nleaf = abspath:sub(i)\nelse\nleaf = fname\nend\nif leaf:startswith(\"/\") then\nleaf = leaf:sub(2)\nend\nlocal stem = \"\"\nif replacement:len() > 0 then\nstem, stars = replacement:gsub(\"%*\", \"\")\nif stars == 0 then\nleaf = path.getname(leaf)\nend\nelse\nleaf = path.getname(leaf)\nend\nvpath = path.join(stem, leaf)\nreturn vpath\nend\nend\nend\nend\nreturn vpath\nend\nfunction project.hasConfig(prj, func)\nfor cfg in project.eachconfig(prj) do\nif func(cfg) then\nreturn true\nend\nend\nend\nfunction project.hasfi"
	"le(prj, filename)\nreturn (prj._.files[filename] ~= nil)\nend\nfunction project.isc(prj)\nreturn prj.language == premake.C\nend\nfunction project.iscpp(prj)\nreturn prj.language == premake.C or prj.language == premake.CPP\nend\nfunction project.isdotnet(prj)\nreturn prj.language == premake.CSHARP\nend\nfunction project.isnative(prj)\nreturn project.iscpp(prj)\nend\nfunction project.mapconfig(prj, buildcfg, platform)\nlocal pairing = { buildcfg, platform }\nlocal testpattern = function(pattern, pairing, i)\nlocal j = 1\nwhile i <= #pairing and j <= #pattern do\nif pairing[i] ~= pattern[j] then\nreturn false\nend\ni = i + 1\nj = j + 1\nend\nreturn true\nend\nlocal maps = prj.configmap or {}\nfor mi = 1, #maps do\nfor pattern, replacements in pairs(maps[mi]) do\nif type(pattern) ~= \"table\" then\npattern = { pattern }\nend\nfor i = 1, #pairing do\nif testpattern(pattern, pairing, i) then\nif #pattern == 1 and #replacements == 1 then\npairing[i] = replacements[1]\nelse\npairing = { replacements[1], replacements[2] }\nend\nend\nend\nend\nend\nreturn pairing\nend\n",

	"local p = premake\np.config = {}\nlocal project = p.project\nlocal config = p.config\nfunction config.buildtargetinfo(cfg, kind, field)\nlocal basedir = cfg.project.location\nlocal targetdir\nif cfg.platform then\ntargetdir = path.join(basedir, 'bin', cfg.platform, cfg.buildcfg)\nelse\ntargetdir = path.join(basedir, 'bin', cfg.buildcfg)\nend\nlocal directory = cfg[field..\"dir\"] or cfg.targetdir or targetdir\nlocal basename = cfg[field..\"name\"] or cfg.targetname or cfg.project.name\nlocal prefix = cfg[field..\"prefix\"] or cfg.targetprefix or \"\"\nlocal suffix = cfg[field..\"suffix\"] or cfg.targetsuffix or \"\"\nlocal extension = cfg[field..\"extension\"] or cfg.targetextension or \"\"\nlocal bundlename = \"\"\nlocal bundlepath = \"\"\nif cfg.system == premake.MACOSX and kind == premake.WINDOWEDAPP then\nbundlename = basename .. \".app\"\nbundlepath = path.join(bundlename, \"Contents/MacOS\")\nend\nlocal info = {}\ninfo.directory  = directory\ninfo.basename   = basename .. suffix\ninfo.name       = prefix .. info.basename .. extension\ninfo.extension  = extension\ninfo.abspath    = path.join(directory, info.name)\ninfo.fullpath   = info.abspath\ninfo.bundlename = bundlename\ninfo.bundlepath = path.join(directory, bundlepath)\ninfo.prefix     = prefix\ninfo.suffix     = suffix\nreturn info\nend\nfunction config.canLink(cfg, target, linkage)\nif type(target) ~= \"string\" then\nif target.kind ~= \"SharedLib\" and target.kind ~= \"StaticLib\" then\nreturn false\nend\nlocal cfgManaged = project.isdotnet(cfg.project) or (cfg.clr ~= p.OFF)\nlocal tgtManaged = project.isdotnet(target.project) or (target.clr ~= p.OFF)\nreturn (cfgManaged == tgtManaged)\nend\nif project.isdotnet(cfg.project) then\nreturn true\nend\nlocal isManaged = (path.getextension(target) == \".dll\")\nif isManaged and cfg.clr == p.OFF then\nreturn false\nend\nreturn (isManaged) == (linkage == \"managed\")\nend\nfunction config.canLinkIncremental(cfg)\nif cfg.kind == \"StaticLib\"\nor config.isOptimizedBuild(cfg)\nor cfg.flags.NoIncrementalLink then\nreturn false\nend\nreturn true\nend\nfunction config.findfile(cfg, ext)\nfor _, fname in ipairs(cfg.files) do\nif fname:endswith(ext) then\nreturn project.getrelative(cfg.project, fname)\nend\nend\nend\nfunction config.getlinkinfo(cfg)\nlocal kind = cfg.kind\nif project.iscpp(cfg.project) then\nif cfg.system == premake.WINDOWS and kind == premake.SHAREDLIB and not cfg.flags.NoImportLib then\nkind = premake.STATICLIB\nend\nend\nreturn config.buildtargetinfo(cfg, kind, \"implib\")\nend\n function config.getlinks(cfg, kind, part, linkage)\nlocal result = {}\nif part == \"directory\" then\ntable.foreachi(cfg.libdirs, function(dir)\ntable.insert(result, project.getrelative(cfg.project, dir))\nend)\nend\nfor i = 1, #cfg.links do\nlocal link = cfg.links[i]\nlocal item\nlocal prj = p.workspace.findproject(cfg.workspace, link)\nif prj and kind ~= \"system\" then\nlocal prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)\nif prjcfg and (kind == \"dependencies\" or config.canLink(cfg, prjcfg)) then\nif part == \"object\" then\nitem = prjcfg\nelse\nitem = project.getrelative(cfg.project, prjcfg.linktarget.fullpath)\nend\nend\nelseif not prj and (kind == \"system\" or kind == \"all\") then\nif config.canLink(cfg, link, linkage) then\nitem = link\nif item:find(\"/\", nil, true) then\nitem = project.getrelative(cfg.project, item)\nend\nend\nend\nif item and item ~= cfg then\nif part == \"directory\" then\nitem = path.getdirectory(item)\nif item == \".\" then\nitem = nil\nend\nelseif part == \"name\" then\nitem = path.getname(item)\nelseif part == \"basename\" then\nitem = path.getbasename(item)\nelseif type(part) == \"function\" then\npart(link, item)\nend\nend\nif item and not table.contains(result, item) then\ntable.insert(result, item)\nend\nend\nreturn result\nend\nfunction config.getruntime(cfg)\nlocal linkage = iif(cfg.flags.StaticRuntime, \"Static\", \"Shared\")\nif not cfg.runtime then\nreturn linkage .. iif(config.isDebugBuild(cfg), \"Debug\", \"Release\")\nelse\nreturn linkage .. cfg.runtime\nend\nend\nfun"
	"ction config.gettargetinfo(cfg)\nreturn config.buildtargetinfo(cfg, cfg.kind, \"target\")\nend\nfunction config.hasFile(self, testfn)\nlocal files = self.files\nfor i = 1, #files do\nif testfn(files[i]) then\nreturn true\nend\nend\nreturn false\nend\nfunction config.isCopyLocal(cfg, linkname, default)\nif cfg.flags.NoCopyLocal then\nreturn false\nend\nif #cfg.copylocal > 0 then\nreturn table.contains(cfg.copylocal, linkname)\nend\nreturn default\nend\nfunction config.isDebugBuild(cfg)\nreturn cfg.flags.Symbols and not config.isOptimizedBuild(cfg)\nend\nfunction config.isOptimizedBuild(cfg)\nreturn cfg.optimize ~= nil and cfg.optimize ~= p.OFF and cfg.optimize ~= \"Debug\"\nend\nfunction config.linksToProject(cfg, prjName)\nprjName = prjName:lower()\nlocal n = #cfg.links\nfor i = 1,n do\nif cfg.links[i]:lower() == prjName then\nreturn true\nend\nend\nend\nfunction config.mapFlags(cfg, mappings)\nlocal flags = {}\nlocal function add(replacement)\nif type(replacement) == \"function\" then\nreplacement = replacement(cfg)\nend\ntable.insertflat(flags, replacement)\nend\nfor field in p.field.eachOrdered() do\nlocal map = mappings[field.name]\nif map then\nlocal values = cfg[field.name]\nif type(values) ~= \"table\" then\nvalues = { values }\nend\nlocal foundValue = false\ntable.foreachi(values, function(value)\nlocal replacement = map[value]\nif replacement ~= nil then\nfoundValue = true\nadd(replacement)\nend\nend)\nif not foundValue then\nadd(map._)\nend\nfor key, replacement in pairs(map) do\nif #key > 1 and key:startswith(\"_\") then\nkey = key:sub(2)\nif values[key] == nil then\nadd(replacement)\nend\nend\nend\nend\nend\nreturn flags\nend\nfunction config.normalize(cfg)\nif cfg and cfg.config ~= nil then\nreturn cfg.config, cfg\nelse\nreturn cfg, nil\nend\nend\nfunction config.toolset(cfg)\nif cfg.toolset then\nreturn p.tools.canonical(cfg.toolset)\nend\nend\n",

	"premake.fileconfig = {}\nlocal p = premake\nlocal fileconfig = p.fileconfig\nlocal context = p.context\nlocal project = p.project\nfileconfig.fcfg_mt = {}\nfileconfig.fsub_mt = {}\nfunction fileconfig.new(fname, prj)\nlocal environ = { }\nlocal fcfg = context.new(prj, environ)\ncontext.copyFilters(fcfg, prj)\ncontext.addFilter(fcfg, \"files\", fname:lower())\nfor key, value in pairs(prj.environ) do\nenviron[key] = value\nend\nenviron.file = fcfg\ncontext.compile(fcfg)\nfcfg.project = prj\nfcfg.configs = {}\nfcfg.abspath = fname\ncontext.basedir(fcfg, prj.location)\nsetmetatable(fcfg, fileconfig.fcfg_mt)\nlocal vpath = project.getvpath(prj, fname)\nif vpath ~= fcfg.abspath then\nfcfg.vpath = vpath\nend\nreturn fcfg\nend\nfunction fileconfig.addconfig(fcfg, cfg)\nlocal prj = cfg.project\nlocal environ = {}\nlocal fsub = context.new(prj, environ)\ncontext.copyFilters(fsub, cfg)\ncontext.mergeFilters(fsub, fcfg)\nfcfg.configs[cfg] = fsub\nfor key, value in pairs(cfg.environ) do\nenviron[key] = value\nend\nfor key, value in pairs(fcfg.environ) do\nenviron[key] = value\nend\ncontext.compile(fsub)\nfsub.abspath = fcfg.abspath\nfsub.vpath = fcfg.vpath\nfsub.config = cfg\nfsub.project = prj\ncontext.basedir(fsub, prj.location)\nsetmetatable(fsub, fileconfig.fsub_mt)\nend\nfunction fileconfig.getconfig(fcfg, cfg)\nreturn fcfg.configs[cfg]\nend\nfunction fileconfig.hasCustomBuildRule(fcfg)\nreturn fcfg and (#fcfg.buildcommands > 0) and (#fcfg.buildoutputs > 0)\nend\nfunction fileconfig.hasFileSettings(fcfg)\nfor key, field in pairs(premake.fields) do\nif field.scopes[1] == \"config\" then\nlocal value = fcfg[field.name]\nif value then\nif type(value) == \"table\" then\nif #value > 0 then\nreturn true\nend\nelse\nreturn true\nend\nend\nend\nend\nreturn false\nend\nlocal fcfg_mt = fileconfig.fcfg_mt\nfcfg_mt.__index = function(fcfg, key)\nif type(fcfg_mt[key]) == \"function\" then\nreturn fcfg_mt[key](fcfg)\nend\nreturn context.__mt.__index(fcfg, key)\nend\nfileconfig.fsub_mt.__index = function(fsub, key)\nif type(fcfg_mt[key]) == \"function\" then\nreturn fcfg_mt[key](fsub)\nend\nreturn context.__mt.__index(fsub, key)\nend\nfunction fcfg_mt.basename(fcfg)\nreturn path.getbasename(fcfg.abspath)\nend\nfunction fcfg_mt.directory(fcfg)\nreturn path.getdirectory(fcfg.abspath)\nend\nfunction fcfg_mt.name(fcfg)\nreturn path.getname(fcfg.abspath)\nend\nfunction fcfg_mt.objname(fcfg)\nif fcfg.sequence ~= nil and fcfg.sequence > 0 then\nreturn fcfg.basename .. fcfg.sequence\nelse\nreturn fcfg.basename\nend\nend\nfunction fcfg_mt.path(fcfg)\nreturn fcfg.relpath\nend\nfunction fcfg_mt.relpath(fcfg)\nreturn project.getrelative(fcfg.project, fcfg.abspath)\nend\nfunction fcfg_mt.vpath(fcfg)\nreturn fcfg.relpath\nend\n",

	"local p = premake\np.rule = p.api.container(\"rule\", p.global)\nlocal rule = p.rule\nfunction rule.new(name)\nlocal self = p.container.new(rule, name)\n_G[name .. \"Vars\"] = function(vars)\nrule.setVars(self, vars)\nend\nlocal lowerName =  name:gsub(\"^%u+\", string.lower)\n_G[lowerName .. \"Vars\"] = _G[name .. \"Vars\"]\nreturn self\nend\nfunction rule.eachProperty(self)\nlocal props = self.propertydefinition\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #props then\nreturn props[i]\nend\nend\nend\nfunction rule.getProperty(self, name)\nlocal props = self.propertydefinition\nfor i = 1, #props do\nlocal prop = props[i]\nif prop.name == name then\nreturn prop\nend\nend\nend\nfunction rule.getPropertyField(self, prop)\nif prop._field then\nreturn prop._field\nend\nlocal kind = prop.kind or \"string\"\nif kind == \"list\" then\nkind = \"list:string\"\nend\nlocal fld = p.field.new {\nname = \"_rule_\" .. self.name .. \"_\" .. prop.name,\nscope = \"config\",\nkind = kind,\ntokens = true,\n}\nprop._field = fld\nreturn fld\nend\nfunction rule.getPropertyString(self, prop, value)\nif type(value) == \"table\" then\nlocal sep = prop.separator or \" \"\nreturn table.concat(value, sep)\nend\nif prop.values then\nlocal i = table.indexof(prop.values, value)\nreturn tostring(i)\nend\nvalue = tostring(value)\nif #value > 0 then\nreturn value\nelse\nreturn nil\nend\nend\nfunction rule.setVars(self, vars)\nfor key, value in pairs(vars) do\nlocal prop = rule.getProperty(self, key)\nif not prop then\nerror (string.format(\"rule '%s' does not have property '%s'\", self.name, key))\nend\nlocal fld = rule.getPropertyField(self, prop)\np.api.storeField(fld, value)\nend\nend\n",

	"local p = premake\np.oven = {}\nlocal oven = p.oven\nlocal context = p.context\np.oven.bubbledFields = {\nconfigmap = true,\nvpaths = true\n}\nfunction oven.bake()\np.container.bakeChildren(p.api.rootContainer())\nend\nfunction oven.bakeWorkspace(wks)\nreturn p.container.bake(wks)\nend\np.alias(oven, \"bakeWorkspace\", \"bakeSolution\")\nfunction p.workspace.bake(self)\ncontext.addFilter(self, \"_ACTION\", _ACTION)\ncontext.addFilter(self, \"action\", _ACTION)\nself.system = self.system or p.action.current().os or os.get()\ncontext.addFilter(self, \"system\", self.system)\nlocal options = {}\nfor key, value in pairs(_OPTIONS) do\nlocal term = key\nif value ~= \"\" then\nterm = term .. \"=\" .. value\nend\ntable.insert(options, term)\nend\ncontext.addFilter(self, \"_OPTIONS\", options)\ncontext.addFilter(self, \"options\", options)\nself.environ = {\nwks = self,\nsln = self,\n}\ncontext.compile(self)\nself.location = self.location or self.basedir\ncontext.basedir(self, self.location)\np.container.bakeChildren(self)\noven.bakeObjDirs(self)\nself.configs = oven.bakeConfigs(self)\nend\nfunction p.project.bake(self)\nself.solution = self.workspace\nlocal wks = self.workspace\ncontext.copyFilters(self, wks)\nself.system = self.system or p.action.current().os or os.get()\ncontext.addFilter(self, \"system\", self.system)\ncontext.addFilter(self, \"architecture\", self.architecture)\ncontext.addFilter(self, \"kind\", self.kind)\nself.project = self\nself.environ = {\nwks = wks,\nsln = wks,\nprj = self,\n}\ncontext.compile(self)\np.container.bakeChildren(self)\nself.location = self.location or wks.location or self.basedir\ncontext.basedir(self, self.location)\nlocal cfgs = table.fold(self.configurations or {}, self.platforms or {})\noven.bubbleFields(self, self, cfgs)\nself._cfglist = oven.bakeConfigList(self, cfgs)\nself.system = nil\nself.configs = {}\nfor _, pairing in ipairs(self._cfglist) do\nlocal buildcfg = pairing[1]\nlocal platform = pairing[2]\nlocal cfg = oven.bakeConfig(wks, self, buildcfg, platform)\nif premake.action.supportsconfig(premake.action.current(), cfg) then\nself.configs[(buildcfg or \"*\") .. (platform or \"\")] = cfg\nend\nend\nself._ = {}\nself._.files = oven.bakeFiles(self)\nif p.project.iscpp(self) then\noven.assignObjectSequences(self)\nend\nend\nfunction p.rule.bake(r)\ntable.sort(r.propertydefinition, function (a, b)\nreturn a.name < b.name\nend)\nend\nfunction oven.bakeObjDirs(wks)\nlocal function getobjdirs(cfg)\nlocal objdir = cfg.objdir or \"obj\"\nlocal i = objdir:find(\"!\", 1, true)\nif i then\ncfg.objdir = objdir:sub(1, i - 1) .. objdir:sub(i + 1)\nreturn nil\nend\nlocal dirs = {}\nlocal dir = path.getabsolute(path.join(cfg.project.location, objdir))\ntable.insert(dirs, dir)\nif cfg.platform then\ndir = path.join(dir, cfg.platform)\ntable.insert(dirs, dir)\nend\ndir = path.join(dir, cfg.buildcfg)\ntable.insert(dirs, dir)\ndir = path.join(dir, cfg.project.name)\ntable.insert(dirs, dir)\nreturn dirs\nend\nlocal counts = {}\nlocal configs = {}\nfor prj in p.workspace.eachproject(wks) do\nfor cfg in p.project.eachconfig(prj) do\nlocal dirs = getobjdirs(cfg)\nif dirs then\nconfigs[cfg] = dirs\nfor _, dir in ipairs(dirs or {}) do\ncounts[dir] = (counts[dir] or 0) + 1\nend\nend\nend\nend\nfor cfg, dirs in pairs(configs) do\nfor _, dir in ipairs(dirs) do\nif counts[dir] == 1 then\ncfg.objdir = dir\nbreak\nend\nend\nend\nend\nfunction oven.bakeConfigs(wks)\nlocal buildcfgs = wks.configurations or {}\nlocal platforms = wks.platforms or {}\nlocal configs = {}\nlocal pairings = table.fold(buildcfgs, platforms)\nfor _, pairing in ipairs(pairings) do\nlocal cfg = oven.bakeConfig(wks, nil, pairing[1], pairing[2])\nif premake.action.supportsconfig(premake.action.current(), cfg) then\ntable.insert(configs, cfg)\nend\nend\nreturn configs\nend\nfunction oven.bubbleFields(ctx, cset, cfgs)\nlocal configurations = {}\nlocal platforms = {}\nfor _, cfg in ipairs(cfgs) do\nif cfg[1] then\ntable.insert(configurations, cfg[1]:lower())\nend\nif cfg[2] then\ntable.insert(platforms, cfg[2]:lower())\nend\nend\nlocal terms "
	"= table.deepcopy(ctx.terms)\nterms.configurations = configurations\nterms.platforms = platforms\nfor key in pairs(oven.bubbledFields) do\nlocal field = p.field.get(key)\nif not field then\nctx[key] = rawget(ctx, key)\nelse\nlocal value = p.configset.fetch(cset, field, terms, ctx)\nif value then\nctx[key] = value\nend\nend\nend\nend\nfunction oven.bakeConfigList(ctx, cfgs)\nfor i, cfg in ipairs(cfgs) do\ncfgs[i] = p.project.mapconfig(ctx, cfg[1], cfg[2])\nend\nlocal buildcfgs = {}\nlocal platforms = {}\nfor _, pairing in ipairs(cfgs) do\nlocal buildcfg = pairing[1]\nlocal platform = pairing[2]\nif not table.contains(buildcfgs, buildcfg) then\ntable.insert(buildcfgs, buildcfg)\nend\nif platform and not table.contains(platforms, platform) then\ntable.insert(platforms, platform)\nend\nend\nreturn table.fold(buildcfgs, platforms)\nend\nfunction oven.bakeConfig(wks, prj, buildcfg, platform, extraFilters)\nlocal system = p.action.current().os or os.get()\nlocal architecture = nil\nif platform then\nsystem = p.api.checkValue(p.fields.system, platform) or system\narchitecture = p.api.checkValue(p.fields.architecture, platform) or architecture\nend\nlocal environ = {\nwks = wks,\nsln = wks,\nprj = prj,\n}\nlocal ctx = context.new(prj or wks, environ)\nctx.project = prj\nctx.workspace = wks\nctx.solution = wks\nctx.buildcfg = buildcfg\nctx.platform = platform\nctx.action = _ACTION\nenviron.cfg = ctx\ncontext.copyFilters(ctx, wks)\ncontext.addFilter(ctx, \"configurations\", buildcfg)\ncontext.addFilter(ctx, \"platforms\", platform)\nif prj then\ncontext.addFilter(ctx, \"language\", prj.language)\nend\nctx.system = ctx.system or system\ncontext.addFilter(ctx, \"system\", ctx.system)\nctx.architecture = ctx.architecture or architecture\ncontext.addFilter(ctx, \"architecture\", ctx.architecture)\ncontext.addFilter(ctx, \"kind\", ctx.kind)\nif extraFilters then\nfor k, v in pairs(extraFilters) do\ncontext.addFilter(ctx, k, v)\nend\nend\ncontext.compile(ctx)\nctx.location = ctx.location or prj and prj.location\ncontext.basedir(ctx, ctx.location)\noven.finishConfig(ctx)\nreturn ctx\nend\nfunction oven.bakeFiles(prj)\nlocal files = {}\nfor cfg in p.project.eachconfig(prj) do\ntable.foreachi(cfg.files, function(fname)\nif not files[fname] then\nlocal fcfg = p.fileconfig.new(fname, prj)\nfiles[fname] = fcfg\ntable.insert(files, fcfg)\nend\np.fileconfig.addconfig(files[fname], cfg)\nend)\nend\ntable.sort(files, function(a,b)\nreturn a.vpath < b.vpath\nend)\nreturn files\nend\nfunction oven.assignObjectSequences(prj)\nlocal bases = {}\ntable.foreachi(prj._.files, function(file)\nif not path.iscppfile(file.abspath) then\nreturn\nend\nif not bases[file.basename] then\nbases[file.basename] = {}\nend\nlocal sequences = bases[file.basename]\nfor cfg in p.project.eachconfig(prj) do\nlocal fcfg = p.fileconfig.getconfig(file, cfg)\nif fcfg ~= nil and not fcfg.flags.ExcludeFromBuild then\nfcfg.sequence = sequences[cfg] or 0\nsequences[cfg] = fcfg.sequence + 1\nend\nend\nfile.sequence = sequences[prj] or 0\nsequences[prj] = file.sequence + 1\nend)\nend\nfunction oven.finishConfig(cfg)\ncfg.longname = table.concat({ cfg.buildcfg, cfg.platform }, \"|\")\ncfg.shortname = table.concat({ cfg.buildcfg, cfg.platform }, \" \")\ncfg.shortname = cfg.shortname:gsub(\" \", \"_\"):lower()\ncfg.name = cfg.longname\nif cfg.project and cfg.kind then\ncfg.buildtarget = p.config.gettargetinfo(cfg)\ncfg.buildtarget.relpath = p.project.getrelative(cfg.project, cfg.buildtarget.abspath)\ncfg.linktarget = p.config.getlinkinfo(cfg)\ncfg.linktarget.relpath = p.project.getrelative(cfg.project, cfg.linktarget.abspath)\nend\nend\n",

	"local p = premake\nfunction p.global.validate(self)\np.container.validateChildren(self)\nend\nfunction p.workspace.validate(self)\nif not self.configurations or #self.configurations == 0 then\np.error(\"workspace '%s' does not contain any configurations\", self.name)\nend\nlocal uuids = {}\nfor prj in p.workspace.eachproject(self) do\nif uuids[prj.uuid] then\np.error(\"projects '%s' and '%s' have the same UUID\", uuids[prj.uuid], prj.name)\nend\nuuids[prj.uuid] = prj.name\nend\np.container.validateChildren(self)\nend\nfunction p.project.validate(self)\nif not self.language then\np.error(\"project '%s' does not have a language\", self.name)\nend\nif not p.action.supports(self.language) then\np.warn(\"unsupported language '%s' used for project '%s'\", self.language, self.name)\nend\nif not p.action.supports(self.kind) then\np.warn(\"unsupported kind '%s' used for project '%s'\", self.kind, self.name)\nend\nfor i = 1, #self.rules do\nlocal rule = self.rules[i]\nif not p.global.getRule(rule) then\np.error(\"project '%s' uses missing rule '%s'\", self.name, rule)\nend\nend\np.config.validateScopes(self, self, \"project\")\nfor cfg in p.project.eachconfig(self) do\np.config.validate(cfg)\nend\nend\nfunction p.config.validate(self)\nif not self.kind then\np.error(\"project '%s' needs a kind in configuration '%s'\", self.project.name, self.name)\nend\nif (self.kind == p.MAKEFILE or self.kind == p.NONE) and not p.project.iscpp(self.project) then\np.error(\"project '%s' uses %s kind in configuration '%s'; language must be C++\", self.project.name, self.kind, self.name)\nend\np.config.validateScopes(self, self.project, \"config\")\nend\nfunction p.config.validateScopes(self, container, expected)\nfor f in p.field.each() do\nlocal scope\nfor i = 1, #f.scopes do\nif f.scopes[i] == \"config\" or p.container.classIsA(container.class, f.scopes[i]) then\nscope = f.scopes[i]\nbreak\nend\nend\nlocal okay = (not scope or scope == \"config\")\nokay = okay or scope == expected\nokay = okay or p.oven.bubbledFields[f.name]\nokay = okay or p.field.compare(f, self[scope][f.name], self[f.name])\nif not okay then\nlocal key = \"validate.\" .. f.name\np.warnOnce(key, \"'%s' on %s '%s' differs from %s '%s'; may be set out of scope\", f.name, expected, self.name, scope, self[scope].name)\nend\nend\nend\nfunction p.rule.validate(self)\nend\n",

	"local p = premake\nlocal _captured\nlocal _esc = function(v) return v end\nlocal _eol = \"\\n\"\nlocal _indentString = \"\\t\"\nlocal _indentLevel = 0\nglobal(\"root\")\nfunction premake.capture(fn)\nlocal old = _captured\n_captured = buffered.new()\nfn()\nlocal captured = premake.captured()\nbuffered.close(_captured)\n_captured = old\nreturn captured\nend\nfunction premake.captured()\nif _captured then\nreturn buffered.tostring(_captured)\nelse\nreturn \"\"\nend\nend\nfunction premake.eol(s)\n_eol = s or _eol\nreturn _eol\nend\nfunction premake.esc(value)\nif type(value) == \"table\" then\nlocal result = {}\nlocal n = #value\nfor i = 1, n do\ntable.insert(result, premake.esc(value[i]))\nend\nreturn result\nend\nreturn _esc(value or \"\")\nend\nfunction premake.escaper(func)\n_esc = func\nif not _esc then\n_esc = function (value) return value end\nend\nend\nfunction premake.generate(obj, ext, callback)\nlocal output = premake.capture(function ()\n_indentLevel = 0\ncallback(obj)\n_indentLevel = 0\nend)\nlocal fn = premake.filename(obj, ext)\nlocal dir = path.getdirectory(fn)\nok, err = os.mkdir(dir)\nif not ok then\nerror(err, 0)\nend\nlocal f, err = os.writefile_ifnotequal(output, fn);\nif (f < 0) then\nerror(err, 0)\nelseif (f > 0) then\nprintf(\"Generated %s...\", path.getrelative(os.getcwd(), fn))\nend\nend\nfunction premake.filename(obj, ext)\nlocal fname = obj.location or obj.basedir\nif ext and not ext:startswith(\".\") then\nfname = path.join(fname, ext)\nelse\nfname = path.join(fname, obj.filename)\nif ext then\nfname = fname .. ext\nend\nend\nreturn path.getabsolute(fname)\nend\nfunction premake.indent(s, i)\n_indentString = s or \"\\t\"\n_indentLevel = i or 0\nend\nfunction premake.out(s)\nif not _captured then\nio.write(s)\nelse\nbuffered.write(_captured, s)\nend\nend\nfunction premake.outln(s)\npremake.out(s)\npremake.out(_eol or \"\\n\")\nend\nfunction premake.pop(i, ...)\nif i == nil or type(i) == \"number\" then\n_indentLevel = _indentLevel - (i or 1)\nelse\n_indentLevel = _indentLevel - 1\npremake.w(i, ...)\nend\nend\nfunction premake.push(i, ...)\nif i == nil or type(i) == \"number\" then\n_indentLevel = _indentLevel + (i or 1)\nelse\npremake.w(i, ...)\n_indentLevel = _indentLevel + 1\nend\nend\nfunction premake.quoted(value)\nlocal q = value:find(\" \", 1, true)\nif not q then\nq = value:find(\"$%(.-%)\", 1)\nend\nif q then\nvalue = '\"' .. value .. '\"'\nend\nreturn value\nend\nfunction p.utf8()\np.out('\\239\\187\\191')\nend\nfunction premake.w(...)\nif select(\"#\", ...) > 0 then\npremake.outln(string.rep(_indentString or \"\\t\", _indentLevel) .. string.format(...))\nelse\npremake.outln('');\nend\nend\nfunction premake.x(msg, ...)\nlocal arg = {...}\nfor i = 1, #arg do\narg[i] = premake.esc(arg[i])\nend\npremake.w(msg, unpack(arg))\nend\nfunction premake.xmlUtf8(upper)\nlocal encoding = iif(upper, \"UTF-8\", \"utf-8\")\npremake.w('<?xml version=\"1.0\" encoding=\"%s\"?>', encoding)\nend\nfunction _p(i, ...)\nif type(i) == \"number\" then\n_indentLevel = i\npremake.w(...)\nelse\n_indentLevel = 0\npremake.w(i, ...)\nend\nend\nfunction _x(i, ...)\nlocal arg = {...}\nfor i = 2, #arg do\narg[i] = premake.esc(arg[i])\nend\n_p(i, unpack(arg))\nend\n",

	"function premake.showhelp()\nprintf(\"Premake %s, a build script generator\", _PREMAKE_VERSION)\nprintf(_PREMAKE_COPYRIGHT)\nprintf(\"%s %s\", _VERSION, _COPYRIGHT)\nprintf(\"\")\nprintf(\"Usage: premake5 [options] action [arguments]\")\nprintf(\"\")\nlocal categories = {}\nfor option in premake.option.each() do\nlocal cat = \"OPTIONS - General\"\nif option.category then\ncat = \"OPTIONS - \" .. option.category;\nend\nif categories[cat] then\ntable.insert(categories[cat], option)\nelse\ncategories[cat] = {option}\nend\nend\nfor k, options in pairs(categories) do\nprintf(k)\nprintf(\"\")\nfor _, option in ipairs(options) do\nlocal trigger = option.trigger\nlocal description = option.description\nif (option.value) then trigger = trigger .. \"=\" .. option.value end\nif (option.allowed) then description = description .. \"; one of:\" end\nprintf(\" --%-15s %s\", trigger, description)\nif (option.allowed) then\nfor _, value in ipairs(option.allowed) do\nprintf(\"     %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\nprintf(\"\")\nend\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor action in premake.action.each() do\nprintf(\" %-17s %s\", action.trigger, action.description)\nend\nprintf(\"\")\nprintf(\"For additional information, see http://industriousone.com/premake\")\nend\n",

	"premake.tools.dotnet = {}\nlocal dotnet = premake.tools.dotnet\nlocal project = premake.project\nlocal config = premake.config\nfunction dotnet.fileinfo(fcfg)\nlocal info = {}\nlocal fname = fcfg.abspath\nlocal ext = path.getextension(fname):lower()\nif fcfg.buildaction == \"Compile\" or ext == \".cs\" then\ninfo.action = \"Compile\"\nelseif fcfg.buildaction == \"Embed\" or ext == \".resx\" then\ninfo.action = \"EmbeddedResource\"\nelseif fcfg.buildaction == \"Copy\" or ext == \".asax\" or ext == \".aspx\" then\ninfo.action = \"Content\"\nelseif fcfg.buildaction == \"Resource\" then\ninfo.action = \"Resource\"\nelseif ext == \".xaml\" then\nif fcfg.buildaction == \"Application\" or path.getbasename(fname) == \"App\" then\ninfo.action = \"ApplicationDefinition\"\nelse\ninfo.action = \"Page\"\nend\nelse\ninfo.action = \"None\"\nend\nif info.action == \"Compile\" and fname:endswith(\".cs\") then\nif fname:endswith(\".Designer.cs\") then\nlocal basename = fname:sub(1, -13)\nlocal testname = basename .. \".resx\"\nif project.hasfile(fcfg.project, testname) then\ninfo.AutoGen = \"True\"\ninfo.DependentUpon = testname\nend\ntestname = basename .. \".settings\"\nif project.hasfile(fcfg.project, testname) then\ninfo.AutoGen = \"True\"\ninfo.DependentUpon = testname\ninfo.DesignTimeSharedInput = \"True\"\nend\ntestname = basename .. \".cs\"\nif project.hasfile(fcfg.project, testname) then\ninfo.AutoGen = nil\ninfo.SubType = \"Dependency\"\ninfo.DependentUpon = testname\nend\nelseif fname:endswith(\".xaml.cs\") then\ninfo.SubType = \"Code\"\ninfo.DependentUpon = fname:sub(1, -4)\nelse\nlocal basename = fname:sub(1, -4)\ntestname = basename .. \".Designer.cs\"\nif project.hasfile(fcfg.project, testname) then\ninfo.SubType = \"Form\"\nend\nend\nif fcfg.buildaction == \"Component\" or\n   fcfg.buildaction == \"Form\" or\n   fcfg.buildaction == \"UserControl\"\n   then\ninfo.SubType = fcfg.buildaction\nend\nif fcfg.flags and fcfg.flags.Component then\ninfo.SubType = \"Component\"\nend\nend\nif info.action == \"Content\" then\ninfo.CopyToOutputDirectory = \"PreserveNewest\"\nend\nif info.action == \"EmbeddedResource\" and fname:endswith(\".resx\") then\nlocal basename = fname:sub(1, -6)\nlocal testname = basename .. \".cs\"\nif project.hasfile(fcfg.project, testname) then\ninfo.DependentUpon = testname\nif project.hasfile(fcfg.project, basename .. \".Designer.cs\") then\ninfo.SubType = \"DesignerType\"\nend\nelse\ntestname = basename .. \".Designer.cs\"\nif project.hasfile(fcfg.project, testname) then\ninfo.SubType = \"Designer\"\ninfo.Generator = \"ResXFileCodeGenerator\"\ninfo.LastGenOutput = path.getname(testname)\nend\nend\nend\nif info.action == \"None\" and fname:endswith(\".settings\") then\nlocal testname = fname:sub(1, -10) .. \".Designer.cs\"\nif project.hasfile(fcfg.project, testname) then\ninfo.Generator = \"SettingsSingleFileGenerator\"\ninfo.LastGenOutput = path.getname(testname)\nend\nend\nif fname:endswith(\".xaml\") then\nlocal testname = fname .. \".cs\"\nif project.hasfile(fcfg.project, testname) then\ninfo.SubType = \"Designer\"\ninfo.Generator = \"MSBuild:Compile\"\nend\nend\nif info.DependentUpon then\ninfo.DependentUpon = path.getname(info.DependentUpon)\nend\nreturn info\nend\nfunction dotnet.gettoolname(cfg, tool)\nlocal compilers = {\nmsnet = \"csc\",\nmono = \"mcs\",\npnet = \"cscc\",\n}\nif tool == \"csc\" then\nlocal toolset = _OPTIONS.dotnet or iif(os.is(premake.WINDOWS), \"msnet\", \"mono\")\nreturn compilers[toolset]\nelse\nreturn \"resgen\"\nend\nend\ndotnet.flags = {\nclr = {\nUnsafe = \"/unsafe\",\n},\nflags = {\nFatalWarning = \"/warnaserror\",\nSymbols = \"/debug\",\n},\noptimize = {\nOn = \"/optimize\",\nSize = \"/optimize\",\nSpeed = \"/optimize\",\n},\n}\nfunction dotnet.getflags(cfg)\nlocal flags = config.mapFlags(cfg, dotnet.flags)\ntable.insert(flags, '/noconfig')\nif cfg.project.icon then\nlocal fn = project.getrelative(cfg.project, cfg.project.icon)\ntable.insert(flags, string.format('/win32icon:\"%s\"', fn))\nend\nif #cfg.defines > 0 then\ntable.insert(flags, table.implode(cfg.defines, \"/d:"
	"\", \"\", \" \"))\nend\nreturn table.join(flags, cfg.buildoptions)\nend\nfunction dotnet.getkind(cfg)\nif (cfg.kind == \"ConsoleApp\") then\nreturn \"Exe\"\nelseif (cfg.kind == \"WindowedApp\") then\nreturn \"WinExe\"\nelseif (cfg.kind == \"SharedLib\") then\nreturn \"Library\"\nend\nend\nfunction dotnet.getmakesettings(cfg)\nreturn nil\nend\n",

	"local p = premake\np.tools.gcc = {}\nlocal gcc = p.tools.gcc\nlocal project = p.project\nlocal config = p.config\ngcc.cppflags = {\nsystem = {\nhaiku = \"-MMD\",\nwii = { \"-MMD\", \"-MP\", \"-I$(LIBOGC_INC)\", \"$(MACHDEP)\" },\n_ = { \"-MMD\", \"-MP\" }\n}\n}\nfunction gcc.getcppflags(cfg)\nlocal flags = config.mapFlags(cfg, gcc.cppflags)\nreturn flags\nend\ngcc.cflags = {\narchitecture = {\nx86 = \"-m32\",\nx86_64 = \"-m64\",\n},\nflags = {\nFatalCompileWarnings = \"-Werror\",\nLinkTimeOptimization = \"-flto\",\nNoFramePointer = \"-fomit-frame-pointer\",\nShadowedVariables = \"-Wshadow\",\nSymbols = \"-g\",\nUndefinedIdentifiers = \"-Wundef\",\n},\nfloatingpoint = {\nFast = \"-ffast-math\",\nStrict = \"-ffloat-store\",\n},\nstrictaliasing = {\nOff = \"-fno-strict-aliasing\",\nLevel1 = { \"-fstrict-aliasing\", \"-Wstrict-aliasing=1\" },\nLevel2 = { \"-fstrict-aliasing\", \"-Wstrict-aliasing=2\" },\nLevel3 = { \"-fstrict-aliasing\", \"-Wstrict-aliasing=3\" },\n},\noptimize = {\nOff = \"-O0\",\nOn = \"-O2\",\nDebug = \"-Og\",\nFull = \"-O3\",\nSize = \"-Os\",\nSpeed = \"-O3\",\n},\npic = {\nOn = \"-fPIC\",\n},\nvectorextensions = {\nAVX = \"-mavx\",\nAVX2 = \"-mavx2\",\nSSE = \"-msse\",\nSSE2 = \"-msse2\",\nSSE3 = \"-msse3\",\nSSSE3 = \"-mssse3\",\n[\"SSE4.1\"] = \"-msse4.1\",\n},\nwarnings = {\nExtra = \"-Wall -Wextra\",\nOff = \"-w\",\n}\n}\nfunction gcc.getcflags(cfg)\nlocal flags = config.mapFlags(cfg, gcc.cflags)\nflags = table.join(flags, gcc.getwarnings(cfg))\nreturn flags\nend\nfunction gcc.getwarnings(cfg)\nlocal result = {}\nfor _, enable in ipairs(cfg.enablewarnings) do\ntable.insert(result, '-W' .. enable)\nend\nfor _, disable in ipairs(cfg.disablewarnings) do\ntable.insert(result, '-Wno-' .. disable)\nend\nfor _, fatal in ipairs(cfg.fatalwarnings) do\ntable.insert(result, '-Werror=' .. fatal)\nend\nreturn result\nend\ngcc.cxxflags = {\nexceptionhandling = {\nOff = \"-fno-exceptions\"\n},\nflags = {\nNoBufferSecurityCheck = \"-fno-stack-protector\",\n[\"C++11\"] = \"-std=c++11\",\n[\"C++14\"] = \"-std=c++14\",\n},\nrtti = {\nOff = \"-fno-rtti\"\n}\n}\nfunction gcc.getcxxflags(cfg)\nlocal flags = config.mapFlags(cfg, gcc.cxxflags)\nreturn flags\nend\nfunction gcc.getdefines(defines)\nlocal result = {}\nfor _, define in ipairs(defines) do\ntable.insert(result, '-D' .. define)\nend\nreturn result\nend\nfunction gcc.getundefines(undefines)\nlocal result = {}\nfor _, undefine in ipairs(undefines) do\ntable.insert(result, '-U' .. undefine)\nend\nreturn result\nend\nfunction gcc.getforceincludes(cfg)\nlocal result = {}\ntable.foreachi(cfg.forceincludes, function(value)\nlocal fn = project.getrelative(cfg.project, value)\ntable.insert(result, string.format('-include %s', premake.quoted(fn)))\nend)\nreturn result\nend\nfunction gcc.getincludedirs(cfg, dirs, sysdirs)\nlocal result = {}\nfor _, dir in ipairs(dirs) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(result, '-I' .. premake.quoted(dir))\nend\nfor _, dir in ipairs(sysdirs or {}) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(result, '-isystem ' .. premake.quoted(dir))\nend\nreturn result\nend\ngcc.ldflags = {\narchitecture = {\nx86 = \"-m32\",\nx86_64 = \"-m64\",\n},\nflags = {\nLinkTimeOptimization = \"-flto\",\n_Symbols = function(cfg)\nreturn iif(cfg.system == premake.MACOSX, \"-Wl,-x\", \"-s\")\nend,\n},\nkind = {\nSharedLib = function(cfg)\nlocal r = { iif(cfg.system == premake.MACOSX, \"-dynamiclib\", \"-shared\") }\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(r, '-Wl,--out-implib=\"' .. cfg.linktarget.relpath .. '\"')\nend\nreturn r\nend,\nWindowedApp = function(cfg)\nif cfg.system == premake.WINDOWS then return \"-mwindows\" end\nend,\n},\nsystem = {\nwii = \"$(MACHDEP)\",\n}\n}\nfunction gcc.getldflags(cfg)\nlocal flags = config.mapFlags(cfg, gcc.ldflags)\nreturn flags\nend\ngcc.libraryDirectories = {\narchitecture = {\nx86 = \"-L/usr/lib32\",\nx86_64 = \"-L/usr/lib64\",\n},\nsystem = {\nwii = \"-L$(LIBOGC_LIB)\",\n}\n}\nfunction gcc.getLibraryDirectories(cfg)\nlocal flags = config.mapFlags"
	"(cfg, gcc.libraryDirectories)\nlocal done = {}\nfor _, link in ipairs(config.getlinks(cfg, \"system\", \"fullpath\")) do\nlocal dir = path.getdirectory(link)\nif #dir > 1 and not done[dir] then\n done[dir] = true\nif path.isframework(link) then\ntable.insert(flags, '-F' .. premake.quoted(dir))\nelse\ntable.insert(flags, '-L' .. premake.quoted(dir))\nend\nend\nend\nif cfg.flags.RelativeLinks then\nfor _, dir in ipairs(config.getlinks(cfg, \"siblings\", \"directory\")) do\nlocal libFlag = \"-L\" .. premake.project.getrelative(cfg.project, dir)\nif not table.contains(flags, libFlag) then\ntable.insert(flags, libFlag)\nend\nend\nend\nfor _, dir in ipairs(cfg.syslibdirs) do\ntable.insert(flags, '-L' .. premake.quoted(dir))\nend\nreturn flags\nend\nfunction gcc.getlinks(cfg, systemonly)\nlocal result = {}\nif not systemonly then\nif cfg.flags.RelativeLinks then\nlocal libFiles = config.getlinks(cfg, \"siblings\", \"basename\")\nfor _, link in ipairs(libFiles) do\nif string.find(link, \"lib\") == 1 then\nlink = link:sub(4)\nend\ntable.insert(result, \"-l\" .. link)\nend\nelse\nresult = config.getlinks(cfg, \"siblings\", \"fullpath\")\nend\nend\nif #result > 1 then\ntable.insert(result, 1, \"-Wl,--start-group\")\ntable.insert(result, \"-Wl,--end-group\")\nend\nlocal links = config.getlinks(cfg, \"system\", \"fullpath\")\nfor _, link in ipairs(links) do\nif path.isframework(link) then\ntable.insert(result, \"-framework \" .. path.getbasename(link))\nelseif path.isobjectfile(link) then\ntable.insert(result, link)\nelse\ntable.insert(result, \"-l\" .. path.getname(link))\nend\nend\nreturn result\nend\ngcc.makesettings = {\nsystem = {\nwii = [[\n  ifeq ($(strip $(DEVKITPPC)),)\n    $(error \"DEVKITPPC environment variable is not set\")'\n  endif\n  include $(DEVKITPPC)/wii_rules']]\n}\n}\nfunction gcc.getmakesettings(cfg)\nlocal settings = config.mapFlags(cfg, gcc.makesettings)\nreturn table.concat(settings)\nend\ngcc.tools = {\ncc = \"gcc\",\ncxx = \"g++\",\nar = \"ar\",\nrc = \"windres\"\n}\nfunction gcc.gettoolname(cfg, tool)\nif (cfg.gccprefix and gcc.tools[tool]) or tool == \"rc\" then\nreturn (cfg.gccprefix or \"\") .. gcc.tools[tool]\nend\nreturn nil\nend\n",

	"local p = premake\np.tools.msc = {}\nlocal msc = p.tools.msc\nlocal project = p.project\nlocal config = p.config\nfunction msc.getcppflags(cfg)\nreturn {}\nend\nmsc.cflags = {\nclr = {\nOn = \"/clr\",\nUnsafe = \"/clr\",\nPure = \"/clr:pure\",\nSafe = \"/clr:safe\",\n},\nflags = {\nFatalCompileWarnings = \"/WX\",\nMultiProcessorCompile = \"/MP\",\nNoFramePointer = \"/Oy\",\nNoMinimalRebuild = \"/Gm-\",\nSymbols = \"/Z7\",\nOmitDefaultLibrary = \"/Zl\",\n},\nfloatingpoint = {\nFast = \"/fp:fast\",\nStrict = \"/fp:strict\",\n},\ncallingconvention = {\nCdecl = \"/Gd\",\nFastCall = \"/Gr\",\nStdCall = \"/Gz\",\nVectorCall = \"/Gv\",\n},\noptimize = {\nOff = \"/Od\",\nOn = \"/Ot\",\nDebug = \"/Od\",\nFull = \"/Ox\",\nSize = \"/O1\",\nSpeed = \"/O2\",\n},\nvectorextensions = {\nAVX = \"/arch:AVX\",\nAVX2 = \"/arch:AVX2\",\nSSE = \"/arch:SSE\",\nSSE2 = \"/arch:SSE2\",\nSSE3 = \"/arch:SSE2\",\nSSSE3 = \"/arch:SSE2\",\n[\"SSE4.1\"] = \"/arch:SSE2\",\n},\nwarnings = {\nExtra = \"/W4\",\nOff = \"/W0\",\n}\n}\nfunction msc.getcflags(cfg)\nlocal flags = config.mapFlags(cfg, msc.cflags)\nflags = table.join(flags, msc.getwarnings(cfg))\nlocal runtime = iif(cfg.flags.StaticRuntime, \"/MT\", \"/MD\")\nif config.isDebugBuild(cfg) then\nruntime = runtime .. \"d\"\nend\ntable.insert(flags, runtime)\nreturn flags\nend\nfunction msc.getwarnings(cfg)\nlocal result = {}\nfor _, disable in ipairs(cfg.disablewarnings) do\ntable.insert(result, '/wd\"' .. disable .. '\"')\nend\nfor _, fatal in ipairs(cfg.fatalwarnings) do\ntable.insert(result, '/we\"' .. fatal .. '\"')\nend\nreturn result\nend\nmsc.cxxflags = {\nexceptionhandling = {\nDefault = \"/EHsc\",\nOn = \"/EHsc\",\nSEH = \"/EHa\",\n},\nrtti = {\nOff = \"/GR-\"\n}\n}\nfunction msc.getcxxflags(cfg)\nlocal flags = config.mapFlags(cfg, msc.cxxflags)\nreturn flags\nend\nfunction msc.getdefines(defines)\nlocal result = {}\nfor _, define in ipairs(defines) do\ntable.insert(result, '/D\"' .. define .. '\"')\nend\nreturn result\nend\nfunction msc.getundefines(undefines)\nlocal result = {}\nfor _, undefine in ipairs(undefines) do\ntable.insert(result, '/U\"' .. undefine .. '\"')\nend\nreturn result\nend\nfunction msc.getforceincludes(cfg)\nlocal result = {}\ntable.foreachi(cfg.forceincludes, function(value)\nlocal fn = project.getrelative(cfg.project, value)\ntable.insert(result, \"/FI\" .. premake.quoted(fn))\nend)\nreturn result\nend\nfunction msc.getincludedirs(cfg, dirs, sysdirs)\nlocal result = {}\ndirs = table.join(dirs, sysdirs)\nfor _, dir in ipairs(dirs) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(result, '-I' ..  premake.quoted(dir))\nend\nreturn result\nend\nmsc.linkerFlags = {\nflags = {\nFatalLinkWarnings = \"/WX\",\nLinkTimeOptimization = \"/GL\",\nNoIncrementalLink = \"/INCREMENTAL:NO\",\nNoManifest = \"/MANIFEST:NO\",\nOmitDefaultLibrary = \"/NODEFAULTLIB\",\nSymbols = \"/DEBUG\",\n},\nkind = {\nSharedLib = \"/DLL\",\n}\n}\nmsc.librarianFlags = {\nflags = {\nFatalLinkWarnings = \"/WX\",\n}\n}\nfunction msc.getldflags(cfg)\nlocal map = iif(cfg.kind ~= premake.STATICLIB, msc.linkerFlags, msc.librarianFlags)\nlocal flags = config.mapFlags(cfg, map)\ntable.insert(flags, 1, \"/NOLOGO\")\nfor i, ignore in ipairs(cfg.ignoredefaultlibraries) do\nif not msc.getLibraryExtensions()[ignore:match(\"[^.]+$\")] then\nignore = path.appendextension(ignore, \".lib\")\nend\ntable.insert(flags, '/NODEFAULTLIB:' .. ignore)\nend\nreturn flags\nend\nfunction msc.getLibraryDirectories(cfg)\nlocal flags = {}\nlocal dirs = table.join(cfg.libdirs, cfg.syslibdirs)\nfor i, dir in ipairs(dirs) do\ndir = project.getrelative(cfg.project, dir)\ntable.insert(flags, '/LIBPATH:\"' .. dir .. '\"')\nend\nreturn flags\nend\nfunction msc.getLibraryExtensions()\nreturn {\n[\"lib\"] = true,\n[\"obj\"] = true,\n}\nend\nfunction msc.getlinks(cfg)\nlocal links = config.getlinks(cfg, \"system\", \"fullpath\")\nfor i = 1, #links do\nif not msc.getLibraryExtensions()[links[i]:match(\"[^.]+$\")] then\nlinks[i] = path.appendextension(links[i], \".lib\")\nend\nend\nreturn links\nend\nfunction msc.getmakesettings(cfg)"
	"\nreturn nil\nend\nfunction msc.gettoolname(cfg, tool)\nreturn nil\nend\n",

	"premake.tools.snc = {}\nlocal snc = premake.tools.snc\nlocal gcc = premake.tools.gcc\nlocal config = premake.config\nsnc.cflags = {\nflags = {\nFatalCompileWarnings = \"-Xquit=2\",\n},\noptimize = {\nOff = \"-O0\",\nOn = \"-O1\",\nDebug = \"-Od\",\nFull = \"-O3\",\nSize = \"-Os\",\nSpeed = \"-O2\",\n},\nwarnings = {\nExtra = \"-Xdiag=2\",\n}\n}\nfunction snc.getcflags(cfg)\nlocal flags = config.mapFlags(cfg, snc.cflags)\nreturn flags\nend\nfunction snc.getcxxflags(cfg)\nlocal flags = {}\nif cfg.exceptionhandling == p.ON then\ntable.insert(flags, \"-Xc+=exceptions\")\nelseif cfg.exceptionhandling == p.OFF then\ntable.insert(flags, \"-Xc-=exceptions\")\nend\nif cfg.rtti == p.ON then\ntable.insert(flags, \"-Xc+=rtti\")\nelseif cfg.rtti == p.OFF then\ntable.insert(flags, \"-Xc-=rtti\")\nend\nreturn flags\nend\nfunction snc.getforceincludes(cfg)\nlocal flags = gcc.getforceincludes(cfg)\nreturn flags\nend\nfunction snc.getldflags(cfg)\nlocal flags = { }\nif not cfg.flags.Symbols then\ntable.insert(flags, \"-s\")\nend\nreturn flags\nend\nsnc.getcppflags = gcc.getcppflags\nsnc.getdefines = gcc.getdefines\nsnc.getincludedirs = gcc.getincludedirs\nsnc.getLibraryDirectories = gcc.getLibraryDirectories\nsnc.getlinks = gcc.getlinks\nfunction snc.getmakesettings(cfg)\nreturn nil\nend\nsnc.tools = {\n}\nfunction snc.gettoolname(cfg, tool)\nlocal names = snc.tools[cfg.architecture] or snc.tools[cfg.system] or {}\nreturn names[tool]\nend\n",

	"premake.tools.clang = {}\nlocal clang = premake.tools.clang\nlocal gcc = premake.tools.gcc\nlocal config = premake.config\nfunction clang.getcppflags(cfg)\nlocal flags = gcc.getcppflags(cfg)\nreturn flags\nend\nfunction clang.getcflags(cfg)\nlocal flags = gcc.getcflags(cfg)\nreturn flags\nend\nfunction clang.getcxxflags(cfg)\nlocal flags = gcc.getcxxflags(cfg)\nreturn flags\nend\nfunction clang.getdefines(defines)\nlocal flags = gcc.getdefines(defines)\nreturn flags\nend\nfunction clang.getundefines(undefines)\nlocal flags = gcc.getundefines(undefines)\nreturn flags\nend\nfunction clang.getforceincludes(cfg)\nlocal flags = gcc.getforceincludes(cfg)\nreturn flags\nend\nfunction clang.getincludedirs(cfg, dirs, sysdirs)\nlocal flags = gcc.getincludedirs(cfg, dirs, sysdirs)\nreturn flags\nend\nclang.ldflags = {\narchitecture = {\nx86 = \"-m32\",\nx86_64 = \"-m64\",\n},\nflags = {\nLinkTimeOptimization = \"-flto\",\n},\nkind = {\nSharedLib = function(cfg)\nlocal r = { iif(cfg.system == premake.MACOSX, \"-dynamiclib\", \"-shared\") }\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(r, '-Wl,--out-implib=\"' .. cfg.linktarget.relpath .. '\"')\nend\nreturn r\nend,\nWindowedApp = function(cfg)\nif cfg.system == premake.WINDOWS then return \"-mwindows\" end\nend,\n},\nsystem = {\nwii = \"$(MACHDEP)\",\n}\n}\nfunction clang.getldflags(cfg)\nlocal flags = config.mapFlags(cfg, clang.ldflags)\nreturn flags\nend\nfunction clang.getLibraryDirectories(cfg)\nlocal flags = gcc.getLibraryDirectories(cfg)\nreturn flags\nend\nfunction clang.getlinks(cfg, systemOnly)\nlocal flags = gcc.getlinks(cfg, systemOnly)\nreturn flags\nend\nfunction clang.getmakesettings(cfg)\nlocal flags = gcc.getmakesettings(cfg)\nreturn flags\nend\nclang.tools = {\ncc = \"clang\",\ncxx = \"clang++\",\nar = \"ar\"\n}\nfunction clang.gettoolname(cfg, tool)\nreturn clang.tools[tool]\nend\n",

	"premake.make = {}\nlocal p = premake\nlocal make = p.make\nlocal project = p.project\nnewaction {\ntrigger         = \"gmake\",\nshortname       = \"GNU Make\",\ndescription     = \"Generate GNU makefiles for POSIX, MinGW, and Cygwin\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"clang\", \"gcc\" },\ndotnet = { \"mono\", \"msnet\", \"pnet\" }\n},\nonWorkspace = function(wks)\npremake.escaper(make.esc)\npremake.generate(wks, make.getmakefilename(wks, false), make.generate_workspace)\nend,\nonProject = function(prj)\npremake.escaper(make.esc)\nlocal makefile = make.getmakefilename(prj, true)\nif project.isdotnet(prj) then\npremake.generate(prj, makefile, make.cs.generate)\nelseif project.iscpp(prj) then\npremake.generate(prj, makefile, make.cpp.generate)\nend\nend,\nonCleanWorkspace = function(wks)\npremake.clean.file(wks, make.getmakefilename(wks, false))\nend,\nonCleanProject = function(prj)\npremake.clean.file(prj, make.getmakefilename(prj, true))\nend\n}\nfunction make.defaultconfig(target)\nlocal eachconfig = iif(target.project, project.eachconfig, p.workspace.eachconfig)\nlocal iter = eachconfig(target)\nlocal cfg = iter()\nif cfg then\n_p('ifndef config')\n_x('  config=%s', cfg.shortname)\n_p('endif')\n_p('')\nend\nend\nfunction make.esc(value)\nresult = value:gsub(\"\\\\\", \"\\\\\\\\\")\nresult = result:gsub(\" \", \"\\\\ \")\nresult = result:gsub(\"%(\", \"\\\\(\")\nresult = result:gsub(\"%)\", \"\\\\)\")\nresult = result:gsub(\"$\\\\%((.-)\\\\%)\", \"$(%1)\")\nreturn result\nend\nfunction make.getmakefilename(this, searchprjs)\nlocal count = 0\nfor wks in p.global.eachWorkspace() do\nif wks.location == this.location then\ncount = count + 1\nend\nif searchprjs then\nfor _, prj in ipairs(wks.projects) do\nif prj.location == this.location then\ncount = count + 1\nend\nend\nend\nend\nif count == 1 then\nreturn \"Makefile\"\nelse\nreturn \".make\"\nend\nend\nfunction make.header(target)\nlocal kind = iif(target.project, \"project\", \"workspace\")\n_p('# %s %s makefile autogenerated by Premake', premake.action.current().shortname, kind)\n_p('')\nif kind == \"workspace\" then\n_p('.NOTPARALLEL:')\n_p('')\nend\nmake.defaultconfig(target)\n_p('ifndef verbose')\n_p('  SILENT = @')\n_p('endif')\n_p('')\nend\nfunction make.mkdirRules(dirname)\n_p('%s:', dirname)\n_p('\\t@echo Creating %s', dirname)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) mkdir -p %s', dirname)\n_p('else')\n_p('\\t$(SILENT) mkdir $(subst /,\\\\\\\\,%s)', dirname)\n_p('endif')\n_p('')\nend\nfunction make.list(value)\nif #value > 0 then\nreturn \" \" .. table.concat(value, \" \")\nelse\nreturn \"\"\nend\nend\nfunction make.tovar(value)\nvalue = value:gsub(\"[ -]\", \"_\")\nvalue = value:gsub(\"[()]\", \"\")\nreturn value\nend\nfunction make.objdir(cfg)\n_x('  OBJDIR = %s', project.getrelative(cfg.project, cfg.objdir))\nend\nfunction make.objDirRules(prj)\nmake.mkdirRules(\"$(OBJDIR)\")\nend\nfunction make.phonyRules(prj)\n_p('.PHONY: clean prebuild prelink')\n_p('')\nend\nfunction make.buildCmds(cfg, event)\n_p('  define %sCMDS', event:upper())\nlocal steps = cfg[event .. \"commands\"]\nlocal msg = cfg[event .. \"message\"]\nif #steps > 0 then\nsteps = os.translateCommands(steps)\nmsg = msg or string.format(\"Running %s commands\", event)\n_p('\\t@echo %s', msg)\n_p('\\t%s', table.implode(steps, \"\", \"\", \"\\n\\t\"))\nend\n_p('  endef')\nend\nfunction make.preBuildCmds(cfg, toolset)\nmake.buildCmds(cfg, \"prebuild\")\nend\nfunction make.preBuildRules(prj)\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\nend\nfunction make.preLinkCmds(cfg, toolset)\nmake.buildCmds(cfg, \"prelink\")\nend\nfunction make.preLinkRules(prj)\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\nend\nfunction make.postBuildCmds(cfg, toolset)\nmake.buildCmds(cfg, \"postbuild\")\nend\nfunction make.settings(cfg, toolset)\nif #cfg.makesettings > 0 then\nfor _, value in ipairs(cfg.makesettings) do\n_p(value)\nend\nend\nlocal value = toolset.getmakesettin"
	"gs(cfg)\nif value then\n_p(value)\nend\nend\nfunction make.shellType()\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('')\nend\nfunction make.target(cfg)\n_x('  TARGETDIR = %s', project.getrelative(cfg.project, cfg.buildtarget.directory))\n_x('  TARGET = $(TARGETDIR)/%s', cfg.buildtarget.name)\nend\nfunction make.targetDirRules(prj)\nmake.mkdirRules(\"$(TARGETDIR)\")\nend\n",

	"local p = premake\nlocal make = p.make\nlocal tree = p.tree\nlocal project = p.project\nfunction make.generate_workspace(wks)\np.eol(\"\\n\")\nmake.header(wks)\nmake.configmap(wks)\nmake.projects(wks)\nmake.workspacePhonyRule(wks)\nmake.groupRules(wks)\nmake.projectrules(wks)\nmake.cleanrules(wks)\nmake.helprule(wks)\nend\nfunction make.configmap(wks)\nfor cfg in p.workspace.eachconfig(wks) do\n_p('ifeq ($(config),%s)', cfg.shortname)\nfor prj in p.workspace.eachproject(wks) do\nlocal prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)\nif prjcfg then\n_p('  %s_config = %s', make.tovar(prj.name), prjcfg.shortname)\nend\nend\n_p('endif')\nend\n_p('')\nend\nfunction make.cleanrules(wks)\n_p('clean:')\nfor prj in p.workspace.eachproject(wks) do\nlocal prjpath = premake.filename(prj, make.getmakefilename(prj, true))\nlocal prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))\nlocal prjname = path.getname(prjpath)\n_x(1,'@${MAKE} --no-print-directory -C %s -f %s clean', prjdir, prjname)\nend\n_p('')\nend\nfunction make.helprule(wks)\n_p('help:')\n_p(1,'@echo \"Usage: make [config=name] [target]\"')\n_p(1,'@echo \"\"')\n_p(1,'@echo \"CONFIGURATIONS:\"')\nfor cfg in p.workspace.eachconfig(wks) do\n_x(1, '@echo \"  %s\"', cfg.shortname)\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"TARGETS:\"')\n_p(1,'@echo \"   all (default)\"')\n_p(1,'@echo \"   clean\"')\nfor prj in p.workspace.eachproject(wks) do\n_p(1,'@echo \"   %s\"', prj.name)\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"For more information, see http://industriousone.com/premake/quick-start\"')\nend\nfunction make.projects(wks)\n_p('PROJECTS := %s', table.concat(premake.esc(table.extract(wks.projects, \"name\")), \" \"))\n_p('')\nend\nfunction make.workspacePhonyRule(wks)\nlocal groups = {}\nlocal tr = p.workspace.grouptree(wks)\ntree.traverse(tr, {\nonbranch = function(n)\ntable.insert(groups, n.path)\nend\n})\n_p('.PHONY: all clean help $(PROJECTS) ' .. table.implode(groups, '', '', ' '))\n_p('')\n_p('all: $(PROJECTS)')\n_p('')\nend\nfunction make.groupRules(wks)\nlocal tr = p.workspace.grouptree(wks)\ntree.traverse(tr, {\nonbranch = function(n)\nlocal rule = n.path .. \":\"\nlocal projectTargets = {}\nlocal groupTargets = {}\nfor i, c in pairs(n.children)\ndo\nif type(i) == \"string\"\nthen\nif c.project\nthen\ntable.insert(projectTargets, c.name)\nelse\ntable.insert(groupTargets, c.path)\nend\nend\nend\nif #groupTargets > 0 then\nrule = rule .. \" \" .. table.concat(groupTargets, \" \")\nend\nif #projectTargets > 0 then\nrule = rule .. \" \" .. table.concat(projectTargets, \" \")\nend\n_p(rule)\n_p('')\nend\n})\nend\nfunction make.projectrules(wks)\nfor prj in p.workspace.eachproject(wks) do\nlocal deps = project.getdependencies(prj)\ndeps = table.extract(deps, \"name\")\n_p('%s:%s', premake.esc(prj.name), make.list(deps))\nlocal cfgvar = make.tovar(prj.name)\n_p('ifneq (,$(%s_config))', cfgvar)\n_p(1,'@echo \"==== Building %s ($(%s_config)) ====\"', prj.name, cfgvar)\nlocal prjpath = premake.filename(prj, make.getmakefilename(prj, true))\nlocal prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))\nlocal prjname = path.getname(prjpath)\n_x(1,'@${MAKE} --no-print-directory -C %s -f %s config=$(%s_config)', prjdir, prjname, cfgvar)\n_p('endif')\n_p('')\nend\nend\n",

	"local p = premake\np.make.cpp = {}\nlocal make = p.make\nlocal cpp = p.make.cpp\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\ncpp.elements = {}\ncpp.elements.makefile = function(prj)\nreturn {\nmake.header,\nmake.phonyRules,\nmake.cppConfigs,\nmake.cppObjects,\nmake.shellType,\nmake.cppTargetRules,\nmake.targetDirRules,\nmake.objDirRules,\nmake.cppCleanRules,\nmake.preBuildRules,\nmake.preLinkRules,\nmake.pchRules,\nmake.cppFileRules,\nmake.cppDependencies,\n}\nend\nfunction make.cpp.generate(prj)\npremake.eol(\"\\n\")\npremake.callArray(cpp.elements.makefile, prj)\nend\ncpp.elements.configuration = function(cfg)\nreturn {\nmake.cppTools,\nmake.target,\nmake.objdir,\nmake.pch,\nmake.defines,\nmake.includes,\nmake.forceInclude,\nmake.cppFlags,\nmake.cFlags,\nmake.cxxFlags,\nmake.resFlags,\nmake.libs,\nmake.ldDeps,\nmake.ldFlags,\nmake.linkCmd,\nmake.preBuildCmds,\nmake.preLinkCmds,\nmake.postBuildCmds,\nmake.cppAllRules,\nmake.settings,\n}\nend\nfunction make.cppConfigs(prj)\nfor cfg in project.eachconfig(prj) do\nlocal toolset = premake.tools[cfg.toolset or \"gcc\"]\nif not toolset then\nerror(\"Invalid toolset '\" .. cfg.toolset .. \"'\")\nend\n_x('ifeq ($(config),%s)', cfg.shortname)\npremake.callArray(cpp.elements.configuration, cfg, toolset)\n_p('endif')\n_p('')\nend\nend\nfunction cpp.buildcommand(prj, objext, node)\nlocal iscfile = node and path.iscfile(node.abspath) or false\nlocal flags = iif(prj.language == \"C\" or iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF \"$(@:%%.%s=%%.d)\" -c \"$<\"', flags, objext)\nend\nfunction make.cppFileRules(prj)\nlocal tr = project.getsourcetree(prj)\npremake.tree.traverse(tr, {\nonleaf = function(node, depth)\nlocal rules\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif fileconfig.hasCustomBuildRule(filecfg) then\nrules = true\nbreak\nend\nend\nif rules then\ncpp.customFileRules(prj, node)\nelse\ncpp.standardFileRules(prj, node)\nend\nend\n})\n_p('')\nend\nfunction cpp.standardFileRules(prj, node)\nif path.iscppfile(node.abspath) then\n_x('$(OBJDIR)/%s.o: %s', node.objname, node.relpath)\n_p('\\t@echo $(notdir $<)')\ncpp.buildcommand(prj, \"o\", node)\nelseif path.isresourcefile(node.abspath) then\n_x('$(OBJDIR)/%s.res: %s', node.objname, node.relpath)\n_p('\\t@echo $(notdir $<)')\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\nend\nend\nfunction cpp.customFileRules(prj, node)\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif filecfg then\n_x('ifeq ($(config),%s)', cfg.shortname)\nlocal output = project.getrelative(prj, filecfg.buildoutputs[1])\nlocal dependencies = filecfg.relpath\nif filecfg.buildinputs and #filecfg.buildinputs > 0 then\nlocal inputs = project.getrelative(prj, filecfg.buildinputs)\ndependencies = dependencies .. \" \" .. table.concat(p.esc(inputs), \" \")\nend\n_p('%s: %s', output, dependencies)\n_p('\\t@echo \"%s\"', filecfg.buildmessage or (\"Building \" .. filecfg.relpath))\nlocal cmds = os.translateCommands(filecfg.buildcommands)\nfor _, cmd in ipairs(cmds) do\n_p('\\t$(SILENT) %s', cmd)\nend\n_p('endif')\nend\nend\nend\nfunction make.cppObjects(prj)\nlocal root = { objects={}, resources={}, customfiles={} }\nlocal configs = {}\nfor cfg in project.eachconfig(prj) do\nconfigs[cfg] = { objects={}, resources={}, customfiles={} }\nend\nlocal tr = project.getsourcetree(prj)\npremake.tree.traverse(tr, {\nonleaf = function(node, depth)\nlocal incfg = {}\nlocal inall = true\nlocal custom = false\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = fileconfig.getconfig(node, cfg)\nif filecfg and not filecfg.flags.ExcludeFromBuild then\nincfg[cfg] = filecfg\ncustom = fileconfig.hasCustomBuildRule(filecfg)\nelse\ninall = false\nend\nend\nif not custom then\nlocal kind\nif path.iscppfile(node.abspath) then\nkind = \"objects\"\nelseif path.isresourcefile(node.abspath) then\nkind = \"resources\"\nend\nif not custom and not kind then\nreturn\nend\nobjectname = \""
	"$(OBJDIR)/\" .. node.objname .. iif(kind == \"objects\", \".o\", \".res\")\nif inall then\ntable.insert(root[kind], objectname)\nelse\nfor cfg in project.eachconfig(prj) do\nif incfg[cfg] then\ntable.insert(configs[cfg][kind], objectname)\nend\nend\nend\nelse\nfor cfg in project.eachconfig(prj) do\nlocal filecfg = incfg[cfg]\nif filecfg then\nlocal output = project.getrelative(prj, filecfg.buildoutputs[1])\nif path.isobjectfile(output) then\ntable.insert(configs[cfg].objects, output)\nelse\ntable.insert(configs[cfg].customfiles, output)\nend\nend\nend\nend\nend\n})\nfunction listobjects(var, list)\n_p('%s \\\\', var)\nfor _, objectname in ipairs(list) do\n_x('\\t%s \\\\', objectname)\nend\n_p('')\nend\nlistobjects('OBJECTS :=', root.objects, 'o')\nlistobjects('RESOURCES :=', root.resources, 'res')\nlistobjects('CUSTOMFILES :=', root.customfiles)\nfor cfg in project.eachconfig(prj) do\nlocal files = configs[cfg]\nif #files.objects > 0 or #files.resources > 0 or #files.customfiles > 0 then\n_x('ifeq ($(config),%s)', cfg.shortname)\nif #files.objects > 0 then\nlistobjects('  OBJECTS +=', files.objects)\nend\nif #files.resources > 0 then\nlistobjects('  RESOURCES +=', files.resources)\nend\nif #files.customfiles > 0 then\nlistobjects('  CUSTOMFILES +=', files.customfiles)\nend\n_p('endif')\n_p('')\nend\nend\nend\nfunction make.cFlags(cfg, toolset)\n_p('  ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)%s', make.list(table.join(toolset.getcflags(cfg), cfg.buildoptions)))\nend\nfunction make.cppAllRules(cfg, toolset)\nif cfg.system == premake.MACOSX and cfg.kind == premake.WINDOWEDAPP then\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\n_p('\\t@:')\n_p('')\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\nelse\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')\n_p('\\t@:')\nend\nend\nfunction make.cppFlags(cfg, toolset)\n_p('  ALL_CPPFLAGS += $(CPPFLAGS)%s $(DEFINES) $(INCLUDES)', make.list(toolset.getcppflags(cfg)))\nend\nfunction make.cxxFlags(cfg, toolset)\n_p('  ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(toolset.getcxxflags(cfg)))\nend\nfunction make.cppCleanRules(prj)\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('')\nend\nfunction make.cppDependencies(prj)\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p('  -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p('endif')\nend\nfunction make.cppTargetRules(prj)\n_p('$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES)')\n_p('\\t@echo Linking %s', prj.name)\n_p('\\t$(SILENT) $(LINKCMD)')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\nend\nfunction make.cppTools(cfg, toolset)\nlocal tool = toolset.gettoolname(cfg, \"cc\")\nif tool then\n_p('  ifeq ($(origin CC), default)')\n_p('    CC = %s', tool)\n_p('  endif' )\nend\ntool = toolset.gettoolname(cfg, \"cxx\")\nif tool then\n_p('  ifeq ($(origin CXX), default)')\n_p('    CXX = %s', tool)\n_p('  endif' )\nend\ntool = toolset.gettoolname(cfg, \"ar\")\nif tool then\n_p('  ifeq ($(origin AR), default)')\n_p('    AR = %s', tool)\n_p('  endif' )\nend\ntool = toolset.gettoolname(cfg, \"rc\")\nif tool then\n_p('  RESCOMP = %s', tool)\nend\nend\nfunction make.defines(cfg, toolset)\n_p('  DEFINES +=%s', make.list(table.join(toolset.getdefines(cfg.defines), toolset.getundefines(cfg.undefines))))\nend\nfunction make.forceInclude(cfg, toolset)\nlocal includes = toolset.getforceincludes(cfg)\nif not cfg.flags.NoPCH and cfg.pchheader then\ntable.insert(includes, \"-include $(OBJDIR)/$(notdir $(PCH))\")\nend\n_x('  FORCE_INCLUDE +=%s', make.list(includes))\nend\nfunction make.includes(cfg, toolset)\nlocal includes = premake.esc(toolset.getincludedirs(cfg, cfg.includedirs, cfg.sysincludedirs))\n_p("
	"'  INCLUDES +=%s', make.list(includes))\nend\nfunction make.ldDeps(cfg, toolset)\nlocal deps = config.getlinks(cfg, \"siblings\", \"fullpath\")\n_p('  LDDEPS +=%s', make.list(premake.esc(deps)))\nend\nfunction make.ldFlags(cfg, toolset)\nlocal flags = table.join(toolset.getLibraryDirectories(cfg), toolset.getldflags(cfg), cfg.linkoptions)\n_p('  ALL_LDFLAGS += $(LDFLAGS)%s', make.list(flags))\nend\nfunction make.libs(cfg, toolset)\nlocal flags = toolset.getlinks(cfg)\n_p('  LIBS +=%s', make.list(flags))\nend\nfunction make.linkCmd(cfg, toolset)\nif cfg.kind == premake.STATICLIB then\nif cfg.architecture == premake.UNIVERSAL then\n_p('  LINKCMD = libtool -o \"$@\" $(OBJECTS)')\nelse\n_p('  LINKCMD = $(AR) -rcs \"$@\" $(OBJECTS)')\nend\nelse\nlocal cc = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p('  LINKCMD = $(%s) -o \"$@\" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)', cc)\nend\nend\nfunction make.pch(cfg, toolset)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal testname = path.join(incdir, pch)\nif os.isfile(testname) then\npch = project.getrelative(cfg.project, testname)\nbreak\nend\nend\n_x('  PCH = %s', pch)\n_p('  GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction make.pchRules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(OBJECTS): $(GCH) $(PCH)')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction make.resFlags(cfg, toolset)\nlocal resflags = table.join(toolset.getdefines(cfg.resdefines), toolset.getincludedirs(cfg, cfg.resincludedirs), cfg.resoptions)\n_p('  ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s', make.list(resflags))\nend\n",

	"premake.make.cs = {}\nlocal make = premake.make\nlocal cs = premake.make.cs\nlocal project = premake.project\nlocal config = premake.config\nlocal fileconfig = premake.fileconfig\ncs.elements = {}\ncs.elements.makefile = function(prj)\nreturn {\nmake.header,\nmake.phonyRules,\nmake.csConfigs,\nmake.csProjectConfig,\nmake.csSources,\nmake.csEmbedFiles,\nmake.csCopyFiles,\nmake.csResponseFile,\nmake.shellType,\nmake.csAllRules,\nmake.csTargetRules,\nmake.targetDirRules,\nmake.csResponseRules,\nmake.objDirRules,\nmake.csCleanRules,\nmake.preBuildRules,\nmake.preLinkRules,\nmake.csFileRules,\n}\nend\nfunction make.cs.generate(prj)\npremake.eol(\"\\n\")\nlocal toolset = premake.tools.dotnet\npremake.callArray(cs.elements.makefile, prj, toolset)\nend\ncs.elements.configuration = function(cfg)\nreturn {\nmake.csTools,\nmake.target,\nmake.objdir,\nmake.csFlags,\nmake.csLinkCmd,\nmake.preBuildCmds,\nmake.preLinkCmds,\nmake.postBuildCmds,\nmake.settings,\n}\nend\nfunction make.csConfigs(prj, toolset)\nfor cfg in project.eachconfig(prj) do\n_x('ifeq ($(config),%s)', cfg.shortname)\npremake.callArray(cs.elements.configuration, cfg, toolset)\n_p('endif')\n_p('')\nend\nend\nfunction cs.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)/\" .. premake.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction cs.listsources(prj, selector)\nlocal tr = project.getsourcetree(prj)\npremake.tree.traverse(tr, {\nonleaf = function(node, depth)\nlocal value = selector(node)\nif value then\n_x('\\t%s \\\\', value)\nend\nend\n})\nend\nfunction make.csAllRules(prj, toolset)\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')\n_p('')\nend\nfunction make.csCleanRules(prj, toolset)\nend\nfunction make.csCopyFiles(prj, toolset)\nend\nfunction make.cs.getresponsefilename(prj)\nreturn '$(OBJDIR)/' .. prj.filename .. '.rsp'\nend\nfunction make.csResponseFile(prj, toolset)\n_x('RESPONSE += ' .. make.cs.getresponsefilename(prj))\nend\nfunction make.csResponseRules(prj)\nlocal toolset = premake.tools.dotnet\nlocal ext = make.getmakefilename(prj, true)\nlocal makefile = path.getname(premake.filename(prj, ext))\nlocal response = path.translate(make.cs.getresponsefilename(prj))\n_p('$(RESPONSE): %s', makefile)\n_p('\\t@echo Generating response file', prj.name)\n_p('ifeq (posix,$(SHELLTYPE))')\n_x('\\t$(SILENT) rm -f $(RESPONSE)')\n_p('else')\n_x('\\t$(SILENT) if exist $(RESPONSE) del %s', response)\n_p('endif')\nlocal tr = project.getsourcetree(prj)\npremake.tree.traverse(tr, {\nonleaf = function(node, depth)\nif toolset.fileinfo(node).action == \"Compile\" then\n_x('\\t@echo %s >> $(RESPONSE)', path.translate(node.relpath))\nend\nend\n})\n_p('')\nend\nfunction make.csEmbedFiles(prj, toolset)\nlocal cfg = project.getfirstconfig(prj)\n_p('EMBEDFILES += \\\\')\ncs.listsources(prj, function(node)\nlocal fcfg = fileconfig.getconfig(node, cfg)\nlocal info = toolset.fileinfo(fcfg)\nif info.action == \"EmbeddedResource\" then\nreturn cs.getresourcefilename(cfg, node.relpath)\nend\nend)\n_p('')\nend\nfunction make.csFileRules(prj, toolset)\nend\nfunction make.csFlags(cfg, toolset)\n_p('  FLAGS =%s', make.list(toolset.getflags(cfg)))\nend\nfunction make.csLinkCmd(cfg, toolset)\nlocal deps = premake.esc(config.getlinks(cfg, \"dependencies\", \"fullpath\"))\n_p('  DEPENDS =%s', make.list(deps))\n_p('  REFERENCES = %s', table.implode(deps, \"/r:\", \"\", \" \"))\nend\nfunction make.csProjectConfig(prj, toolset)\nlocal cfg = project.getfirstconfig(prj)\nlocal kindflag = \"/t:\" .. toolset.getkind(cfg):lower()\nlocal libdirs = table.implode(premake.esc(cfg.libdirs), \"/lib:\", \"\", \" \")\n_p('FLAGS += %s', table.concat(table.join(kindflag, libdirs), \" \"))\nlocal refs = premake.esc(config.getlinks(cfg, \"system\", \"fullpath\"))\n_p('REFERENCES += %s', table.implode(refs, \"/r:\""
	", \"\", \" \"))\n_p('')\nend\nfunction make.csSources(prj, toolset)\nlocal cfg = project.getfirstconfig(prj)\n_p('SOURCES += \\\\')\ncs.listsources(prj, function(node)\nlocal fcfg = fileconfig.getconfig(node, cfg)\nlocal info = toolset.fileinfo(fcfg)\nif info.action == \"Compile\" then\nreturn node.relpath\nend\nend)\n_p('')\nend\nfunction make.csTargetRules(prj, toolset)\n_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS) $(RESPONSE)')\n_p('\\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) @$(RESPONSE) $(patsubst %%,/resource:%%,$(EMBEDFILES))')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\nend\nfunction make.csTools(cfg, toolset)\n_p('  CSC = %s', toolset.gettoolname(cfg, \"csc\"))\n_p('  RESGEN = %s', toolset.gettoolname(cfg, \"resgen\"))\nend\n",

	"premake.vstudio = {}\nlocal vstudio = premake.vstudio\nlocal p = premake\nlocal project = p.project\nlocal config = p.config\nvstudio.vs200x_architectures =\n{\nwin32   = \"x86\",\nx86     = \"x86\",\nx86_64  = \"x64\",\nxbox360 = \"Xbox 360\",\n}\nvstudio.vs2010_architectures =\n{\nwin32   = \"x86\",\n}\nlocal function architecture(system, arch)\nlocal result\nif _ACTION >= \"vs2010\" then\nresult = vstudio.vs2010_architectures[arch] or vstudio.vs2010_architectures[system]\nend\nreturn result or vstudio.vs200x_architectures[arch] or vstudio.vs200x_architectures[system]\nend\nvstudio._cultures = {\n[\"af\"] = 0x0036,\n[\"af-ZA\"] = 0x0436,\n[\"sq\"] = 0x001C,\n[\"sq-AL\"] = 0x041C,\n[\"ar\"] = 0x0001,\n[\"ar-DZ\"] = 0x1401,\n[\"ar-BH\"] = 0x3C01,\n[\"ar-EG\"] = 0x0C01,\n[\"ar-IQ\"] = 0x0801,\n[\"ar-JO\"] = 0x2C01,\n[\"ar-KW\"] = 0x3401,\n[\"ar-LB\"] = 0x3001,\n[\"ar-LY\"] = 0x1001,\n[\"ar-MA\"] = 0x1801,\n[\"ar-OM\"] = 0x2001,\n[\"ar-QA\"] = 0x4001,\n[\"ar-SA\"] = 0x0401,\n[\"ar-SY\"] = 0x2801,\n[\"ar-TN\"] = 0x1C01,\n[\"ar-AE\"] = 0x3801,\n[\"ar-YE\"] = 0x2401,\n[\"hy\"] = 0x002B,\n[\"hy-AM\"] = 0x042B,\n[\"az\"] = 0x002C,\n[\"az-Cyrl-AZ\"] = 0x082C,\n[\"az-Latn-AZ\"] = 0x042C,\n[\"eu\"] = 0x002D,\n[\"eu-ES\"] = 0x042D,\n[\"be\"] = 0x0023,\n[\"be-BY\"] = 0x0423,\n[\"bg\"] = 0x0002,\n[\"bg-BG\"] = 0x0402,\n[\"ca\"] = 0x0003,\n[\"ca-ES\"] = 0x0403,\n[\"zh-HK\"] = 0x0C04,\n[\"zh-MO\"] = 0x1404,\n[\"zh-CN\"] = 0x0804,\n[\"zh-Hans\"] = 0x0004,\n[\"zh-SG\"] = 0x1004,\n[\"zh-TW\"] = 0x0404,\n[\"zh-Hant\"] = 0x7C04,\n[\"hr\"] = 0x001A,\n[\"hr-HR\"] = 0x041A,\n[\"cs\"] = 0x0005,\n[\"cs-CZ\"] = 0x0405,\n[\"da\"] = 0x0006,\n[\"da-DK\"] = 0x0406,\n[\"dv\"] = 0x0065,\n[\"dv-MV\"] = 0x0465,\n[\"nl\"] = 0x0013,\n[\"nl-BE\"] = 0x0813,\n[\"nl-NL\"] = 0x0413,\n[\"en\"] = 0x0009,\n[\"en-AU\"] = 0x0C09,\n[\"en-BZ\"] = 0x2809,\n[\"en-CA\"] = 0x1009,\n[\"en-029\"] = 0x2409,\n[\"en-IE\"] = 0x1809,\n[\"en-JM\"] = 0x2009,\n[\"en-NZ\"] = 0x1409,\n[\"en-PH\"] = 0x3409,\n[\"en-ZA\"] = 0x1C09,\n[\"en-TT\"] = 0x2C09,\n[\"en-GB\"] = 0x0809,\n[\"en-US\"] = 0x0409,\n[\"en-ZW\"] = 0x3009,\n[\"et\"] = 0x0025,\n[\"et-EE\"] = 0x0425,\n[\"fo\"] = 0x0038,\n[\"fo-FO\"] = 0x0438,\n[\"fa\"] = 0x0029,\n[\"fa-IR\"] = 0x0429,\n[\"fi\"] = 0x000B,\n[\"fi-FI\"] = 0x040B,\n[\"fr\"] = 0x000C,\n[\"fr-BE\"] = 0x080C,\n[\"fr-CA\"] = 0x0C0C,\n[\"fr-FR\"] = 0x040C,\n[\"fr-LU\"] = 0x140C,\n[\"fr-MC\"] = 0x180C,\n[\"fr-CH\"] = 0x100C,\n[\"gl\"] = 0x0056,\n[\"gl-ES\"] = 0x0456,\n[\"ka\"] = 0x0037,\n[\"ka-GE\"] = 0x0437,\n[\"de\"] = 0x0007,\n[\"de-AT\"] = 0x0C07,\n[\"de-DE\"] = 0x0407,\n[\"de-LI\"] = 0x1407,\n[\"de-LU\"] = 0x1007,\n[\"de-CH\"] = 0x0807,\n[\"el\"] = 0x0008,\n[\"el-GR\"] = 0x0408,\n[\"gu\"] = 0x0047,\n[\"gu-IN\"] = 0x0447,\n[\"he\"] = 0x000D,\n[\"he-IL\"] = 0x040D,\n[\"hi\"] = 0x0039,\n[\"hi-IN\"] = 0x0439,\n[\"hu\"] = 0x000E,\n[\"hu-HU\"] = 0x040E,\n[\"is\"] = 0x000F,\n[\"is-IS\"] = 0x040F,\n[\"id\"] = 0x0021,\n[\"id-ID\"] = 0x0421,\n[\"it\"] = 0x0010,\n[\"it-IT\"] = 0x0410,\n[\"it-CH\"] = 0x0810,\n[\"ja\"] = 0x0011,\n[\"ja-JP\"] = 0x0411,\n[\"kn\"] = 0x004B,\n[\"kn-IN\"] = 0x044B,\n[\"kk\"] = 0x003F,\n[\"kk-KZ\"] = 0x043F,\n[\"kok\"] = 0x0057,\n[\"kok-IN\"] = 0x0457,\n[\"ko\"] = 0x0012,\n[\"ko-KR\"] = 0x0412,\n[\"ky\"] = 0x0040,\n[\"ky-KG\"] = 0x0440,\n[\"lv\"] = 0x0026,\n[\"lv-LV\"] = 0x0426,\n[\"lt\"] = 0x0027,\n[\"lt-LT\"] = 0x0427,\n[\"mk\"] = 0x002F,\n[\"mk-MK\"] = 0x042F,\n[\"ms\"] = 0x003E,\n[\"ms-BN\"] = 0x083E,\n[\"ms-MY\"] = 0x043E,\n[\"mr\"] = 0x004E,\n[\"mr-IN\"] = 0x044E,\n[\"mn\"] = 0x0050,\n[\"mn-MN\"] = 0x0450,\n[\"no\"] = 0x0014,\n[\"nb-NO\"] = 0x0414,\n[\"nn-NO\"] = 0x0814,\n[\"pl\"] = 0x0015,\n[\"pl-PL\"] = 0x0415,\n[\"pt\"] = 0x0016,\n[\"pt-BR\"] = 0x0416,\n[\"pt-PT\"] = 0x0816,\n[\"pa\"] = 0x0046,\n[\"pa-IN\"] = 0x0446,\n[\"ro\"] = 0x0018,\n[\"ro-RO\"] = 0x0418,\n[\"ru\"] = 0x0019,\n[\"ru-RU\"] = 0x0419,\n[\"sa\"] = 0x004F,\n[\"sa-IN\"] = 0x044F,\n[\"sr-Cyrl-CS\"] = 0x0C1A,\n[\"sr-Latn-CS\"] = 0x081A,\n[\"sk\"] = 0x001B,\n[\"sk-SK\"] = 0x041B,\n[\"sl\"] = 0x0024,\n[\"sl-SI\"] = 0x0424,\n[\"es\"] = 0x000A,\n[\"es-AR\"] = 0x2C0A,\n[\"es-BO\"] "
	"= 0x400A,\n[\"es-CL\"] = 0x340A,\n[\"es-CO\"] = 0x240A,\n[\"es-CR\"] = 0x140A,\n[\"es-DO\"] = 0x1C0A,\n[\"es-EC\"] = 0x300A,\n[\"es-SV\"] = 0x440A,\n[\"es-GT\"] = 0x100A,\n[\"es-HN\"] = 0x480A,\n[\"es-MX\"] = 0x080A,\n[\"es-NI\"] = 0x4C0A,\n[\"es-PA\"] = 0x180A,\n[\"es-PY\"] = 0x3C0A,\n[\"es-PE\"] = 0x280A,\n[\"es-PR\"] = 0x500A,\n[\"es-ES\"] = 0x0C0A,\n[\"es-ES_tradnl\"]= 0x040A,\n[\"es-UY\"] = 0x380A,\n[\"es-VE\"] = 0x200A,\n[\"sw\"] = 0x0041,\n[\"sw-KE\"] = 0x0441,\n[\"sv\"] = 0x001D,\n[\"sv-FI\"] = 0x081D,\n[\"sv-SE\"] = 0x041D,\n[\"syr\"] = 0x005A,\n[\"syr-SY\"] = 0x045A,\n[\"ta\"] = 0x0049,\n[\"ta-IN\"] = 0x0449,\n[\"tt\"] = 0x0044,\n[\"tt-RU\"] = 0x0444,\n[\"te\"] = 0x004A,\n[\"te-IN\"] = 0x044A,\n[\"th\"] = 0x001E,\n[\"th-TH\"] = 0x041E,\n[\"tr\"] = 0x001F,\n[\"tr-TR\"] = 0x041F,\n[\"uk\"] = 0x0022,\n[\"uk-UA\"] = 0x0422,\n[\"ur\"] = 0x0020,\n[\"ur-PK\"] = 0x0420,\n[\"uz\"] = 0x0043,\n[\"uz-Cyrl-UZ\"] = 0x0843,\n[\"uz-Latn-UZ\"] = 0x0443,\n[\"vi\"] = 0x002A,\n[\"vi-VN\"] = 0x042A,\n}\nfunction vstudio.archFromConfig(cfg, win32)\nlocal isnative = project.isnative(cfg.project)\nlocal arch = architecture(cfg.system, cfg.architecture)\nif not arch then\narch = iif(isnative, \"x86\", \"Any CPU\")\nend\nif win32 and isnative and arch == \"x86\" then\narch = \"Win32\"\nend\nreturn arch\nend\nfunction vstudio.archFromPlatform(platform)\nlocal system = premake.api.checkValue(premake.fields.system, platform)\nlocal arch = premake.api.checkValue(premake.fields.architecture, platform)\nreturn architecture(system, arch or platform:lower())\nend\nfunction vstudio.cultureForLocale(locale)\nif locale then\nlocal culture = vstudio._cultures[locale]\nif not culture then\npremake.warnOnce(\"Locale\" .. locale, 'Unsupported locale \"%s\"', locale)\nend\nreturn culture\nend\nend\nfunction vstudio.getLinks(cfg, explicit)\nlocal links = {}\nif explicit then\nlinks = config.getlinks(cfg, \"siblings\", \"fullpath\")\nend\nlocal system = config.getlinks(cfg, \"system\", \"fullpath\")\nfor i = 1, #system do\nlocal link = system[i]\nif not p.tools.msc.getLibraryExtensions()[link:match(\"[^.]+$\")] then\nlink = path.appendextension(link, \".lib\")\nend\ntable.insert(links, link)\nend\nreturn links\nend\nfunction vstudio.isMakefile(cfg)\nreturn (cfg.kind == premake.MAKEFILE or cfg.kind == premake.NONE)\nend\nfunction vstudio.needsExplicitLink(cfg)\nif not cfg._needsExplicitLink then\nlocal ex = cfg.flags.NoImplicitLink\nif not ex then\nlocal prjdeps = project.getdependencies(cfg.project, \"linkOnly\")\nlocal cfgdeps = config.getlinks(cfg, \"dependencies\", \"object\")\nex = #prjdeps ~= #cfgdeps\nend\ncfg._needsExplicitLink = ex\nend\nreturn cfg._needsExplicitLink\nend\nfunction vstudio.path(cfg, value)\ncfg = cfg.project or cfg\nlocal dirs = path.translate(project.getrelative(cfg, value))\nif type(dirs) == 'table' then\ndirs = table.filterempty(dirs)\nend\nreturn dirs\nend\nfunction vstudio.projectConfig(cfg, arch)\nlocal platform = vstudio.projectPlatform(cfg)\nlocal architecture = arch or vstudio.archFromConfig(cfg, true)\nreturn platform .. \"|\" .. architecture\nend\nfunction vstudio.projectElement()\np.push('<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nend\nfunction vstudio.projectfile(prj)\nlocal extension\nif project.isdotnet(prj) then\nextension = \".csproj\"\nelseif project.iscpp(prj) then\nextension = iif(_ACTION > \"vs2008\", \".vcxproj\", \".vcproj\")\nend\nreturn premake.filename(prj, extension)\nend\nfunction vstudio.projectPlatform(cfg)\nlocal platform = cfg.platform\nif platform then\nlocal pltarch = vstudio.archFromPlatform(cfg.platform) or platform\nlocal cfgarch = vstudio.archFromConfig(cfg)\nif pltarch == cfgarch then\nplatform = nil\nend\nend\nif platform then\nreturn cfg.buildcfg .. \" \" .. platform\nelse\nreturn cfg.buildcfg\nend\nend\nfunction vstudio.solutionPlatform(cfg)\nlocal platform = cfg.platform\nlocal platarch\nif platform then\nplatform = vstudio.archFromPlatform(platform) or platform\nif platform ~= \"x86\" then\nreturn platform\nend\nend\nlocal hasnative = false\nlocal hasnet ="
	" false\nlocal slnarch\nfor prj in p.workspace.eachproject(cfg.workspace) do\nif project.isnative(prj) then\nhasnative = true\nelseif project.isdotnet(prj) then\nhasnet = true\nend\nlocal prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)\nif prjcfg then\nlocal prjarch = vstudio.archFromConfig(prjcfg)\nif not slnarch then\nslnarch = prjarch\nelseif slnarch ~= prjarch then\nslnarch = \"Mixed Platforms\"\nend\nend\nend\nif platform then\nreturn iif(hasnet, \"x86\", \"Win32\")\nelseif slnarch then\nreturn iif(slnarch == \"x86\" and not hasnet, \"Win32\", slnarch)\nelseif hasnet and hasnative then\nreturn \"Mixed Platforms\"\nelseif hasnet then\nreturn \"Any CPU\"\nelse\nreturn \"Win32\"\nend\nend\nfunction vstudio.solutionarch(cfg)\nlocal hasnative = false\nlocal hasdotnet = false\nlocal arch = cfg.platform\nfor prj in p.workspace.eachproject(cfg.workspace) do\nif project.isnative(prj) then\nhasnative = true\nelseif project.isdotnet(prj) then\nhasdotnet = true\nend\nif hasnative and hasdotnet then\nreturn \"Mixed Platforms\"\nend\nif not arch then\nlocal prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)\nif prjcfg then\nif prjcfg.architecture then\narch = vstudio.archFromConfig(prjcfg)\nend\nend\nend\nend\narch = arch or iif(hasnative, \"Win32\", \"Any CPU\")\nreturn arch\nend\nfunction vstudio.solutionconfig(cfg)\nlocal platform = cfg.platform\nif not platform then\nplatform = vstudio.solutionarch(cfg)\nend\nreturn string.format(\"%s|%s\", cfg.buildcfg, platform)\nend\nfunction vstudio.tool(prj)\nif project.isdotnet(prj) then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelseif project.iscpp(prj) then\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\n",

	"premake.vstudio.vs2005 = {}\nlocal p = premake\nlocal vs2005 = p.vstudio.vs2005\nlocal vstudio = p.vstudio\nfunction vs2005.generateSolution(wks)\np.indent(\"\\t\")\np.eol(\"\\r\\n\")\np.escaper(vs2005.esc)\npremake.generate(wks, \".sln\", vstudio.sln2005.generate)\nend\nfunction vs2005.generateProject(prj)\np.indent(\"  \")\np.eol(\"\\r\\n\")\np.escaper(vs2005.esc)\nif premake.project.isdotnet(prj) then\npremake.generate(prj, \".csproj\", vstudio.cs2005.generate)\nlocal user = p.capture(function() vstudio.cs2005.generateUser(prj) end)\nif #user > 0 then\np.generate(prj, \".csproj.user\", function() p.outln(user) end)\nend\nelseif premake.project.iscpp(prj) then\npremake.generate(prj, \".vcproj\", vstudio.vc200x.generate)\nlocal user = p.capture(function() vstudio.vc200x.generateUser(prj) end)\nif #user > 0 then\np.generate(prj, \".vcproj.user\", function() p.outln(user) end)\nend\nend\nend\nfunction vs2005.esc(value)\nvalue = string.gsub(value, '&',  \"&amp;\")\nvalue = value:gsub('\"',  \"&quot;\")\nvalue = value:gsub(\"'\",  \"&apos;\")\nvalue = value:gsub('<',  \"&lt;\")\nvalue = value:gsub('>',  \"&gt;\")\nvalue = value:gsub('\\r', \"&#x0D;\")\nvalue = value:gsub('\\n', \"&#x0A;\")\nreturn value\nend\nnewaction {\ntrigger     = \"vs2005\",\nshortname   = \"Visual Studio 2005\",\ndescription = \"Generate Visual Studio 2005 project files\",\nos = \"windows\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Makefile\", \"None\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"msc\"   },\ndotnet = { \"msnet\" },\n},\nonWorkspace = vstudio.vs2005.generateSolution,\nonProject   = vstudio.vs2005.generateProject,\nonCleanWorkspace = vstudio.cleanSolution,\nonCleanProject   = vstudio.cleanProject,\nonCleanTarget    = vstudio.cleanTarget,\nvstudio = {\ncsprojSchemaVersion = \"2.0\",\nproductVersion      = \"8.0.50727\",\nsolutionVersion     = \"9\",\nversionName         = \"2005\",\n}\n}\n",

	"premake.vstudio.vs2008 = {}\nlocal vs2008 = premake.vstudio.vs2008\nlocal vstudio = premake.vstudio\nnewaction {\ntrigger     = \"vs2008\",\nshortname   = \"Visual Studio 2008\",\ndescription = \"Generate Visual Studio 2008 project files\",\nos = \"windows\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Makefile\", \"None\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"msc\"   },\ndotnet = { \"msnet\" },\n},\nonWorkspace = vstudio.vs2005.generateSolution,\nonProject   = vstudio.vs2005.generateProject,\nonCleanWorkspace = vstudio.cleanSolution,\nonCleanProject   = vstudio.cleanProject,\nonCleanTarget    = vstudio.cleanTarget,\nvstudio = {\ncsprojSchemaVersion = \"2.0\",\nproductVersion      = \"9.0.30729\",\nsolutionVersion     = \"10\",\nversionName         = \"2008\",\ntoolsVersion        = \"3.5\",\n}\n}\n",

	"premake.vstudio.vc200x = {}\nlocal m = premake.vstudio.vc200x\nlocal p = premake\nlocal vstudio = p.vstudio\nlocal context = p.context\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nm.elements = {}\nm.elements.project = function(prj)\nreturn {\nm.xmlElement,\nm.visualStudioProject,\nm.platforms,\nm.toolFiles,\nm.configurations,\nm.references,\nm.files,\nm.globals\n}\nend\nfunction m.generate(prj)\np.indent(\"\\t\")\np.callArray(m.elements.project, prj)\np.pop('</VisualStudioProject>')\np.w()\nend\nm.elements.visualStudioProject = function(prj)\nreturn {\nm.projectType,\nm.version,\nm.projectName,\nm.projectGUID,\nm.rootNamespace,\nm.keyword,\nm.targetFrameworkVersion\n}\nend\nfunction m.visualStudioProject(prj)\np.push('<VisualStudioProject')\np.callArray(m.elements.visualStudioProject, prj)\np.w('>')\nend\nfunction m.configurations(prj)\np.push('<Configurations>')\nlocal mapping = {}\nfor cfg in project.eachconfig(prj) do\nlocal name = vstudio.projectConfig(cfg)\nmapping[cfg] = name\nmapping[name] = cfg\nend\nfor cfg in project.eachconfig(prj) do\nfor i, arch in ipairs(architectures) do\nlocal target\nlocal testName = vstudio.projectConfig(cfg, arch)\nif testName == mapping[cfg] then\ntarget = cfg\nelseif not mapping[testName] then\ntarget = { fake = true }\nend\nif target then\nm.configuration(target, testName)\nm.tools(target)\np.pop('</Configuration>')\nend\nend\nend\np.pop('</Configurations>')\nend\nm.elements.configuration = function(cfg)\nif cfg.fake then\nreturn {\nm.intermediateDirectory,\nm.configurationType\n}\nelse\nreturn {\nm.outputDirectory,\nm.intermediateDirectory,\nm.configurationType,\nm.useOfMFC,\nm.characterSet,\nm.managedExtensions,\n}\nend\nend\nfunction m.configuration(cfg, name)\np.push('<Configuration')\np.w('Name=\"%s\"', name)\np.callArray(m.elements.configuration, cfg)\np.w('>')\nend\nm.elements.tools = function(cfg)\nif vstudio.isMakefile(cfg) and not cfg.fake then\nreturn {\nm.VCNMakeTool\n}\nend\nif cfg.system == p.XBOX360 then\nreturn {\nm.VCPreBuildEventTool,\nm.VCCustomBuildTool,\nm.VCXMLDataGeneratorTool,\nm.VCWebServiceProxyGeneratorTool,\nm.VCMIDLTool,\nm.VCCLCompilerTool,\nm.VCManagedResourceCompilerTool,\nm.VCResourceCompilerTool,\nm.VCPreLinkEventTool,\nm.VCLinkerTool,\nm.VCALinkTool,\nm.VCX360ImageTool,\nm.VCBscMakeTool,\nm.VCX360DeploymentTool,\nm.VCPostBuildEventTool,\nm.DebuggerTool,\n}\nelse\nreturn {\nm.VCPreBuildEventTool,\nm.VCCustomBuildTool,\nm.VCXMLDataGeneratorTool,\nm.VCWebServiceProxyGeneratorTool,\nm.VCMIDLTool,\nm.VCCLCompilerTool,\nm.VCManagedResourceCompilerTool,\nm.VCResourceCompilerTool,\nm.VCPreLinkEventTool,\nm.VCLinkerTool,\nm.VCALinkTool,\nm.VCManifestTool,\nm.VCXDCMakeTool,\nm.VCBscMakeTool,\nm.VCFxCopTool,\nm.VCAppVerifierTool,\nm.VCPostBuildEventTool,\n}\nend\nend\nfunction m.tools(cfg)\npremake.callArray(m.elements.tools, cfg, config.toolset(cfg))\nend\nm.elements.references = function(prj)\nreturn {\nm.assemblyReferences,\nm.projectReferences,\n}\nend\nfunction m.references(prj)\np.push('<References>')\np.callArray(m.elements.references, prj)\np.pop('</References>')\nend\nfunction m.files(prj)\nlocal tr = m.filesSorted(prj)\np.push('<Files>')\np.tree.traverse(tr, {\nonbranchenter = m.filesFilterStart,\nonbranchexit = m.filesFilterEnd,\nonleaf = m.filesFile,\n}, false)\np.pop('</Files>')\nend\nfunction m.filesSorted(prj)\nreturn project.getsourcetree(prj, function(a,b)\nlocal istop = (a.parent.parent == nil)\nlocal aSortName = a.name\nlocal bSortName = b.name\nif a.relpath then\nif not b.relpath then\nreturn not istop\nend\naSortName = a.relpath:gsub(\"%.%.%/\", \"\")\nend\nif b.relpath then\nif not a.relpath then\nreturn istop\nend\nbSortName = b.relpath:gsub(\"%.%.%/\", \"\")\nend\nreturn aSortName < bSortName\nend)\nend\nfunction m.filesFilterStart(node)\np.push('<Filter')\np.w('Name=\"%s\"', node.name)\np.w('>')\nend\nfunction m.filesFilterEnd(node)\np.pop('</Filter>')\nend\nfunction m.filesFile(node)\np.push('<File')\np.w('RelativePath=\"%s\"', path.translate(node.relpath))\np.w('>')\nlocal prj = node.project\n"
	"for cfg in project.eachconfig(prj) do\nm.fileConfiguration(cfg, node)\nend\np.pop('</File>')\nend\nm.elements.fileConfigurationAttributes = function(filecfg)\nreturn {\nm.excludedFromBuild,\n}\nend\nfunction m.fileConfiguration(cfg, node)\nlocal filecfg = fileconfig.getconfig(node, cfg)\nlocal configAttribs = p.capture(function ()\np.push()\np.callArray(m.elements.fileConfigurationAttributes, filecfg)\np.pop()\nend)\nlocal compilerAttribs = p.capture(function ()\np.push()\nm.VCCLCompilerTool(filecfg)\np.pop()\nend)\nif #configAttribs > 0 or compilerAttribs:lines() > 3 then\np.push('<FileConfiguration')\np.w('Name=\"%s\"', vstudio.projectConfig(cfg))\nif #configAttribs > 0 then\np.outln(configAttribs)\nend\np.w('>')\np.outln(compilerAttribs)\np.pop('</FileConfiguration>')\nend\nend\nm.elements.globals = function(prj)\nreturn {}\nend\nfunction m.globals(prj)\np.push('<Globals>')\np.callArray(m.elements.globals, prj)\np.pop('</Globals>')\nend\nfunction m.VCTool(name, cfg, ...)\np.push('<Tool')\nlocal nameFunc = m[name .. \"Name\"]\nlocal callFunc = m.elements[name]\nif nameFunc then\nname = nameFunc(cfg, ...)\nend\np.w('Name=\"%s\"', name)\nif cfg and not cfg.fake then\np.callArray(callFunc, cfg, ...)\nend\np.pop('/>')\nend\nm.elements.DebuggerTool = function(cfg)\nreturn {}\nend\nfunction m.DebuggerTool(cfg)\np.push('<DebuggerTool')\np.pop('/>')\nend\nm.elements.VCALinkTool = function(cfg)\nreturn {}\nend\nfunction m.VCALinkTool(cfg)\nm.VCTool(\"VCALinkTool\", cfg)\nend\nm.elements.VCAppVerifierTool = function(cfg)\nreturn {}\nend\nfunction m.VCAppVerifierTool(cfg)\nif cfg.kind ~= p.STATICLIB then\nm.VCTool(\"VCAppVerifierTool\", cfg)\nend\nend\nm.elements.VCBscMakeTool = function(cfg)\nreturn {}\nend\nfunction m.VCBscMakeTool(cfg)\nm.VCTool(\"VCBscMakeTool\", cfg)\nend\nm.elements.VCCLCompilerTool = function(cfg, toolset)\nif not toolset then\nreturn {\nm.customBuildTool,\nm.objectFile,\nm.additionalCompilerOptions,\nm.optimization,\nm.additionalIncludeDirectories,\nm.wholeProgramOptimization,\nm.preprocessorDefinitions,\nm.undefinePreprocessorDefinitions,\nm.minimalRebuild,\nm.basicRuntimeChecks,\nm.bufferSecurityCheck,\nm.stringPooling,\nm.exceptionHandling,\nm.runtimeLibrary,\nm.enableFunctionLevelLinking,\nm.enableEnhancedInstructionSet,\nm.floatingPointModel,\nm.runtimeTypeInfo,\nm.treatWChar_tAsBuiltInType,\nm.usePrecompiledHeader,\nm.programDataBaseFileName,\nm.warningLevel,\nm.warnAsError,\nm.detect64BitPortabilityProblems,\nm.debugInformationFormat,\nm.compileAs,\nm.disableSpecificWarnings,\nm.forcedIncludeFiles,\nm.omitDefaultLib,\n}\nelse\nreturn {\nm.additionalExternalCompilerOptions,\nm.additionalIncludeDirectories,\nm.preprocessorDefinitions,\nm.undefinePreprocessorDefinitions,\nm.usePrecompiledHeader,\nm.programDataBaseFileName,\nm.debugInformationFormat,\nm.compileAs,\nm.forcedIncludeFiles,\n}\nend\nend\nfunction m.VCCLCompilerToolName(cfg)\nlocal prjcfg, filecfg = config.normalize(cfg)\nif filecfg and fileconfig.hasCustomBuildRule(filecfg) then\nreturn \"VCCustomBuildTool\"\nelseif prjcfg and prjcfg.system == p.XBOX360 then\nreturn \"VCCLX360CompilerTool\"\nelse\nreturn \"VCCLCompilerTool\"\nend\nend\nfunction m.VCCLCompilerTool(cfg, toolset)\nm.VCTool(\"VCCLCompilerTool\", cfg, toolset)\nend\nm.elements.VCCustomBuildTool = function(cfg)\nreturn {}\nend\nfunction m.VCCustomBuildTool(cfg)\nm.VCTool(\"VCCustomBuildTool\", cfg)\nend\nm.elements.VCFxCopTool = function(cfg)\nreturn {}\nend\nfunction m.VCFxCopTool(cfg)\nm.VCTool(\"VCFxCopTool\", cfg)\nend\nm.elements.VCLinkerTool = function(cfg, toolset)\nif cfg.kind ~= p.STATICLIB then\nreturn {\nm.linkLibraryDependencies,\nm.ignoreImportLibrary,\nm.additionalLinkerOptions,\nm.additionalDependencies,\nm.outputFile,\nm.linkIncremental,\nm.additionalLibraryDirectories,\nm.moduleDefinitionFile,\nm.generateManifest,\nm.generateDebugInformation,\nm.programDatabaseFile,\nm.subSystem,\nm.optimizeReferences,\nm.enableCOMDATFolding,\nm.entryPointSymbol,\nm.importLibrary,\nm.targetMachine,\n}\nelse\nreturn {\nm.additionalLinkerOptions,\nm.additionalDependencies,\nm.outpu"
	"tFile,\nm.additionalLibraryDirectories,\n}\nend\nend\nfunction m.VCLinkerToolName(cfg)\nif cfg.kind == p.STATICLIB then\nreturn \"VCLibrarianTool\"\nelseif cfg.system == p.XBOX360 then\nreturn \"VCX360LinkerTool\"\nelse\nreturn \"VCLinkerTool\"\nend\nend\nfunction m.VCLinkerTool(cfg, toolset)\nm.VCTool(\"VCLinkerTool\", cfg, toolset)\nend\nm.elements.VCManagedResourceCompilerTool = function(cfg)\nreturn {}\nend\nfunction m.VCManagedResourceCompilerTool(cfg)\nm.VCTool(\"VCManagedResourceCompilerTool\", cfg)\nend\nm.elements.VCManifestTool = function(cfg)\nreturn {\nm.additionalManifestFiles,\n}\nend\nfunction m.VCManifestTool(cfg)\nif cfg.kind ~= p.STATICLIB then\nm.VCTool(\"VCManifestTool\", cfg)\nend\nend\nm.elements.VCMIDLTool = function(cfg)\nreturn {\nm.targetEnvironment\n}\nend\nfunction m.VCMIDLTool(cfg)\nm.VCTool(\"VCMIDLTool\", cfg)\nend\nm.elements.VCNMakeTool = function(cfg)\nreturn {\nm.buildCommandLine,\nm.reBuildCommandLine,\nm.cleanCommandLine,\nm.output,\nm.preprocessorDefinitions,\nm.undefinePreprocessorDefinitions,\nm.includeSearchPath,\nm.forcedIncludes,\nm.assemblySearchPath,\nm.forcedUsingAssemblies,\nm.compileAsManaged,\n}\nend\nfunction m.VCNMakeTool(cfg)\nm.VCTool(\"VCNMakeTool\", cfg)\nend\nm.elements.VCBuildTool = function(cfg, stage)\nreturn {\nm.commandLine,\n}\nend\nfunction m.VCBuildToolName(cfg, stage)\nreturn \"VC\" .. stage .. \"EventTool\"\nend\nfunction m.VCPreBuildEventTool(cfg)\nm.VCTool(\"VCBuildTool\", cfg, \"PreBuild\")\nend\nfunction m.VCPreLinkEventTool(cfg)\nm.VCTool(\"VCBuildTool\", cfg, \"PreLink\")\nend\nfunction m.VCPostBuildEventTool(cfg)\nm.VCTool(\"VCBuildTool\", cfg, \"PostBuild\")\nend\nm.elements.VCResourceCompilerTool = function(cfg)\nreturn {\nm.additionalResourceOptions,\nm.resourcePreprocessorDefinitions,\nm.additionalResourceIncludeDirectories,\nm.culture,\n}\nend\nfunction m.VCResourceCompilerTool(cfg)\nm.VCTool(\"VCResourceCompilerTool\", cfg)\nend\nm.elements.VCWebServiceProxyGeneratorTool = function(cfg)\nreturn {}\nend\nfunction m.VCWebServiceProxyGeneratorTool(cfg)\nm.VCTool(\"VCWebServiceProxyGeneratorTool\", cfg)\nend\nm.elements.VCX360DeploymentTool = function(cfg)\nreturn {\nm.deploymentType,\nm.additionalDeploymentOptions,\n}\nend\nfunction m.VCX360DeploymentTool(cfg)\nm.VCTool(\"VCX360DeploymentTool\", cfg)\nend\nm.elements.VCX360ImageTool = function(cfg)\nreturn {\nm.additionalImageOptions,\nm.outputFileName,\n}\nend\nfunction m.VCX360ImageTool(cfg)\nm.VCTool(\"VCX360ImageTool\", cfg)\nend\nm.elements.VCXDCMakeTool = function(cfg)\nreturn {}\nend\nfunction m.VCXDCMakeTool(cfg)\nm.VCTool(\"VCXDCMakeTool\", cfg)\nend\nm.elements.VCXMLDataGeneratorTool = function(cfg)\nreturn {}\nend\nfunction m.VCXMLDataGeneratorTool(cfg)\nm.VCTool(\"VCXMLDataGeneratorTool\", cfg)\nend\nfunction m.symbols(cfg)\nif not cfg.flags.Symbols then\nreturn 0\nelseif cfg.debugformat == \"c7\" then\nreturn 1\nelse\nif cfg.editandcontinue == p.OFF or\n   config.isOptimizedBuild(cfg) or\n   cfg.clr ~= p.OFF or\n   cfg.architecture == p.X86_64\nthen\nreturn 3\nelse\nreturn 4\nend\nend\nend\nfunction m.additionalCompilerOptions(cfg)\nlocal opts = cfg.buildoptions\nif cfg.flags.MultiProcessorCompile then\ntable.insert(opts, \"/MP\")\nend\nif #opts > 0 then\np.x('AdditionalOptions=\"%s\"', table.concat(opts, \" \"))\nend\nend\nfunction m.additionalDependencies(cfg, toolset)\nif #cfg.links == 0 then return end\nlocal ex = vstudio.needsExplicitLink(cfg)\nlocal links\nif not toolset then\nlinks = vstudio.getLinks(cfg, ex)\nfor i, link in ipairs(links) do\nif link:find(\" \", 1, true) then\nlink = '\"' .. link .. '\"'\nend\nlinks[i] = path.translate(link)\nend\nelse\nlinks = toolset.getlinks(cfg, not ex)\nend\nif #links > 0 then\np.x('AdditionalDependencies=\"%s\"', table.concat(links, \" \"))\nend\nend\nfunction m.additionalDeploymentOptions(cfg)\nif #cfg.deploymentoptions > 0 then\np.x('AdditionalOptions=\"%s\"', table.concat(cfg.deploymentoptions, \" \"))\nend\nend\nfunction m.additionalExternalCompilerOptions(cfg, toolset)\nlocal buildoptions = table.join(toolset.getcflags(cfg), toolset."
	"getcxxflags(cfg), cfg.buildoptions)\nif not cfg.flags.NoPCH and cfg.pchheader then\ntable.insert(buildoptions, '--use_pch=\"$(IntDir)/$(TargetName).pch\"')\nend\nif #buildoptions > 0 then\np.x('AdditionalOptions=\"%s\"', table.concat(buildoptions, \" \"))\nend\nend\nfunction m.additionalImageOptions(cfg)\nif #cfg.imageoptions > 0 then\np.x('AdditionalOptions=\"%s\"', table.concat(cfg.imageoptions, \" \"))\nend\nend\nfunction m.additionalIncludeDirectories(cfg)\nif #cfg.includedirs > 0 then\nlocal dirs = vstudio.path(cfg, cfg.includedirs)\np.x('AdditionalIncludeDirectories=\"%s\"', table.concat(dirs, \";\"))\nend\nend\nfunction m.additionalLibraryDirectories(cfg)\nif #cfg.libdirs > 0 then\nlocal dirs = vstudio.path(cfg, cfg.libdirs)\np.x('AdditionalLibraryDirectories=\"%s\"', table.concat(dirs, \";\"))\nend\nend\nfunction m.additionalLinkerOptions(cfg, toolset)\nlocal flags\nif toolset then\nflags = table.join(toolset.getldflags(cfg), cfg.linkoptions)\nelse\nflags = cfg.linkoptions\nend\nif #flags > 0 then\np.x('AdditionalOptions=\"%s\"', table.concat(flags, \" \"))\nend\nend\nfunction m.additionalManifestFiles(cfg)\nlocal manifests = {}\nfor i, fname in ipairs(cfg.files) do\nif path.getextension(fname) == \".manifest\" then\ntable.insert(manifests, project.getrelative(cfg.project, fname))\nend\nend\nif #manifests > 0 then\np.x('AdditionalManifestFiles=\"%s\"', table.concat(manifests, \";\"))\nend\nend\nfunction m.additionalResourceIncludeDirectories(cfg)\nlocal dirs = table.join(cfg.includedirs, cfg.resincludedirs)\nif #dirs > 0 then\ndirs = vstudio.path(cfg, dirs)\np.x('AdditionalIncludeDirectories=\"%s\"', table.concat(dirs, \";\"))\nend\nend\nfunction m.additionalResourceOptions(cfg)\nif #cfg.resoptions > 0 then\np.x('AdditionalOptions=\"%s\"', table.concat(cfg.resoptions, \" \"))\nend\nend\nfunction m.assemblyReferences(prj)\nlocal cfg = project.getfirstconfig(prj)\nlocal refs = config.getlinks(cfg, \"system\", \"fullpath\", \"managed\")\ntable.foreachi(refs, function(value)\np.push('<AssemblyReference')\np.x('RelativePath=\"%s\"', path.translate(value))\np.pop('/>')\nend)\nend\nfunction m.assemblySearchPath(cfg)\np.w('AssemblySearchPath=\"\"')\nend\nfunction m.basicRuntimeChecks(cfg)\nlocal cfg, filecfg = config.normalize(cfg)\nif not filecfg\nand not config.isOptimizedBuild(cfg)\nand cfg.clr == p.OFF\nand not cfg.flags.NoRuntimeChecks\nthen\np.w('BasicRuntimeChecks=\"3\"')\nend\nend\nfunction m.bufferSecurityCheck(cfg)\nif cfg.flags.NoBufferSecurityCheck then\np.w('BufferSecurityCheck=\"false\"')\nend\nend\nfunction m.buildCommandLine(cfg)\nlocal cmds = os.translateCommands(cfg.buildcommands, p.WINDOWS)\np.x('BuildCommandLine=\"%s\"', table.concat(cmds, \"\\r\\n\"))\nend\nfunction m.characterSet(cfg)\nif not vstudio.isMakefile(cfg) then\np.w('CharacterSet=\"%s\"', iif(cfg.flags.Unicode, 1, 2))\nend\nend\nfunction m.cleanCommandLine(cfg)\nlocal cmds = os.translateCommands(cfg.cleancommands, p.WINDOWS)\ncmds = table.concat(cmds, \"\\r\\n\")\np.x('CleanCommandLine=\"%s\"', cmds)\nend\nfunction m.commandLine(cfg, stage)\nlocal field = stage:lower()\nlocal steps = cfg[field .. \"commands\"]\nlocal msg = cfg[field .. \"message\"]\nif #steps > 0 then\nif msg then\np.x('Description=\"%s\"', msg)\nend\nsteps = os.translateCommands(steps, p.WINDOWS)\np.x('CommandLine=\"%s\"', table.implode(steps, \"\", \"\", \"\\r\\n\"))\nend\nend\nfunction m.compileAs(cfg, toolset)\nlocal cfg, filecfg = config.normalize(cfg)\nlocal c = project.isc(cfg)\nif filecfg then\nif path.iscfile(filecfg.name) ~= c then\nif path.iscppfile(filecfg.name) then\nlocal value = iif(c, 2, 1)\np.w('CompileAs=\"%s\"', value)\nend\nend\nelse\nlocal compileAs\nif toolset then\ncompileAs = \"0\"\nelseif c then\ncompileAs = \"1\"\nend\nif compileAs then\np.w('CompileAs=\"%s\"', compileAs)\nend\nend\nend\nfunction m.disableSpecificWarnings(cfg)\nif #cfg.disablewarnings > 0 then\np.x('DisableSpecificWarnings=\"%s\"', table.concat(cfg.disablewarnings, \";\"))\nend\nend\nfunction m.compileAsManaged(cfg)\np.w('CompileAsManaged=\"\"')\nend\nfunction m.configurationType(c"
	"fg)\nlocal cfgtypes = {\nMakefile = 0,\nNone = 0,\nSharedLib = 2,\nStaticLib = 4,\n}\np.w('ConfigurationType=\"%s\"', cfgtypes[cfg.kind] or 1)\nend\nfunction m.culture(cfg)\nlocal value = vstudio.cultureForLocale(cfg.locale)\nif value then\np.w('Culture=\"%d\"', value)\nend\nend\nfunction m.customBuildTool(cfg)\nlocal cfg, filecfg = config.normalize(cfg)\nif filecfg and fileconfig.hasCustomBuildRule(filecfg) then\nlocal cmds = os.translateCommands(filecfg.buildcommands, p.WINDOWS)\np.x('CommandLine=\"%s\"', table.concat(cmds,'\\r\\n'))\nlocal outputs = project.getrelative(filecfg.project, filecfg.buildoutputs)\np.x('Outputs=\"%s\"', table.concat(outputs, ';'))\nif filecfg.buildinputs and #filecfg.buildinputs > 0 then\nlocal inputs = project.getrelative(filecfg.project, filecfg.buildinputs)\np.x('AdditionalDependencies=\"%s\"', table.concat(inputs, ';'))\nend\nend\nend\nfunction m.debugInformationFormat(cfg, toolset)\nlocal prjcfg, filecfg = config.normalize(cfg)\nif not filecfg then\nlocal fmt = iif(toolset, \"0\", m.symbols(cfg))\np.w('DebugInformationFormat=\"%s\"', fmt)\nend\nend\nfunction m.deploymentType(cfg)\np.w('DeploymentType=\"0\"')\nend\nfunction m.detect64BitPortabilityProblems(cfg)\nlocal prjcfg, filecfg = config.normalize(cfg)\nif _ACTION < \"vs2008\" and cfg.clr == p.OFF and cfg.warnings ~= p.OFF and not filecfg then\np.w('Detect64BitPortabilityProblems=\"%s\"', tostring(not cfg.flags.No64BitChecks))\nend\nend\nfunction m.enableCOMDATFolding(cfg, toolset)\nif config.isOptimizedBuild(cfg) and not toolset then\np.w('EnableCOMDATFolding=\"2\"')\nend\nend\nfunction m.enableEnhancedInstructionSet(cfg)\nlocal map = { SSE = \"1\", SSE2 = \"2\" }\nlocal value = map[cfg.vectorextensions]\nif value and cfg.system ~= \"Xbox360\" and cfg.architecture ~= \"x86_64\" then\np.w('EnableEnhancedInstructionSet=\"%d\"', value)\nend\nend\nfunction m.enableFunctionLevelLinking(cfg)\nlocal cfg, filecfg = config.normalize(cfg)\nif not filecfg then\np.w('EnableFunctionLevelLinking=\"true\"')\nend\nend\nfunction m.entryPointSymbol(cfg, toolset)\nif (cfg.kind == \"ConsoleApp\" or cfg.kind == \"WindowedApp\") and\nnot cfg.flags.WinMain and\nnot toolset\nthen\np.w('EntryPointSymbol=\"mainCRTStartup\"')\nend\nend\nfunction m.exceptionHandling(cfg)\nif cfg.exceptionhandling == p.OFF then\np.w('ExceptionHandling=\"%s\"', iif(_ACTION < \"vs2005\", \"FALSE\", 0))\nelseif cfg.exceptionhandling == \"SEH\" and _ACTION > \"vs2003\" then\np.w('ExceptionHandling=\"2\"')\nend\nend\nfunction m.excludedFromBuild(filecfg)\nif not filecfg or filecfg.flags.ExcludeFromBuild then\np.w('ExcludedFromBuild=\"true\"')\nend\nend\nfunction m.floatingPointModel(cfg)\nlocal map = { Strict = \"1\", Fast = \"2\" }\nlocal value = map[cfg.floatingpoint]\nif value then\np.w('FloatingPointModel=\"%d\"', value)\nend\nend\nfunction m.forcedIncludeFiles(cfg)\nif #cfg.forceincludes > 0 then\nlocal includes = vstudio.path(cfg, cfg.forceincludes)\np.w('ForcedIncludeFiles=\"%s\"', table.concat(includes, ';'))\nend\nif #cfg.forceusings > 0 then\nlocal usings = vstudio.path(cfg, cfg.forceusings)\np.w('ForcedUsingFiles=\"%s\"', table.concat(usings, ';'))\nend\nend\nfunction m.forcedIncludes(cfg)\np.w('ForcedIncludes=\"\"')\nend\nfunction m.forcedUsingAssemblies(cfg)\np.w('ForcedUsingAssemblies=\"\"')\nend\nfunction m.keyword(prj)\nlocal windows, managed, makefile\nfor cfg in project.eachconfig(prj) do\nif cfg.system == p.WINDOWS then windows = true end\nif cfg.clr ~= p.OFF then managed = true end\nif vstudio.isMakefile(cfg) then makefile = true end\nend\nif windows then\nlocal keyword = \"Win32Proj\"\nif managed then\nkeyword = \"ManagedCProj\"\nend\nif makefile then\nkeyword = \"MakeFileProj\"\nend\np.w('Keyword=\"%s\"', keyword)\nend\nend\nfunction m.generateDebugInformation(cfg, toolset)\nif not toolset then\np.w('GenerateDebugInformation=\"%s\"', tostring(m.symbols(cfg) ~= 0))\nend\nend\nfunction m.generateManifest(cfg, toolset)\nif cfg.flags.NoManifest or toolset then\np.w('GenerateManifest=\"false\"')\nend\nend\nfunction m.ignoreImportLibrary(cfg, toolset)\nif cfg.flags.N"
	"oImportLib and not toolset then\np.w('IgnoreImportLibrary=\"true\"')\nend\nend\nfunction m.importLibrary(cfg, toolset)\nif cfg.kind == p.SHAREDLIB and not toolset then\nlocal implibdir = cfg.linktarget.abspath\nif cfg.flags.NoImportLib then\nimplibdir = path.join(cfg.objdir, path.getname(implibdir))\nend\nimplibdir = vstudio.path(cfg, implibdir)\np.x('ImportLibrary=\"%s\"', implibdir)\nend\nend\nfunction m.includeSearchPath(cfg)\np.w('IncludeSearchPath=\"\"')\nend\nfunction m.intermediateDirectory(cfg)\nlocal objdir\nif not cfg.fake then\nobjdir = vstudio.path(cfg, cfg.objdir)\nelse\nobjdir = \"$(PlatformName)\\\\$(ConfigurationName)\"\nend\np.x('IntermediateDirectory=\"%s\"', objdir)\nend\nfunction m.linkIncremental(cfg, toolset)\nlocal value\nif not toolset then\nvalue = iif(config.canLinkIncremental(cfg) , 2, 1)\nelse\nvalue = 0\nend\np.w('LinkIncremental=\"%s\"', value)\nend\nfunction m.linkLibraryDependencies(cfg, toolset)\nif vstudio.needsExplicitLink(cfg) and not toolset then\np.w('LinkLibraryDependencies=\"false\"')\nend\nend\nfunction m.managedExtensions(cfg)\nif cfg.clr ~= p.OFF then\np.w('ManagedExtensions=\"1\"')\nend\nend\nfunction m.minimalRebuild(cfg)\nif config.isDebugBuild(cfg) and\n   cfg.debugformat ~= \"c7\" and\n   not cfg.flags.NoMinimalRebuild and\n   cfg.clr == p.OFF and\n   not cfg.flags.MultiProcessorCompile\nthen\np.w('MinimalRebuild=\"true\"')\nend\nend\nfunction m.moduleDefinitionFile(cfg, toolset)\nif not toolset then\nlocal deffile = config.findfile(cfg, \".def\")\nif deffile then\np.w('ModuleDefinitionFile=\"%s\"', deffile)\nend\nend\nend\nfunction m.objectFile(cfg)\nlocal cfg, filecfg = config.normalize(cfg)\nif filecfg and path.iscppfile(filecfg.name) then\nif filecfg.objname ~= path.getbasename(filecfg.abspath) then\np.x('ObjectFile=\"$(IntDir)\\\\%s.obj\"', filecfg.objname)\nend\nend\nend\nfunction m.omitDefaultLib(cfg)\nif cfg.flags.OmitDefaultLibrary then\np.w('OmitDefaultLibName=\"true\"')\nend\nend\nfunction m.omitFramePointers(cfg)\nif cfg.flags.NoFramePointer then\np.w('OmitFramePointers=\"true\"')\nend\nend\nfunction m.optimization(cfg)\nlocal map = { Off=0, On=3, Debug=0, Full=3, Size=1, Speed=2 }\nlocal value = map[cfg.optimize]\nif value or not cfg.abspath then\np.w('Optimization=\"%s\"', value or 0)\nend\nend\nfunction m.optimizeReferences(cfg, toolset)\nif config.isOptimizedBuild(cfg) and not toolset then\np.w('OptimizeReferences=\"2\"')\nend\nend\nfunction m.output(cfg)\np.w('Output=\"$(OutDir)%s\"', cfg.buildtarget.name)\nend\nfunction m.outputDirectory(cfg)\nlocal outdir = project.getrelative(cfg.project, cfg.buildtarget.directory)\np.x('OutputDirectory=\"%s\"', path.translate(outdir))\nend\nfunction m.outputFile(cfg)\np.x('OutputFile=\"$(OutDir)\\\\%s\"', cfg.buildtarget.name)\nend\nfunction m.outputFileName(cfg)\nif cfg.imagepath ~= nil then\np.x('OutputFileName=\"%s\"', path.translate(cfg.imagepath))\nend\nend\nfunction m.platforms(prj)\narchitectures = {}\nfor cfg in project.eachconfig(prj) do\nlocal arch = vstudio.archFromConfig(cfg, true)\nif not table.contains(architectures, arch) then\ntable.insert(architectures, arch)\nend\nend\np.push('<Platforms>')\ntable.foreachi(architectures, function(arch)\np.push('<Platform')\np.w('Name=\"%s\"', arch)\np.pop('/>')\nend)\np.pop('</Platforms>')\nend\nfunction m.preprocessorDefinitions(cfg)\nif #cfg.defines > 0 or vstudio.isMakefile(cfg) then\np.x('PreprocessorDefinitions=\"%s\"', table.concat(cfg.defines, \";\"))\nend\nend\nfunction m.undefinePreprocessorDefinitions(cfg)\nif #cfg.undefines > 0 then\np.x('UndefinePreprocessorDefinitions=\"%s\"', table.concat(cfg.undefines, \";\"))\nend\nend\nfunction m.programDatabaseFile(cfg, toolset)\nif toolset then\np.w('ProgramDatabaseFile=\"\"')\nend\nend\nfunction m.programDataBaseFileName(cfg, toolset)\nif toolset then\np.w('ProgramDataBaseFileName=\"\"')\nend\nend\nfunction m.projectGUID(prj)\np.w('ProjectGUID=\"{%s}\"', prj.uuid)\nend\nfunction m.projectName(prj)\np.x('Name=\"%s\"', prj.name)\nend\nfunction m.projectReferences(prj)\nlocal deps = project.getdependencies(prj)\nif #dep"
	"s > 0 then\nfor i, dep in ipairs(deps) do\nlocal relpath = vstudio.path(prj.workspace, vstudio.projectfile(dep))\nif not relpath:startswith(\".\") then\nrelpath = \".\\\\\" .. relpath\nend\np.push('<ProjectReference')\np.w('ReferencedProjectIdentifier=\"{%s}\"', dep.uuid)\np.w('RelativePathToProject=\"%s\"', relpath)\np.pop('/>')\nend\nend\nend\nfunction m.projectType(prj)\np.w('ProjectType=\"Visual C++\"')\nend\nfunction m.reBuildCommandLine(cfg)\ncommands = table.concat(cfg.rebuildcommands, \"\\r\\n\")\np.x('ReBuildCommandLine=\"%s\"', commands)\nend\nfunction m.resourcePreprocessorDefinitions(cfg)\nlocal defs = table.join(cfg.defines, cfg.resdefines)\nif #defs > 0 then\np.x('PreprocessorDefinitions=\"%s\"', table.concat(defs, \";\"))\nend\nend\nfunction m.rootNamespace(prj)\nlocal hasWindows = project.hasConfig(prj, function(cfg)\nreturn cfg.system == p.WINDOWS\nend)\nif hasWindows and _ACTION > \"vs2003\" then\np.x('RootNamespace=\"%s\"', prj.name)\nend\nend\nfunction m.runtimeLibrary(cfg)\nlocal cfg, filecfg = config.normalize(cfg)\nif not filecfg then\nlocal runtimes = {\nStaticRelease = 0,\nStaticDebug = 1,\nSharedRelease = 2,\nSharedDebug = 3,\n}\np.w('RuntimeLibrary=\"%s\"', runtimes[config.getruntime(cfg)])\nend\nend\nfunction m.runtimeTypeInfo(cfg)\nif cfg.rtti == p.OFF and cfg.clr == p.OFF then\np.w('RuntimeTypeInfo=\"false\"')\nelseif cfg.rtti == p.ON then\np.w('RuntimeTypeInfo=\"true\"')\nend\nend\nfunction m.stringPooling(cfg)\nif config.isOptimizedBuild(cfg) then\np.w('StringPooling=\"true\"')\nend\nend\nfunction m.subSystem(cfg, toolset)\nif not toolset then\np.w('SubSystem=\"%s\"', iif(cfg.kind == \"ConsoleApp\", 1, 2))\nend\nend\nfunction m.targetEnvironment(cfg)\nif cfg.architecture == \"x86_64\" then\np.w('TargetEnvironment=\"3\"')\nend\nend\nfunction m.targetFrameworkVersion(prj)\nlocal windows, makefile\nfor cfg in project.eachconfig(prj) do\nif cfg.system == p.WINDOWS then windows = true end\nif vstudio.isMakefile(cfg) then makefile = true end\nend\nlocal version = 0\nif makefile or not windows then\nversion = 196613\nend\np.w('TargetFrameworkVersion=\"%d\"', version)\nend\nfunction m.targetMachine(cfg, toolset)\nif not toolset then\np.w('TargetMachine=\"%d\"', iif(cfg.architecture == \"x86_64\", 17, 1))\nend\nend\nfunction m.toolFiles(prj)\nif _ACTION > \"vs2003\" then\np.w('<ToolFiles>')\np.w('</ToolFiles>')\nend\nend\nfunction m.treatWChar_tAsBuiltInType(cfg)\nlocal map = { On = \"true\", Off = \"false\" }\nlocal value = map[cfg.nativewchar]\nif value then\np.w('TreatWChar_tAsBuiltInType=\"%s\"', value)\nend\nend\nfunction m.useOfMFC(cfg)\nif (cfg.flags.MFC) then\np.w('UseOfMFC=\"%d\"', iif(cfg.flags.StaticRuntime, 1, 2))\nend\nend\nfunction m.usePrecompiledHeader(cfg)\nlocal prj, file = config.normalize(cfg)\nif file then\nif prj.pchsource == file.abspath and\n   not prj.flags.NoPCH and\n   prj.system == p.WINDOWS\nthen\np.w('UsePrecompiledHeader=\"1\"')\nend\nelse\nif not prj.flags.NoPCH and prj.pchheader then\np.w('UsePrecompiledHeader=\"%s\"', iif(_ACTION < \"vs2005\", 3, 2))\np.x('PrecompiledHeaderThrough=\"%s\"', prj.pchheader)\nelse\np.w('UsePrecompiledHeader=\"%s\"', iif(_ACTION > \"vs2003\" or prj.flags.NoPCH, 0, 2))\nend\nend\nend\nfunction m.version(prj)\nlocal map = {\nvs2002 = '7.0',\nvs2003 = '7.1',\nvs2005 = '8.0',\nvs2008 = '9.0'\n}\np.w('Version=\"%s0\"', map[_ACTION])\nend\nfunction m.warnAsError(cfg)\nif cfg.flags.FatalCompileWarnings and cfg.warnings ~= p.OFF then\np.w('WarnAsError=\"true\"')\nend\nend\nfunction m.warningLevel(cfg)\nlocal prjcfg, filecfg = config.normalize(cfg)\nlocal level\nif cfg.warnings == p.OFF then\nlevel = \"0\"\nelseif cfg.warnings == \"Extra\" then\nlevel = \"4\"\nelseif not filecfg then\nlevel = \"3\"\nend\nif level then\np.w('WarningLevel=\"%s\"', level)\nend\nend\nfunction m.wholeProgramOptimization(cfg)\nif cfg.flags.LinkTimeOptimization then\np.x('WholeProgramOptimization=\"true\"')\nend\nend\nfunction m.xmlElement()\np.w('<?xml version=\"1.0\" encoding=\"Windows-1252\"?>')\nend\n",

	"local p = premake\nlocal m = p.vstudio.vc200x\nm.elements.user = function(cfg)\nreturn {\nm.debugSettings,\n}\nend\nfunction m.generateUser(prj)\np.indent(\"\\t\")\nlocal contents = {}\nlocal size = 0\nfor cfg in p.project.eachconfig(prj) do\ncontents[cfg] = p.capture(function()\np.push(4)\np.callArray(m.elements.user, cfg)\np.pop(4)\nend)\nsize = size + #contents[cfg]\nend\nif size > 0 then\nm.xmlElement()\nm.visualStudioUserFile()\np.push('<Configurations>')\nfor cfg in p.project.eachconfig(prj) do\nm.userConfiguration(cfg)\np.push('<DebugSettings')\nif #contents[cfg] > 0 then\np.outln(contents[cfg])\nend\np.pop('/>')\np.pop('</Configuration>')\nend\np.pop('</Configurations>')\np.pop('</VisualStudioUserFile>')\nend\nend\nfunction m.visualStudioUserFile()\np.push('<VisualStudioUserFile')\np.w('ProjectType=\"Visual C++\"')\nm.version()\np.w('ShowAllFiles=\"false\"')\np.w('>')\nend\nfunction m.userConfiguration(cfg)\np.push('<Configuration')\np.x('Name=\"%s\"', p.vstudio.projectConfig(cfg))\np.w('>')\nend\nm.elements.debugSettings = function(cfg)\nreturn {\nm.debugCommand,\nm.debugDir,\nm.debugArgs,\nm.debugEnvironment,\n}\nend\nfunction m.debugSettings(cfg)\np.callArray(m.elements.debugSettings, cfg)\nend\nfunction m.debugArgs(cfg)\nif #cfg.debugargs > 0 then\np.x('CommandArguments=\"%s\"', table.concat(cfg.debugargs, \" \"))\nend\nend\nfunction m.debugCommand(cfg)\nif cfg.debugcommand then\np.x('Command=\"%s\"', p.vstudio.path(cfg, cfg.debugcommand))\nend\nend\nfunction m.debugDir(cfg)\nif cfg.debugdir then\np.x('WorkingDirectory=\"%s\"', p.vstudio.path(cfg, cfg.debugdir))\nend\nend\nfunction m.debugEnvironment(cfg)\nif #cfg.debugenvs > 0 then\np.x('Environment=\"%s\"', table.concat(cfg.debugenvs, \"\\n\"))\nif cfg.flags.DebugEnvsDontMerge then\np.x('EnvironmentMerge=\"false\"')\nend\nend\nend\n",

	"premake.vstudio.sln2005 = {}\nlocal p = premake\nlocal vstudio = p.vstudio\nlocal sln2005 = p.vstudio.sln2005\nlocal project = p.project\nlocal tree = p.tree\nsln2005.elements = {}\nfunction sln2005.solutionSections(wks)\nreturn {\n\"ConfigurationPlatforms\",\n\"SolutionProperties\",\n\"NestedProjects\",\n}\nend\nfunction sln2005.generate(wks)\npremake.utf8()\nsln2005.reorderProjects(wks)\nsln2005.header()\nsln2005.projects(wks)\np.push('Global')\nsln2005.sections(wks)\np.pop('EndGlobal')\np.w()\nend\nfunction sln2005.header()\nlocal action = premake.action.current()\n_p('Microsoft Visual Studio Solution File, Format Version %d.00', action.vstudio.solutionVersion)\n_p('# Visual Studio %s', action.vstudio.versionName)\nend\nfunction sln2005.reorderProjects(wks)\nif wks.startproject then\nlocal np\nlocal tr = p.workspace.grouptree(wks)\ntree.traverse(tr, {\nonleaf = function(n)\nif n.project.name == wks.startproject then\nnp = n\nend\nend\n})\nwhile np and np.parent do\nlocal p = np.parent\nlocal i = table.indexof(p.children, np)\ntable.remove(p.children, i)\ntable.insert(p.children, 1, np)\nnp = p\nend\nend\nend\nfunction sln2005.projects(wks)\nlocal tr = p.workspace.grouptree(wks)\ntree.traverse(tr, {\nonleaf = function(n)\nlocal prj = n.project\nlocal prjpath = vstudio.projectfile(prj)\nprjpath = vstudio.path(prj.workspace, prjpath)\nprjpath = prjpath:gsub(\"$%((.-)%)\", \"%%%1%%\")\n_x('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', vstudio.tool(prj), prj.name, prjpath, prj.uuid)\nsln2005.projectdependencies(prj)\n_p('EndProject')\nend,\nonbranch = function(n)\n_x('Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"{%s}\"', n.name, n.name, n.uuid)\n_p('EndProject')\nend,\n})\nend\nfunction sln2005.projectdependencies(prj)\nlocal deps = project.getdependencies(prj, 'dependOnly')\nif #deps > 0 then\n_p(1,'ProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p(2,'{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p(1,'EndProjectSection')\nend\nend\nsln2005.elements.projectConfigurationPlatforms = function(cfg, context)\nreturn {\nsln2005.activeCfg,\nsln2005.build0,\n}\nend\nfunction sln2005.projectConfigurationPlatforms(wks, sorted, descriptors)\np.w(\"GlobalSection(ProjectConfigurationPlatforms) = postSolution\")\nlocal tr = p.workspace.grouptree(wks)\ntree.traverse(tr, {\nonleaf = function(n)\nlocal prj = n.project\ntable.foreachi(sorted, function(cfg)\nlocal context = {}\ncontext.prj = prj\ncontext.prjCfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)\ncontext.excluded = (context.prjCfg == nil or context.prjCfg.flags.ExcludeFromBuild)\nif context.prjCfg == nil then\ncontext.prjCfg = project.findClosestMatch(prj, cfg.buildcfg, cfg.platform)\nend\ncontext.descriptor = descriptors[cfg]\ncontext.platform = vstudio.projectPlatform(context.prjCfg)\ncontext.architecture = vstudio.archFromConfig(context.prjCfg, true)\np.push()\np.callArray(sln2005.elements.projectConfigurationPlatforms, cfg, context)\np.pop()\nend)\nend\n})\np.w(\"EndGlobalSection\")\nend\nfunction sln2005.activeCfg(cfg, context)\np.w('{%s}.%s.ActiveCfg = %s|%s', context.prj.uuid, context.descriptor, context.platform, context.architecture)\nend\nfunction sln2005.build0(cfg, context)\nif not context.excluded and context.prjCfg.kind ~= premake.NONE then\np.w('{%s}.%s.Build.0 = %s|%s', context.prj.uuid, context.descriptor, context.platform, context.architecture)\nend\nend\nfunction sln2005.configurationPlatforms(wks)\nlocal descriptors = {}\nlocal sorted = {}\nfor cfg in p.workspace.eachconfig(wks) do\nlocal platform = vstudio.solutionPlatform(cfg)\ndescriptors[cfg] = string.format(\"%s|%s\", cfg.buildcfg, platform)\ntable.insert(sorted, cfg)\nend\ntable.sort(sorted, function(cfg0, cfg1)\nreturn descriptors[cfg0]:lower() < descriptors[cfg1]:lower()\nend)\nif wks.defaultplatform then\n_p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution')\ntable.foreachi(sorted, function (cfg)\nif cfg.platform == wks.defaultplatform then\n_p(2,'%s = %s', descriptors[cfg], descriptors[cfg])\nend\nend)\n_p(1,\"EndGlobalSec"
	"tion\")\nend\n_p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution')\ntable.foreachi(sorted, function (cfg)\nif not wks.defaultplatform or cfg.platform ~= wks.defaultplatform then\n_p(2,'%s = %s', descriptors[cfg], descriptors[cfg])\nend\nend)\n_p(1,\"EndGlobalSection\")\nsln2005.projectConfigurationPlatforms(wks, sorted, descriptors)\nend\nfunction sln2005.properties(wks)\n_p('\\tGlobalSection(SolutionProperties) = preSolution')\n_p('\\t\\tHideSolutionNode = FALSE')\n_p('\\tEndGlobalSection')\nend\nfunction sln2005.NestedProjects(wks)\nlocal tr = p.workspace.grouptree(wks)\nif tree.hasbranches(tr) then\n_p(1,'GlobalSection(NestedProjects) = preSolution')\ntree.traverse(tr, {\nonnode = function(n)\nif n.parent.uuid then\n_p(2,'{%s} = {%s}', (n.project or n).uuid, n.parent.uuid)\nend\nend\n})\n_p(1,'EndGlobalSection')\nend\nend\nsln2005.sectionmap = {\nConfigurationPlatforms = sln2005.configurationPlatforms,\nSolutionProperties     = sln2005.properties,\nNestedProjects         = sln2005.NestedProjects\n}\nfunction sln2005.sections(wks)\nfor _, section in ipairs(sln2005.solutionSections(wks)) do\nif sln2005.sectionmap[section] then\nsln2005.sectionmap[section](wks)\nend\nend\nend\n",

	"premake.vstudio.cs2005 = {}\nlocal p = premake\nlocal vstudio = p.vstudio\nlocal cs2005  = p.vstudio.cs2005\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nlocal dotnet = p.tools.dotnet\ncs2005.elements = {}\ncs2005.elements.project = {\n\"xmlDeclaration\",\n\"projectElement\",\n\"commonProperties\",\n\"projectProperties\",\n\"configurations\",\n\"applicationIcon\",\n\"assemblyReferences\",\n}\nfunction cs2005.generate(prj)\np.utf8()\npremake.callarray(cs2005, cs2005.elements.project, prj)\n_p(1,'<ItemGroup>')\ncs2005.files(prj)\n_p(1,'</ItemGroup>')\ncs2005.projectReferences(prj)\ncs2005.targets(prj)\ncs2005.buildEvents(prj)\np.out('</Project>')\nend\nfunction cs2005.projectElement(prj)\nlocal ver = ''\nlocal action = premake.action.current()\nif action.vstudio.toolsVersion then\nver = string.format(' ToolsVersion=\"%s\"', action.vstudio.toolsVersion)\nend\n_p('<Project%s DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">', ver)\nend\ncs2005.elements.projectProperties = {\n\"configurationCondition\",\n\"platformCondition\",\n\"productVersion\",\n\"schemaVersion\",\n\"projectGuid\",\n\"outputType\",\n\"appDesignerFolder\",\n\"rootNamespace\",\n\"assemblyName\",\n\"targetFrameworkVersion\",\n\"targetFrameworkProfile\",\n\"fileAlignment\",\n\"projectTypeGuids\",\n}\nfunction cs2005.projectProperties(prj)\n_p(1,'<PropertyGroup>')\nlocal cfg = project.getfirstconfig(prj)\npremake.callarray(cs2005, cs2005.elements.projectProperties, cfg)\n_p(1,'</PropertyGroup>')\nend\ncs2005.elements.configuration = {\n\"propertyGroup\",\n\"debugProps\",\n\"outputProps\",\n\"compilerProps\",\n}\nfunction cs2005.configurations(prj)\nfor cfg in project.eachconfig(prj) do\ncs2005.configuration(cfg)\nend\nend\nfunction cs2005.configuration(cfg)\npremake.callarray(cs2005, cs2005.elements.configuration, cfg)\n_p(1,'</PropertyGroup>')\nend\nfunction cs2005.files(prj)\nlocal cfg = project.getfirstconfig(prj)\nlocal elements = {\n\"AutoGen\",\n\"CopyToOutputDirectory\",\n\"DesignTime\",\n\"DependentUpon\",\n\"DesignTimeSharedInput\",\n\"Generator\",\n\"LastGenOutput\",\n\"SubType\",\n}\nlocal tr = project.getsourcetree(prj)\npremake.tree.traverse(tr, {\nonleaf = function(node, depth)\nlocal filecfg = fileconfig.getconfig(node, cfg)\nlocal fname = path.translate(node.relpath)\nlocal link, count = node.relpath:gsub(\"%.%.%/\", \"\")\nlocal external = (count > 0)\nif external and node.vpath ~= node.relpath then\nlink = node.vpath\nend\nlocal info = dotnet.fileinfo(filecfg)\nlocal contents = premake.capture(function ()\nfor _, el in ipairs(elements) do\nlocal value = info[el]\nif value then\n_p(3,\"<%s>%s</%s>\", el, value, el)\nend\nend\nend)\nif #contents > 0 or external then\n_p(2,'<%s Include=\"%s\">', info.action, fname)\nif external then\n_p(3,'<Link>%s</Link>', path.translate(link))\nend\nif #contents > 0 then\n_p(\"%s\", contents)\nend\nif info.action == \"EmbeddedResource\" and cfg.customtoolnamespace then\n_p(3,\"<CustomToolNamespace>%s</CustomToolNamespace>\", cfg.customtoolnamespace)\nend\n_p(2,'</%s>', info.action)\nelse\n_p(2,'<%s Include=\"%s\" />', info.action, fname)\nend\nend\n}, false)\nend\nfunction cs2005.buildEvents(prj)\nlocal function output(name, steps)\nif #steps > 0 then\nsteps = os.translateCommands(steps, p.WINDOWS)\nsteps = table.implode(steps, \"\", \"\", \"\\r\\n\")\n_x(2,'<%sBuildEvent>%s</%sBuildEvent>', name, steps, name)\nend\nend\nlocal cfg = project.getfirstconfig(prj)\nif #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then\n_p(1,'<PropertyGroup>')\noutput(\"Pre\", cfg.prebuildcommands)\noutput(\"Post\", cfg.postbuildcommands)\n_p(1,'</PropertyGroup>')\nend\nend\nfunction cs2005.compilerProps(cfg)\n_x(2,'<DefineConstants>%s</DefineConstants>', table.concat(cfg.defines, \";\"))\n_p(2,'<ErrorReport>prompt</ErrorReport>')\n_p(2,'<WarningLevel>4</WarningLevel>')\nif cfg.clr == \"Unsafe\" then\n_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')\nend\nif cfg.flags.FatalCompileWarnings then\n_p(2,'<TreatWarningsAsErrors>true</TreatWarningsAs"
	"Errors>')\nend\ncs2005.debugCommandParameters(cfg)\nend\nfunction cs2005.debugCommandParameters(cfg)\nif #cfg.debugargs > 0 then\n_x(2,'<Commandlineparameters>%s</Commandlineparameters>', table.concat(cfg.debugargs, \" \"))\nend\nend\nfunction cs2005.debugProps(cfg)\nif cfg.flags.Symbols then\n_p(2,'<DebugSymbols>true</DebugSymbols>')\n_p(2,'<DebugType>full</DebugType>')\nelse\n_p(2,'<DebugType>pdbonly</DebugType>')\nend\n_p(2,'<Optimize>%s</Optimize>', iif(config.isOptimizedBuild(cfg), \"true\", \"false\"))\nend\nfunction cs2005.outputProps(cfg)\nlocal outdir = vstudio.path(cfg, cfg.buildtarget.directory)\n_x(2,'<OutputPath>%s\\\\</OutputPath>', outdir)\nlocal objdir = vstudio.path(cfg, cfg.objdir)\nif _ACTION > \"vs2008\" then\n_x(2,'<BaseIntermediateOutputPath>%s\\\\</BaseIntermediateOutputPath>', objdir)\n_p(2,'<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>')\nelse\n_x(2,'<IntermediateOutputPath>%s\\\\</IntermediateOutputPath>', objdir)\nend\nend\nfunction cs2005.assemblyReferences(prj)\n_p(1,'<ItemGroup>')\nlocal cfg = project.getfirstconfig(prj)\nconfig.getlinks(cfg, \"system\", function(original, decorated)\nlocal name = path.getname(decorated)\nif path.getextension(name) == \".dll\" then\nname = name.sub(name, 1, -5)\nend\nif decorated:find(\"/\", nil, true) then\n_x(2,'<Reference Include=\"%s\">', name)\n_x(3,'<HintPath>%s</HintPath>', path.appendextension(path.translate(decorated), \".dll\"))\nif not config.isCopyLocal(prj, original, true) then\n_p(3,\"<Private>False</Private>\")\nend\n_p(2,'</Reference>')\nelse\n_x(2,'<Reference Include=\"%s\" />', name)\nend\nend)\n_p(1,'</ItemGroup>')\nend\nfunction cs2005.projectReferences(prj)\n_p(1,'<ItemGroup>')\nlocal deps = project.getdependencies(prj, 'linkOnly')\nif #deps > 0 then\nfor _, dep in ipairs(deps) do\nlocal relpath = vstudio.path(prj, vstudio.projectfile(dep))\n_x(2,'<ProjectReference Include=\"%s\">', relpath)\n_p(3,'<Project>{%s}</Project>', dep.uuid)\n_x(3,'<Name>%s</Name>', dep.name)\nif not config.isCopyLocal(prj, dep.name, true) then\n_p(3,\"<Private>False</Private>\")\nend\n_p(2,'</ProjectReference>')\nend\nend\n_p(1,'</ItemGroup>')\nend\nfunction cs2005.arch(cfg)\nlocal arch = vstudio.archFromConfig(cfg)\nif arch == \"Any CPU\" then\narch = \"AnyCPU\"\nend\nreturn arch\nend\nfunction cs2005.propertyGroup(cfg)\nlocal platform = vstudio.projectPlatform(cfg)\nlocal arch = cs2005.arch(cfg)\np.push('<PropertyGroup Condition=\" \\'$(Configuration)|$(Platform)\\' == \\'%s|%s\\' \">', platform, arch)\nif arch ~= \"AnyCPU\" or _ACTION > \"vs2008\" then\np.x('<PlatformTarget>%s</PlatformTarget>', arch)\nend\nend\nfunction cs2005.applicationIcon(prj)\nif prj.icon then\nlocal icon = vstudio.path(prj, prj.icon)\n_p(1,'<PropertyGroup>')\n_x(2,'<ApplicationIcon>%s</ApplicationIcon>', icon)\n_p(1,'</PropertyGroup>')\nend\nend\nfunction cs2005.condition(cfg)\nreturn string.format('Condition=\"\\'$(Configuration)|$(Platform)\\'==\\'%s\\'\"', premake.esc(vstudio.projectConfig(cfg)))\nend\nfunction cs2005.appDesignerFolder(cfg)\n_p(2,'<AppDesignerFolder>Properties</AppDesignerFolder>')\nend\nfunction cs2005.assemblyName(cfg)\n_p(2,'<AssemblyName>%s</AssemblyName>', cfg.buildtarget.basename)\nend\nfunction cs2005.commonProperties(prj)\nif _ACTION > \"vs2010\" then\n_p(1,'<Import Project=\"$(MSBuildExtensionsPath)\\\\$(MSBuildToolsVersion)\\\\Microsoft.Common.props\" Condition=\"Exists(\\'$(MSBuildExtensionsPath)\\\\$(MSBuildToolsVersion)\\\\Microsoft.Common.props\\')\" />')\nend\nend\nfunction cs2005.configurationCondition(cfg)\n_x(2,'<Configuration Condition=\" \\'$(Configuration)\\' == \\'\\' \">%s</Configuration>', cfg.buildcfg)\nend\nfunction cs2005.fileAlignment(cfg)\nif _ACTION >= \"vs2010\" then\n_p(2,'<FileAlignment>512</FileAlignment>')\nend\nend\nfunction cs2005.outputType(cfg)\n_p(2,'<OutputType>%s</OutputType>', dotnet.getkind(cfg))\nend\nfunction cs2005.platformCondition(cfg)\n_p(2,'<Platform Condition=\" \\'$(Platform)\\' == \\'\\' \">%s</Platform>', cs2005.arch(cfg.project))\nend\nfunction cs2005.productVersion(cfg)\nlocal "
	"action = premake.action.current()\nif action.vstudio.productVersion then\n_p(2,'<ProductVersion>%s</ProductVersion>', action.vstudio.productVersion)\nend\nend\nfunction cs2005.projectGuid(cfg)\n_p(2,'<ProjectGuid>{%s}</ProjectGuid>', cfg.uuid)\nend\nfunction cs2005.projectTypeGuids(cfg)\nif cfg.flags.WPF then\n_p(2,'<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>')\nend\nend\nfunction cs2005.rootNamespace(cfg)\n_p(2,'<RootNamespace>%s</RootNamespace>', cfg.namespace or cfg.buildtarget.basename)\nend\nfunction cs2005.schemaVersion(cfg)\nlocal action = premake.action.current()\nif action.vstudio.csprojSchemaVersion then\n_p(2,'<SchemaVersion>%s</SchemaVersion>', action.vstudio.csprojSchemaVersion)\nend\nend\nfunction cs2005.targetFrameworkVersion(cfg)\nlocal action = premake.action.current()\nlocal framework = cfg.framework or action.vstudio.targetFramework\nif framework then\n_p(2,'<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)\nend\nend\nfunction cs2005.targetFrameworkProfile(cfg)\nif _ACTION == \"vs2010\" then\n_p(2,'<TargetFrameworkProfile>')\n_p(2,'</TargetFrameworkProfile>')\nend\nend\nfunction cs2005.targets(prj)\nlocal bin = iif(_ACTION <= \"vs2010\", \"MSBuildBinPath\", \"MSBuildToolsPath\")\n_p(1,'<Import Project=\"$(%s)\\\\Microsoft.CSharp.targets\" />', bin)\n_p(1,'<!-- To modify your build process, add your task inside one of the targets below and uncomment it.')\n_p(1,'     Other similar extension points exist, see Microsoft.Common.targets.')\n_p(1,'<Target Name=\"BeforeBuild\">')\n_p(1,'</Target>')\n_p(1,'<Target Name=\"AfterBuild\">')\n_p(1,'</Target>')\n_p(1,'-->')\nend\nfunction cs2005.xmlDeclaration()\nif _ACTION > \"vs2008\" then\np.xmlUtf8()\nend\nend\n",

	"local p = premake\nlocal m = p.vstudio.cs2005\nm.elements.userProjectPropertyGroup = function()\nreturn {\nm.referencePath,\n}\nend\nm.elements.userConfigPropertyGroup = function()\nreturn {\nm.localDebuggerCommandArguments,\n}\nend\nfunction m.generateUser(prj)\nlocal prjGroup = p.capture(function()\np.push(2)\np.callArray(m.elements.userProjectPropertyGroup, prj)\np.pop(2)\nend)\nlocal contents = {}\nlocal size = 0\nfor cfg in p.project.eachconfig(prj) do\ncontents[cfg] = p.capture(function()\np.push(2)\np.callArray(m.elements.userConfigPropertyGroup, cfg)\np.pop(2)\nend)\nsize = size + #contents[cfg]\nend\nif #prjGroup > 0 or size > 0 then\np.vstudio.projectElement()\nif #prjGroup > 0 then\np.push('<PropertyGroup>')\np.outln(prjGroup)\np.pop('</PropertyGroup>')\nend\nfor cfg in p.project.eachconfig(prj) do\nif #contents[cfg] > 0 then\np.push('<PropertyGroup %s>', m.condition(cfg))\np.outln(contents[cfg])\np.pop('</PropertyGroup>')\nend\nend\np.pop('</Project>')\nend\nend\nfunction m.referencePath(prj)\nlocal cfg = p.project.getfirstconfig(prj)\nlocal paths = p.vstudio.path(prj, cfg.libdirs)\nif #paths > 0 then\np.w('<ReferencePath>%s</ReferencePath>', table.concat(paths, \";\"))\nend\nend\nfunction m.localDebuggerCommandArguments(cfg)\nif #cfg.debugargs > 0 then\np.x('<StartArguments>%s</StartArguments>', table.concat(cfg.debugargs, \" \"))\nend\nend",

	"premake.vstudio.vs2010 = {}\nlocal p = premake\nlocal vs2010 = p.vstudio.vs2010\nlocal vstudio = p.vstudio\nlocal project = p.project\nlocal tree = p.tree\nvstudio.pathVars = {\n[\"cfg.objdir\"] = \"$(IntDir)\",\n[\"prj.location\"] = \"$(ProjectDir)\",\n[\"sln.location\"] = \"$(SolutionDir)\",\n[\"wks.location\"] = \"$(SolutionDir)\",\n[\"cfg.buildtarget.directory\"] = \"$(TargetDir)\",\n[\"cfg.buildtarget.name\"] = \"$(TargetFileName)\",\n[\"cfg.buildtarget.basename\"] = \"$(TargetName)\",\n}\nfunction vs2010.generateProject(prj)\np.eol(\"\\r\\n\")\np.indent(\"  \")\np.escaper(vs2010.esc)\nif premake.project.isdotnet(prj) then\npremake.generate(prj, \".csproj\", vstudio.cs2005.generate)\nlocal user = p.capture(function() vstudio.cs2005.generateUser(prj) end)\nif #user > 0 then\np.generate(prj, \".csproj.user\", function() p.outln(user) end)\nend\nelseif premake.project.iscpp(prj) then\npremake.generate(prj, \".vcxproj\", vstudio.vc2010.generate)\nlocal user = p.capture(function() vstudio.vc2010.generateUser(prj) end)\nif #user > 0 then\np.generate(prj, \".vcxproj.user\", function() p.outln(user) end)\nend\nif tree.hasbranches(project.getsourcetree(prj)) then\npremake.generate(prj, \".vcxproj.filters\", vstudio.vc2010.generateFilters)\nend\nend\nend\nfunction vs2010.generateRule(rule)\np.eol(\"\\r\\n\")\np.indent(\"  \")\np.escaper(vs2010.esc)\np.generate(rule, \".props\", vs2010.rules.props.generate)\np.generate(rule, \".targets\", vs2010.rules.targets.generate)\np.generate(rule, \".xml\", vs2010.rules.xml.generate)\nend\nfunction vs2010.esc(value)\nvalue = value:gsub('&',  \"&amp;\")\nvalue = value:gsub('<',  \"&lt;\")\nvalue = value:gsub('>',  \"&gt;\")\nreturn value\nend\nnewaction {\ntrigger     = \"vs2010\",\nshortname   = \"Visual Studio 2010\",\ndescription = \"Generate Visual Studio 2010 project files\",\nos = \"windows\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Makefile\", \"None\", \"Utility\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"msc\"   },\ndotnet = { \"msnet\" },\n},\nonWorkspace = function(wks)\nvstudio.vs2005.generateSolution(wks)\nend,\nonProject = function(prj)\nvstudio.vs2010.generateProject(prj)\nend,\nonRule = function(rule)\nvstudio.vs2010.generateRule(rule)\nend,\nonCleanWorkspace = function(wks)\nvstudio.cleanSolution(wks)\nend,\nonCleanProject = function(prj)\nvstudio.cleanProject(prj)\nend,\nonCleanTarget = function(prj)\nvstudio.cleanTarget(prj)\nend,\npathVars        = vstudio.pathVars,\nvstudio = {\ncsprojSchemaVersion = \"2.0\",\nproductVersion      = \"8.0.30703\",\nsolutionVersion     = \"11\",\nversionName         = \"2010\",\ntargetFramework     = \"4.0\",\ntoolsVersion        = \"4.0\",\n}\n}\n",

	"premake.vstudio.vc2010 = {}\nlocal p = premake\nlocal vstudio = p.vstudio\nlocal project = p.project\nlocal config = p.config\nlocal fileconfig = p.fileconfig\nlocal tree = p.tree\nlocal m = p.vstudio.vc2010\nm.elements = {}\nm.elements.project = function(prj)\nreturn {\nm.xmlDeclaration,\nm.project,\nm.projectConfigurations,\nm.globals,\nm.importDefaultProps,\nm.configurationPropertiesGroup,\nm.importLanguageSettings,\nm.importExtensionSettings,\nm.propertySheetGroup,\nm.userMacros,\nm.outputPropertiesGroup,\nm.itemDefinitionGroups,\nm.assemblyReferences,\nm.files,\nm.projectReferences,\nm.importLanguageTargets,\nm.importExtensionTargets,\n}\nend\nfunction m.generate(prj)\np.utf8()\np.callArray(m.elements.project, prj)\np.out('</Project>')\nend\nfunction m.project(prj)\nlocal action = p.action.current()\np.push('<Project DefaultTargets=\"Build\" ToolsVersion=\"%s\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">',\naction.vstudio.toolsVersion)\nend\nfunction m.projectConfigurations(prj)\nlocal platforms = {}\nfor cfg in project.eachconfig(prj) do\nlocal arch = vstudio.archFromConfig(cfg, true)\nif not table.contains(platforms, arch) then\ntable.insert(platforms, arch)\nend\nend\nlocal configs = {}\np.push('<ItemGroup Label=\"ProjectConfigurations\">')\nfor cfg in project.eachconfig(prj) do\nfor _, arch in ipairs(platforms) do\nlocal prjcfg = vstudio.projectConfig(cfg, arch)\nif not configs[prjcfg] then\nconfigs[prjcfg] = prjcfg\np.push('<ProjectConfiguration Include=\"%s\">', vstudio.projectConfig(cfg, arch))\np.x('<Configuration>%s</Configuration>', vstudio.projectPlatform(cfg))\np.w('<Platform>%s</Platform>', arch)\np.pop('</ProjectConfiguration>')\nend\nend\nend\np.pop('</ItemGroup>')\nend\nfunction m.targetFramework(prj)\nlocal action = p.action.current()\nlocal tools = string.format(' ToolsVersion=\"%s\"', action.vstudio.toolsVersion)\nlocal framework = prj.framework or action.vstudio.targetFramework or \"4.0\"\np.w('<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)\nend\nm.elements.globals = function(prj)\nreturn {\nm.projectGuid,\nm.ignoreWarnDuplicateFilename,\nm.keyword,\nm.projectName,\n}\nend\nfunction m.globals(prj)\nm.propertyGroup(nil, \"Globals\")\np.callArray(m.elements.globals, prj)\np.pop('</PropertyGroup>')\nend\nm.elements.configurationProperties = function(cfg)\nif cfg.kind == p.UTILITY then\nreturn {\nm.configurationType,\nm.platformToolset,\n}\nelse\nreturn {\nm.configurationType,\nm.useDebugLibraries,\nm.useOfMfc,\nm.useOfAtl,\nm.clrSupport,\nm.characterSet,\nm.platformToolset,\nm.wholeProgramOptimization,\nm.nmakeOutDirs,\n}\nend\nend\nfunction m.configurationProperties(cfg)\nm.propertyGroup(cfg, \"Configuration\")\np.callArray(m.elements.configurationProperties, cfg)\np.pop('</PropertyGroup>')\nend\nfunction m.configurationPropertiesGroup(prj)\nfor cfg in project.eachconfig(prj) do\nm.configurationProperties(cfg)\nend\nend\nm.elements.outputProperties = function(cfg)\nif cfg.kind == p.UTILITY then\nreturn {\nm.outDir,\nm.intDir,\nm.extensionsToDeleteOnClean,\n}\nelse\nreturn {\nm.linkIncremental,\nm.ignoreImportLibrary,\nm.outDir,\nm.outputFile,\nm.intDir,\nm.targetName,\nm.targetExt,\nm.includePath,\nm.libraryPath,\nm.imageXexOutput,\nm.generateManifest,\nm.extensionsToDeleteOnClean,\nm.executablePath,\n}\nend\nend\nfunction m.outputProperties(cfg)\nif not vstudio.isMakefile(cfg) then\nm.propertyGroup(cfg)\np.callArray(m.elements.outputProperties, cfg)\np.pop('</PropertyGroup>')\nend\nend\nfunction m.outputPropertiesGroup(prj)\nfor cfg in project.eachconfig(prj) do\nm.outputProperties(cfg)\nm.nmakeProperties(cfg)\nend\nend\nfunction m.nmakeProperties(cfg)\nif vstudio.isMakefile(cfg) then\nm.propertyGroup(cfg)\nm.nmakeOutput(cfg)\nm.nmakeCommandLine(cfg, cfg.buildcommands, \"Build\")\nm.nmakeCommandLine(cfg, cfg.rebuildcommands, \"ReBuild\")\nm.nmakeCommandLine(cfg, cfg.cleancommands, \"Clean\")\np.pop('</PropertyGroup>')\nend\nend\nm.elements.itemDefinitionGroup = function(cfg)\nif cfg.kind == p.UTILITY then\nreturn {\nm.ruleVars,\nm.buildEvents,\n}\nelse\nreturn "
	"{\nm.clCompile,\nm.resourceCompile,\nm.linker,\nm.manifest,\nm.buildEvents,\nm.imageXex,\nm.deploy,\nm.ruleVars,\nm.buildLog,\n}\nend\nend\nfunction m.itemDefinitionGroup(cfg)\nif not vstudio.isMakefile(cfg) then\np.push('<ItemDefinitionGroup %s>', m.condition(cfg))\np.callArray(m.elements.itemDefinitionGroup, cfg)\np.pop('</ItemDefinitionGroup>')\nelse\nif cfg == project.getfirstconfig(cfg.project) then\np.w('<ItemDefinitionGroup>')\np.w('</ItemDefinitionGroup>')\nend\nend\nend\nfunction m.itemDefinitionGroups(prj)\nfor cfg in project.eachconfig(prj) do\nm.itemDefinitionGroup(cfg)\nend\nend\nm.elements.clCompile = function(cfg)\nreturn {\nm.precompiledHeader,\nm.warningLevel,\nm.treatWarningAsError,\nm.disableSpecificWarnings,\nm.treatSpecificWarningsAsErrors,\nm.basicRuntimeChecks,\nm.clCompilePreprocessorDefinitions,\nm.clCompileUndefinePreprocessorDefinitions,\nm.clCompileAdditionalIncludeDirectories,\nm.clCompileAdditionalUsingDirectories,\nm.forceIncludes,\nm.debugInformationFormat,\nm.programDataBaseFileName,\nm.optimization,\nm.functionLevelLinking,\nm.intrinsicFunctions,\nm.minimalRebuild,\nm.omitFramePointers,\nm.stringPooling,\nm.runtimeLibrary,\nm.omitDefaultLib,\nm.exceptionHandling,\nm.runtimeTypeInfo,\nm.bufferSecurityCheck,\nm.treatWChar_tAsBuiltInType,\nm.floatingPointModel,\nm.inlineFunctionExpansion,\nm.enableEnhancedInstructionSet,\nm.multiProcessorCompilation,\nm.additionalCompileOptions,\nm.compileAs,\nm.callingConvention,\n}\nend\nfunction m.clCompile(cfg)\np.push('<ClCompile>')\np.callArray(m.elements.clCompile, cfg)\np.pop('</ClCompile>')\nend\nm.elements.resourceCompile = function(cfg)\nreturn {\nm.resourcePreprocessorDefinitions,\nm.resourceAdditionalIncludeDirectories,\nm.culture,\n}\nend\nfunction m.resourceCompile(cfg)\nif cfg.system ~= p.XBOX360 and p.config.hasFile(cfg, path.isresourcefile) then\nlocal contents = p.capture(function ()\np.push()\np.callArray(m.elements.resourceCompile, cfg)\np.pop()\nend)\nif #contents > 0 then\np.push('<ResourceCompile>')\np.outln(contents)\np.pop('</ResourceCompile>')\nend\nend\nend\nm.elements.linker = function(cfg, explicit)\nreturn {\nm.link,\nm.lib,\nm.linkLibraryDependencies,\n}\nend\nfunction m.linker(cfg)\nlocal explicit = vstudio.needsExplicitLink(cfg)\np.callArray(m.elements.linker, cfg, explicit)\nend\nm.elements.link = function(cfg, explicit)\nif cfg.kind == p.STATICLIB then\nreturn {\nm.subSystem,\nm.generateDebugInformation,\nm.optimizeReferences,\n}\nelse\nreturn {\nm.subSystem,\nm.generateDebugInformation,\nm.optimizeReferences,\nm.additionalDependencies,\nm.additionalLibraryDirectories,\nm.importLibrary,\nm.entryPointSymbol,\nm.generateMapFile,\nm.moduleDefinitionFile,\nm.treatLinkerWarningAsErrors,\nm.ignoreDefaultLibraries,\nm.additionalLinkOptions,\n}\nend\nend\nfunction m.link(cfg, explicit)\nlocal contents = p.capture(function ()\np.push()\np.callArray(m.elements.link, cfg, explicit)\np.pop()\nend)\nif #contents > 0 then\np.push('<Link>')\np.outln(contents)\np.pop('</Link>')\nend\nend\nm.elements.lib = function(cfg, explicit)\nif cfg.kind == p.STATICLIB then\nreturn {\nm.treatLinkerWarningAsErrors,\nm.additionalLinkOptions,\n}\nelse\nreturn {}\nend\nend\nfunction m.lib(cfg, explicit)\nlocal contents = p.capture(function ()\np.push()\np.callArray(m.elements.lib, cfg, explicit)\np.pop()\nend)\nif #contents > 0 then\np.push('<Lib>')\np.outln(contents)\np.pop('</Lib>')\nend\nend\nfunction m.manifest(cfg)\nif cfg.kind ~= p.STATICLIB then\nlocal manifests = {}\nfor _, fname in ipairs(cfg.files) do\nif path.getextension(fname) == \".manifest\" then\ntable.insert(manifests, project.getrelative(cfg.project, fname))\nend\nend\nif #manifests > 0 then\np.push('<Manifest>')\nm.element(\"AdditionalManifestFiles\", nil, \"%s %%(AdditionalManifestFiles)\", table.concat(manifests, \" \"))\np.pop('</Manifest>')\nend\nend\nend\nfunction m.buildEvents(cfg)\nlocal write = function (event)\nlocal name = event .. \"Event\"\nlocal field = event:lower()\nlocal steps = cfg[field .. \"commands\"]\nlocal msg = cfg[field .. \"message\"]\nif #steps > 0 then\nsteps "
	"= os.translateCommands(steps, p.WINDOWS)\np.push('<%s>', name)\np.x('<Command>%s</Command>', table.implode(steps, \"\", \"\", \"\\r\\n\"))\nif msg then\np.x('<Message>%s</Message>', msg)\nend\np.pop('</%s>', name)\nend\nend\nwrite(\"PreBuild\")\nwrite(\"PreLink\")\nwrite(\"PostBuild\")\nend\nfunction m.ruleVars(cfg)\nfor i = 1, #cfg.rules do\nlocal rule = p.global.getRule(cfg.rules[i])\nlocal contents = p.capture(function ()\np.push()\nfor prop in p.rule.eachProperty(rule) do\nlocal fld = p.rule.getPropertyField(rule, prop)\nlocal value = cfg[fld.name]\nif value ~= nil then\nif fld.kind == \"path\" then\nvalue = vstudio.path(cfg, value)\nelse\nvalue = p.rule.getPropertyString(rule, prop, value)\nend\nif value ~= nil and #value > 0 then\nm.element(prop.name, nil, '%s', value)\nend\nend\nend\np.pop()\nend)\nif #contents > 0 then\np.push('<%s>', rule.name)\np.outln(contents)\np.pop('</%s>', rule.name)\nend\nend\nend\nfunction m.assemblyReferences(prj)\nlocal cfg = project.getfirstconfig(prj)\nlocal refs = config.getlinks(cfg, \"system\", \"fullpath\", \"managed\")\nif #refs > 0 then\np.push('<ItemGroup>')\nfor i = 1, #refs do\nlocal value = refs[i]\nif value:find('/', 1, true) then\np.push('<Reference Include=\"%s\">', path.getbasename(value))\np.x('<HintPath>%s</HintPath>', path.translate(value))\np.pop('</Reference>')\nelse\np.x('<Reference Include=\"%s\" />', path.getbasename(value))\nend\nend\np.pop('</ItemGroup>')\nend\nend\nm.elements.files = function(prj, groups)\nreturn {\nm.clIncludeFiles,\nm.clCompileFiles,\nm.noneFiles,\nm.resourceCompileFiles,\nm.customBuildFiles,\nm.customRuleFiles,\nm.midlFiles\n}\nend\nfunction m.files(prj)\nlocal groups = m.categorizeSources(prj)\np.callArray(m.elements.files, prj, groups)\nend\nm.elements.ClCompileFile = function(cfg, file)\nreturn {}\nend\nm.elements.ClCompileFileCfg = function(fcfg, condition)\nif fcfg then\nreturn {\nm.excludedFromBuild,\nm.objectFileName,\nm.clCompilePreprocessorDefinitions,\nm.clCompileUndefinePreprocessorDefinitions,\nm.optimization,\nm.forceIncludes,\nm.precompiledHeader,\nm.enableEnhancedInstructionSet,\nm.additionalCompileOptions,\nm.disableSpecificWarnings,\nm.treatSpecificWarningsAsErrors\n}\nelse\nreturn {\nm.excludedFromBuild\n}\nend\nend\nfunction m.clCompileFiles(prj, groups)\nm.emitFiles(prj, groups, \"ClCompile\")\nend\nm.elements.ClIncludeFile = function(cfg, file)\nreturn {}\nend\nm.elements.ClIncludeFileCfg = function(fcfg, condition)\nreturn {}\nend\nfunction m.clIncludeFiles(prj, groups)\nm.emitFiles(prj, groups, \"ClInclude\")\nend\nm.elements.CustomBuildFile = function(cfg, file)\nreturn {\nm.fileType\n}\nend\nm.elements.CustomBuildFileCfg = function(fcfg, condition)\nreturn {\nm.excludedFromBuild,\nm.buildCommands,\nm.buildOutputs,\nm.buildMessage,\nm.buildAdditionalInputs\n}\nend\nfunction m.customBuildFiles(prj, groups)\nm.emitFiles(prj, groups, \"CustomBuild\", function (cfg, fcfg)\nreturn fileconfig.hasCustomBuildRule(fcfg)\nend)\nend\nfunction m.customRuleFiles(prj, groups)\nfor i = 1, #prj.rules do\nlocal rule = p.global.getRule(prj.rules[i])\nlocal files = groups[rule.name]\nif files and #files > 0 then\np.push('<ItemGroup>')\nfor _, file in ipairs(files) do\nlocal contents = p.capture(function()\np.push()\nfor prop in p.rule.eachProperty(rule) do\nlocal fld = p.rule.getPropertyField(rule, prop)\nfor cfg in project.eachconfig(prj) do\nlocal fcfg = fileconfig.getconfig(file, cfg)\nif fcfg and fcfg[fld.name] then\nlocal value = p.rule.getPropertyString(rule, prop, fcfg[fld.name])\nif value and #value > 0 then\nm.element(prop.name, m.condition(cfg), '%s', value)\nend\nend\nend\nend\np.pop()\nend)\nif #contents > 0 then\np.push('<%s Include=\\\"%s\\\">', rule.name, path.translate(file.relpath))\np.outln(contents)\np.pop('</%s>', rule.name)\nelse\np.x('<%s Include=\\\"%s\\\" />', rule.name, path.translate(file.relpath))\nend\nend\np.pop('</ItemGroup>')\nend\nend\nend\nm.elements.NoneFile = function(cfg, file)\nreturn {}\nend\nm.elements.NoneFileCfg = function(fcfg, condition)\nreturn {}\nend\nfunction m.noneFiles(prj, groups)\nm.em"
	"itFiles(prj, groups, \"None\")\nend\nm.elements.ResourceCompileFile = function(cfg, file)\nreturn {}\nend\nm.elements.ResourceCompileFileCfg = function(fcfg, condition)\nreturn {\nm.excludedFromBuild\n}\nend\nfunction m.resourceCompileFiles(prj, groups)\nm.emitFiles(prj, groups, \"ResourceCompile\", function(cfg)\nreturn cfg.system == p.WINDOWS\nend)\nend\nm.elements.MidlFile = function(cfg, file)\nreturn {}\nend\nm.elements.MidlFileCfg = function(fcfg, condition)\nreturn {\nm.excludedFromBuild\n}\nend\nfunction m.midlFiles(prj, groups)\nm.emitFiles(prj, groups, \"Midl\", function(cfg)\nreturn cfg.system == p.WINDOWS\nend)\nend\nfunction m.categorizeSources(prj)\nlocal groups = prj._vc2010_sources\nif groups then\nreturn groups\nend\ngroups = {}\nprj._vc2010_sources = groups\nlocal tr = project.getsourcetree(prj)\ntree.traverse(tr, {\nonleaf = function(node)\nlocal cat = m.categorizeFile(prj, node)\ngroups[cat] = groups[cat] or {}\ntable.insert(groups[cat], node)\nend\n})\nfor group, files in pairs(groups) do\ntable.sort(files, function (a, b)\nreturn a.relpath < b.relpath\nend)\nend\nreturn groups\nend\nfunction m.categorizeFile(prj, file)\nfor cfg in project.eachconfig(prj) do\nlocal fcfg = fileconfig.getconfig(file, cfg)\nif fileconfig.hasCustomBuildRule(fcfg) then\nreturn \"CustomBuild\"\nend\nend\nlocal rule = p.global.getRuleForFile(file.name, prj.rules)\nif rule then\nreturn rule.name\nend\nif path.iscppfile(file.name) then\nreturn \"ClCompile\"\nelseif path.iscppheader(file.name) then\nreturn \"ClInclude\"\nelseif path.isresourcefile(file.name) then\nreturn \"ResourceCompile\"\nelseif path.isidlfile(file.name) then\nreturn \"Midl\"\nelse\nreturn \"None\"\nend\nend\nfunction m.emitFiles(prj, groups, group, check)\nlocal files = groups[group]\nif files and #files > 0 then\np.push('<ItemGroup>')\nfor _, file in ipairs(files) do\nlocal contents = p.capture(function ()\np.push()\np.callArray(m.elements[group .. \"File\"], cfg, file)\nfor cfg in project.eachconfig(prj) do\nlocal fcfg = fileconfig.getconfig(file, cfg)\nif not check or check(cfg, fcfg) then\np.callArray(m.elements[group .. \"FileCfg\"], fcfg, m.condition(cfg))\nend\nend\np.pop()\nend)\nlocal rel = path.translate(file.relpath)\nif #contents > 0 then\np.push('<%s Include=\"%s\">', group, rel)\np.outln(contents)\np.pop('</%s>', group)\nelse\np.x('<%s Include=\"%s\" />', group, rel)\nend\nend\np.pop('</ItemGroup>')\nend\nend\nm.elements.projectReferences = function(prj, ref)\nif prj.clr ~= p.OFF then\nreturn {\nm.referenceProject,\nm.referencePrivate,\nm.referenceOutputAssembly,\nm.referenceCopyLocalSatelliteAssemblies,\nm.referenceLinkLibraryDependencies,\nm.referenceUseLibraryDependences,\n}\nelse\nreturn {\nm.referenceProject,\n}\nend\nend\nfunction m.projectReferences(prj)\nlocal refs = project.getdependencies(prj, 'linkOnly')\nif #refs > 0 then\ntable.sort(refs, function(a,b)\nreturn a.uuid < b.uuid\nend)\np.push('<ItemGroup>')\nfor _, ref in ipairs(refs) do\nlocal relpath = vstudio.path(prj, vstudio.projectfile(ref))\np.push('<ProjectReference Include=\\\"%s\\\">', relpath)\np.callArray(m.elements.projectReferences, prj, ref)\np.pop('</ProjectReference>')\nend\np.pop('</ItemGroup>')\nend\nend\nfunction m.additionalDependencies(cfg, explicit)\nlocal links\nlocal toolset = config.toolset(cfg)\nif toolset then\nlinks = toolset.getlinks(cfg, not explicit)\nelse\nlinks = vstudio.getLinks(cfg, explicit)\nend\nif #links > 0 then\nlinks = path.translate(table.concat(links, \";\"))\nm.element(\"AdditionalDependencies\", nil, \"%s;%%(AdditionalDependencies)\", links)\nend\nend\nfunction m.additionalIncludeDirectories(cfg, includedirs)\nif #includedirs > 0 then\nlocal dirs = vstudio.path(cfg, includedirs)\nif #dirs > 0 then\nm.element(\"AdditionalIncludeDirectories\", nil, \"%s;%%(AdditionalIncludeDirectories)\", table.concat(dirs, \";\"))\nend\nend\nend\nfunction m.additionalLibraryDirectories(cfg)\nif #cfg.libdirs > 0 then\nlocal dirs = table.concat(vstudio.path(cfg, cfg.libdirs), \";\")\nm.element(\"AdditionalLibraryDirectories\", nil, \"%s;%%(AdditionalLibrary"
	"Directories)\", dirs)\nend\nend\nfunction m.additionalUsingDirectories(cfg)\nif #cfg.usingdirs > 0 then\nlocal dirs = table.concat(vstudio.path(cfg, cfg.usingdirs), \";\")\nm.element(\"AdditionalUsingDirectories\", nil, \"%s;%%(AdditionalUsingDirectories)\", dirs)\nend\nend\nfunction m.additionalCompileOptions(cfg, condition)\nif #cfg.buildoptions > 0 then\nlocal opts = table.concat(cfg.buildoptions, \" \")\nm.element(\"AdditionalOptions\", condition, '%s %%(AdditionalOptions)', opts)\nend\nend\nfunction m.additionalLinkOptions(cfg)\nif #cfg.linkoptions > 0 then\nlocal opts = table.concat(cfg.linkoptions, \" \")\nm.element(\"AdditionalOptions\", nil, \"%s %%(AdditionalOptions)\", opts)\nend\nend\nfunction m.basicRuntimeChecks(cfg)\nlocal runtime = config.getruntime(cfg)\nif cfg.flags.NoRuntimeChecks or (config.isOptimizedBuild(cfg) and runtime:endswith(\"Debug\")) then\nm.element(\"BasicRuntimeChecks\", nil, \"Default\")\nend\nend\nfunction m.buildAdditionalInputs(fcfg, condition)\nif fcfg.buildinputs and #fcfg.buildinputs > 0 then\nlocal inputs = project.getrelative(fcfg.project, fcfg.buildinputs)\nm.element(\"AdditionalInputs\", condition, '%s', table.concat(inputs, \";\"))\nend\nend\nfunction m.buildCommands(fcfg, condition)\nlocal commands = os.translateCommands(fcfg.buildcommands, p.WINDOWS)\ncommands = table.concat(commands,'\\r\\n')\nm.element(\"Command\", condition, '%s', commands)\nend\nfunction m.buildLog(cfg)\nif cfg.buildlog and #cfg.buildlog > 0 then\np.push('<BuildLog>')\nm.element(\"Path\", nil, \"%s\", vstudio.path(cfg, cfg.buildlog))\np.pop('</BuildLog>')\nend\nend\nfunction m.buildMessage(fcfg, condition)\nif fcfg.buildmessage then\nm.element(\"Message\", condition, '%s', fcfg.buildmessage)\nend\nend\nfunction m.buildOutputs(fcfg, condition)\nlocal outputs = project.getrelative(fcfg.project, fcfg.buildoutputs)\nm.element(\"Outputs\", condition, '%s', table.concat(outputs, \";\"))\nend\nfunction m.characterSet(cfg)\nif not vstudio.isMakefile(cfg) then\nm.element(\"CharacterSet\", nil, iif(cfg.flags.Unicode, \"Unicode\", \"MultiByte\"))\nend\nend\nfunction m.wholeProgramOptimization(cfg)\nif cfg.flags.LinkTimeOptimization then\nm.element(\"WholeProgramOptimization\", nil, \"true\")\nend\nend\nfunction m.clCompileAdditionalIncludeDirectories(cfg)\nm.additionalIncludeDirectories(cfg, cfg.includedirs)\nend\nfunction m.clCompileAdditionalUsingDirectories(cfg)\nm.additionalUsingDirectories(cfg, cfg.usingdirs)\nend\nfunction m.clCompilePreprocessorDefinitions(cfg, condition)\nm.preprocessorDefinitions(cfg, cfg.defines, false, condition)\nend\nfunction m.clCompileUndefinePreprocessorDefinitions(cfg, condition)\nm.undefinePreprocessorDefinitions(cfg, cfg.undefines, false, condition)\nend\nfunction m.clrSupport(cfg)\nlocal value\nif cfg.clr == \"On\" or cfg.clr == \"Unsafe\" then\nvalue = \"true\"\nelseif cfg.clr ~= p.OFF then\nvalue = cfg.clr\nend\nif value then\nm.element(\"CLRSupport\", nil, value)\nend\nend\nfunction m.compileAs(cfg)\nif cfg.project.language == \"C\" then\nm.element(\"CompileAs\", nil, \"CompileAsC\")\nend\nend\nfunction m.configurationType(cfg)\nlocal types = {\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\nWindowedApp = \"Application\",\nMakefile = \"Makefile\",\nNone = \"Makefile\",\nUtility = \"Utility\",\n}\nm.element(\"ConfigurationType\", nil, types[cfg.kind])\nend\nfunction m.culture(cfg)\nlocal value = vstudio.cultureForLocale(cfg.locale)\nif value then\nm.element(\"Culture\", nil, \"0x%04x\", tostring(value))\nend\nend\nfunction m.debugInformationFormat(cfg)\nlocal value\nlocal tool, toolVersion = p.config.toolset(cfg)\nif cfg.flags.Symbols then\nif cfg.debugformat == \"c7\" then\nvalue = \"OldStyle\"\nelseif cfg.architecture == \"x86_64\" or\n   cfg.clr ~= p.OFF or\n   config.isOptimizedBuild(cfg) or\n   cfg.editandcontinue == p.OFF or\n   (toolVersion and toolVersion:startswith(\"LLVM-vs\"))\nthen\nvalue = \"ProgramDatabase\"\nelse\nvalue = \"EditAndContinue\"\nend\nend\nif value then\nm.element(\"DebugInformationFormat\", nil, value"
	")\nend\nend\nfunction m.deploy(cfg)\nif cfg.system == p.XBOX360 then\np.push('<Deploy>')\nm.element(\"DeploymentType\", nil, \"CopyToHardDrive\")\nm.element(\"DvdEmulationType\", nil, \"ZeroSeekTimes\")\nm.element(\"DeploymentFiles\", nil, \"$(RemoteRoot)=$(ImagePath);\")\np.pop('</Deploy>')\nend\nend\nfunction m.enableEnhancedInstructionSet(cfg, condition)\nlocal v\nlocal x = cfg.vectorextensions\nif x == \"AVX\" and _ACTION > \"vs2010\" then\nv = \"AdvancedVectorExtensions\"\nelseif x == \"AVX2\" and _ACTION > \"vs2012\" then\nv = \"AdvancedVectorExtensions2\"\nelseif cfg.architecture ~= \"x86_64\" then\nif x == \"SSE2\" or x == \"SSE3\" or x == \"SSSE3\" or x == \"SSE4.1\" then\nv = \"StreamingSIMDExtensions2\"\nelseif x == \"SSE\" then\nv = \"StreamingSIMDExtensions\"\nend\nend\nif v then\nm.element('EnableEnhancedInstructionSet', condition, v)\nend\nend\nfunction m.entryPointSymbol(cfg)\nif cfg.entrypoint then\nm.element(\"EntryPointSymbol\", nil, cfg.entrypoint)\nelse\nif (cfg.kind == premake.CONSOLEAPP or cfg.kind == premake.WINDOWEDAPP) and\nnot cfg.flags.WinMain and\ncfg.clr == p.OFF and\ncfg.system ~= p.XBOX360\nthen\nm.element(\"EntryPointSymbol\", nil, \"mainCRTStartup\")\nend\nend\nend\nfunction m.exceptionHandling(cfg)\nlocal value\nif cfg.exceptionhandling == p.OFF then\nm.element(\"ExceptionHandling\", nil, \"false\")\nelseif cfg.exceptionhandling == \"SEH\" then\nm.element(\"ExceptionHandling\", nil, \"Async\")\nend\nend\nfunction m.excludedFromBuild(filecfg, condition)\nif not filecfg or filecfg.flags.ExcludeFromBuild then\nm.element(\"ExcludedFromBuild\", condition, \"true\")\nend\nend\nfunction m.extensionsToDeleteOnClean(cfg)\nif #cfg.cleanextensions > 0 then\nlocal value = table.implode(cfg.cleanextensions, \"*\", \";\", \"\")\nm.element(\"ExtensionsToDeleteOnClean\", nil, value .. \"$(ExtensionsToDeleteOnClean)\")\nend\nend\nfunction m.fileType(cfg, file)\nm.element(\"FileType\", nil, \"Document\")\nend\nfunction m.floatingPointModel(cfg)\nif cfg.floatingpoint then\nm.element(\"FloatingPointModel\", nil, cfg.floatingpoint)\nend\nend\nfunction m.inlineFunctionExpansion(cfg)\nif cfg.inlining then\nlocal types = {\nDefault = \"Default\",\nDisabled = \"Disabled\",\nExplicit = \"OnlyExplicitInline\",\nAuto = \"AnySuitable\",\n}\nm.element(\"InlineFunctionExpansion\", nil, types[cfg.inlining])\nend\nend\nfunction m.forceIncludes(cfg, condition)\nif #cfg.forceincludes > 0 then\nlocal includes = vstudio.path(cfg, cfg.forceincludes)\nif #includes > 0 then\nm.element(\"ForcedIncludeFiles\", condition, table.concat(includes, ';'))\nend\nend\nif #cfg.forceusings > 0 then\nlocal usings = vstudio.path(cfg, cfg.forceusings)\nif #usings > 0 then\nm.element(\"ForcedUsingFiles\", condition, table.concat(usings, ';'))\nend\nend\nend\nfunction m.functionLevelLinking(cfg)\nif config.isOptimizedBuild(cfg) then\nm.element(\"FunctionLevelLinking\", nil, \"true\")\nend\nend\nfunction m.generateDebugInformation(cfg)\nm.element(\"GenerateDebugInformation\", nil, tostring(cfg.flags.Symbols ~= nil))\nend\nfunction m.generateManifest(cfg)\nif cfg.flags.NoManifest then\nm.element(\"GenerateManifest\", nil, \"false\")\nend\nend\nfunction m.generateMapFile(cfg)\nif cfg.flags.Maps then\nm.element(\"GenerateMapFile\", nil, \"true\")\nend\nend\nfunction m.ignoreDefaultLibraries(cfg)\nif #cfg.ignoredefaultlibraries > 0 then\nlocal ignored = cfg.ignoredefaultlibraries\nfor i = 1, #ignored do\nif not p.tools.msc.getLibraryExtensions()[ignored[i]:match(\"[^.]+$\")] then\nignored[i] = path.appendextension(ignored[i], \".lib\")\nend\nend\nm.element(\"IgnoreSpecificDefaultLibraries\", condition, table.concat(ignored, ';'))\nend\nend\nfunction m.ignoreWarnDuplicateFilename(prj)\nif _ACTION > \"vs2012\" then\nm.element(\"IgnoreWarnCompileDuplicatedFilename\", nil, \"true\")\nend\nend\nfunction m.ignoreImportLibrary(cfg)\nif cfg.kind == p.SHAREDLIB and cfg.flags.NoImportLib then\nm.element(\"IgnoreImportLibrary\", nil, \"true\")\nend\nend\nfunction m.imageXex(cfg)\nif cfg.system == p.XBOX360 then\np.push('<ImageXex>')\nif cfg.configfile then\nm"
	".element(\"ConfigurationFile\", nil, \"%s\", cfg.configfile)\nelse\np.w('<ConfigurationFile>')\np.w('</ConfigurationFile>')\nend\np.w('<AdditionalSections>')\np.w('</AdditionalSections>')\np.pop('</ImageXex>')\nend\nend\nfunction m.imageXexOutput(cfg)\nif cfg.system == p.XBOX360 then\nm.element(\"ImageXexOutput\", nil, \"%s\", \"$(OutDir)$(TargetName).xex\")\nend\nend\nfunction m.importLanguageTargets(prj)\np.w('<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.targets\" />')\nend\nm.elements.importExtensionTargets = function(prj)\nreturn {\nm.importRuleTargets,\n}\nend\nfunction m.importExtensionTargets(prj)\np.push('<ImportGroup Label=\"ExtensionTargets\">')\np.callArray(m.elements.importExtensionTargets, prj)\np.pop('</ImportGroup>')\nend\nfunction m.importRuleTargets(prj)\nfor i = 1, #prj.rules do\nlocal rule = p.global.getRule(prj.rules[i])\nlocal loc = vstudio.path(prj, p.filename(rule, \".targets\"))\np.x('<Import Project=\"%s\" />', loc)\nend\nend\nfunction m.importDefaultProps(prj)\np.w('<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.Default.props\" />')\nend\nfunction m.importLanguageSettings(prj)\np.w('<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.props\" />')\nend\nm.elements.importExtensionSettings = function(prj)\nreturn {\nm.importRuleSettings,\n}\nend\nfunction m.importExtensionSettings(prj)\np.push('<ImportGroup Label=\"ExtensionSettings\">')\np.callArray(m.elements.importExtensionSettings, prj)\np.pop('</ImportGroup>')\nend\nfunction m.importRuleSettings(prj)\nfor i = 1, #prj.rules do\nlocal rule = p.global.getRule(prj.rules[i])\nlocal loc = vstudio.path(prj, p.filename(rule, \".props\"))\np.x('<Import Project=\"%s\" />', loc)\nend\nend\nfunction m.importLibrary(cfg)\nif cfg.kind == p.SHAREDLIB then\nm.element(\"ImportLibrary\", nil, \"%s\", path.translate(cfg.linktarget.relpath))\nend\nend\nfunction m.includePath(cfg)\nlocal dirs = vstudio.path(cfg, cfg.sysincludedirs)\nif #dirs > 0 then\nm.element(\"IncludePath\", nil, \"%s;$(IncludePath)\", table.concat(dirs, \";\"))\nend\nend\nfunction m.intDir(cfg)\nlocal objdir = vstudio.path(cfg, cfg.objdir)\nm.element(\"IntDir\", nil, \"%s\\\\\", objdir)\nend\nfunction m.intrinsicFunctions(cfg)\nif config.isOptimizedBuild(cfg) then\nm.element(\"IntrinsicFunctions\", nil, \"true\")\nend\nend\nfunction m.keyword(prj)\nlocal isWin, isManaged, isMakefile\nfor cfg in project.eachconfig(prj) do\nif cfg.system == p.WINDOWS then\nisWin = true\nend\nif cfg.clr ~= p.OFF then\nisManaged = true\nend\nif vstudio.isMakefile(cfg) then\nisMakefile = true\nend\nend\nif isWin then\nif isMakefile then\nm.element(\"Keyword\", nil, \"MakeFileProj\")\nelse\nif isManaged then\nm.targetFramework(prj)\nm.element(\"Keyword\", nil, \"ManagedCProj\")\nelse\nm.element(\"Keyword\", nil, \"Win32Proj\")\nend\nm.element(\"RootNamespace\", nil, \"%s\", prj.name)\nend\nend\nend\nfunction m.libraryPath(cfg)\nlocal dirs = vstudio.path(cfg, cfg.syslibdirs)\nif #dirs > 0 then\nm.element(\"LibraryPath\", nil, \"%s;$(LibraryPath)\", table.concat(dirs, \";\"))\nend\nend\nfunction m.linkIncremental(cfg)\nif cfg.kind ~= p.STATICLIB then\nm.element(\"LinkIncremental\", nil, \"%s\", tostring(config.canLinkIncremental(cfg)))\nend\nend\nfunction m.linkLibraryDependencies(cfg, explicit)\nif explicit then\np.push('<ProjectReference>')\nm.element(\"LinkLibraryDependencies\", nil, \"false\")\np.pop('</ProjectReference>')\nend\nend\nfunction m.minimalRebuild(cfg)\nif config.isOptimizedBuild(cfg) or\n   cfg.flags.NoMinimalRebuild or\n   cfg.flags.MultiProcessorCompile or\n   cfg.debugformat == p.C7\nthen\nm.element(\"MinimalRebuild\", nil, \"false\")\nend\nend\nfunction m.moduleDefinitionFile(cfg)\nlocal df = config.findfile(cfg, \".def\")\nif df then\nm.element(\"ModuleDefinitionFile\", nil, \"%s\", df)\nend\nend\nfunction m.multiProcessorCompilation(cfg)\nif cfg.flags.MultiProcessorCompile then\nm.element(\"MultiProcessorCompilation\", nil, \"true\")\nend\nend\nfunction m.nmakeCommandLine(cfg, commands, phase)\nif #commands > 0 then\ncommands = os.translateCommands(commands, p.WINDOWS)\ncommands = tab"
	"le.concat(p.esc(commands), p.eol())\np.w('<NMake%sCommandLine>%s</NMake%sCommandLine>', phase, commands, phase)\nend\nend\nfunction m.nmakeOutDirs(cfg)\nif vstudio.isMakefile(cfg) then\nm.outDir(cfg)\nm.intDir(cfg)\nend\nend\nfunction m.nmakeOutput(cfg)\nm.element(\"NMakeOutput\", nil, \"$(OutDir)%s\", cfg.buildtarget.name)\nend\nfunction m.objectFileName(fcfg)\nif fcfg.objname ~= fcfg.basename then\nm.element(\"ObjectFileName\", m.condition(fcfg.config), \"$(IntDir)\\\\%s.obj\", fcfg.objname)\nend\nend\nfunction m.omitDefaultLib(cfg)\nif cfg.flags.OmitDefaultLibrary then\nm.element(\"OmitDefaultLibName\", nil, \"true\")\nend\nend\nfunction m.omitFramePointers(cfg)\nif cfg.flags.NoFramePointer then\nm.element(\"OmitFramePointers\", nil, \"true\")\nend\nend\nfunction m.optimizeReferences(cfg)\nif config.isOptimizedBuild(cfg) then\nm.element(\"EnableCOMDATFolding\", nil, \"true\")\nm.element(\"OptimizeReferences\", nil, \"true\")\nend\nend\nfunction m.optimization(cfg, condition)\nlocal map = { Off=\"Disabled\", On=\"Full\", Debug=\"Disabled\", Full=\"Full\", Size=\"MinSpace\", Speed=\"MaxSpeed\" }\nlocal value = map[cfg.optimize]\nif value or not condition then\nm.element('Optimization', condition, value or \"Disabled\")\nend\nend\nfunction m.outDir(cfg)\nlocal outdir = vstudio.path(cfg, cfg.buildtarget.directory)\nm.element(\"OutDir\", nil, \"%s\\\\\", outdir)\nend\nfunction m.outputFile(cfg)\nif cfg.system == p.XBOX360 then\nm.element(\"OutputFile\", nil, \"$(OutDir)%s\", cfg.buildtarget.name)\nend\nend\nfunction m.executablePath(cfg)\nlocal dirs = vstudio.path(cfg, cfg.bindirs)\nif #dirs > 0 then\nm.element(\"ExecutablePath\", nil, \"%s;$(ExecutablePath)\", table.concat(dirs, \";\"))\nend\nend\nfunction m.platformToolset(cfg)\nlocal tool, version = p.config.toolset(cfg)\nif not version then\nlocal action = p.action.current()\nversion = action.vstudio.platformToolset\nend\nif version then\nif cfg.kind == p.NONE or cfg.kind == p.MAKEFILE then\nif p.config.hasFile(cfg, path.iscppfile) then\nm.element(\"PlatformToolset\", nil, version)\nend\nelse\nm.element(\"PlatformToolset\", nil, version)\nend\nend\nend\nfunction m.precompiledHeader(cfg, condition)\nprjcfg, filecfg = p.config.normalize(cfg)\nif filecfg then\nif prjcfg.pchsource == filecfg.abspath and not prjcfg.flags.NoPCH then\nm.element('PrecompiledHeader', condition, 'Create')\nelseif filecfg.flags.NoPCH then\nm.element('PrecompiledHeader', condition, 'NotUsing')\nend\nelse\nif not prjcfg.flags.NoPCH and prjcfg.pchheader then\nm.element(\"PrecompiledHeader\", nil, \"Use\")\nm.element(\"PrecompiledHeaderFile\", nil, \"%s\", prjcfg.pchheader)\nelse\nm.element(\"PrecompiledHeader\", nil, \"NotUsing\")\nend\nend\nend\nfunction m.preprocessorDefinitions(cfg, defines, escapeQuotes, condition)\nif #defines > 0 then\ndefines = table.concat(defines, \";\")\nif escapeQuotes then\ndefines = defines:gsub('\"', '\\\\\"')\nend\ndefines = p.esc(defines) .. \";%%(PreprocessorDefinitions)\"\nm.element('PreprocessorDefinitions', condition, defines)\nend\nend\nfunction m.undefinePreprocessorDefinitions(cfg, undefines, escapeQuotes, condition)\nif #undefines > 0 then\nundefines = table.concat(undefines, \";\")\nif escapeQuotes then\nundefines = undefines:gsub('\"', '\\\\\"')\nend\nundefines = p.esc(undefines) .. \";%%(UndefinePreprocessorDefinitions)\"\nm.element('UndefinePreprocessorDefinitions', condition, undefines)\nend\nend\nfunction m.programDataBaseFileName(cfg)\nend\nfunction m.projectGuid(prj)\nm.element(\"ProjectGuid\", nil, \"{%s}\", prj.uuid)\nend\nfunction m.projectName(prj)\nif prj.name ~= prj.filename then\nm.element(\"ProjectName\", nil, \"%s\", prj.name)\nend\nend\nfunction m.propertyGroup(cfg, label)\nlocal cond\nif cfg then\ncond = string.format(' %s', m.condition(cfg))\nend\nif label then\nlabel = string.format(' Label=\"%s\"', label)\nend\np.push('<PropertyGroup%s%s>', cond or \"\", label or \"\")\nend\nfunction m.propertySheets(cfg)\np.push('<ImportGroup Label=\"PropertySheets\" %s>', m.condition(cfg))\np.w('<Import Project=\"$(UserRootDir)\\\\Microsoft.Cpp.$(Platfo"
	"rm).user.props\" Condition=\"exists(\\'$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\\')\" Label=\"LocalAppDataPlatform\" />')\np.pop('</ImportGroup>')\nend\nfunction m.propertySheetGroup(prj)\nfor cfg in project.eachconfig(prj) do\nm.propertySheets(cfg)\nend\nend\nfunction m.referenceCopyLocalSatelliteAssemblies(prj, ref)\nm.element(\"CopyLocalSatelliteAssemblies\", nil, \"false\")\nend\nfunction m.referenceLinkLibraryDependencies(prj, ref)\nm.element(\"LinkLibraryDependencies\", nil, \"true\")\nend\nfunction m.referenceOutputAssembly(prj, ref)\nm.element(\"ReferenceOutputAssembly\", nil, \"true\")\nend\nfunction m.referencePrivate(prj, ref)\nm.element(\"Private\", nil, \"true\")\nend\nfunction m.referenceProject(prj, ref)\nm.element(\"Project\", nil, \"{%s}\", ref.uuid)\nend\nfunction m.referenceUseLibraryDependences(prj, ref)\nm.element(\"UseLibraryDependencyInputs\", nil, \"false\")\nend\nfunction m.resourceAdditionalIncludeDirectories(cfg)\nm.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))\nend\nfunction m.resourcePreprocessorDefinitions(cfg)\nm.preprocessorDefinitions(cfg, table.join(cfg.defines, cfg.resdefines), true)\nend\nfunction m.runtimeLibrary(cfg)\nlocal runtimes = {\nStaticDebug   = \"MultiThreadedDebug\",\nStaticRelease = \"MultiThreaded\",\n}\nlocal runtime = runtimes[config.getruntime(cfg)]\nif runtime then\nm.element(\"RuntimeLibrary\", nil, runtime)\nend\nend\nfunction m.callingConvention(cfg)\nif cfg.callingconvention then\nm.element(\"CallingConvention\", nil, cfg.callingconvention)\nend\nend\nfunction m.runtimeTypeInfo(cfg)\nif cfg.rtti == p.OFF and cfg.clr == p.OFF then\nm.element(\"RuntimeTypeInfo\", nil, \"false\")\nelseif cfg.rtti == p.ON then\nm.element(\"RuntimeTypeInfo\", nil, \"true\")\nend\nend\nfunction m.bufferSecurityCheck(cfg)\nlocal tool, toolVersion = p.config.toolset(cfg)\nif cfg.flags.NoBufferSecurityCheck or (toolVersion and toolVersion:startswith(\"LLVM-vs\")) then\nm.element(\"BufferSecurityCheck\", nil, \"false\")\nend\nend\nfunction m.stringPooling(cfg)\nif config.isOptimizedBuild(cfg) then\nm.element(\"StringPooling\", nil, \"true\")\nend\nend\nfunction m.subSystem(cfg)\nif cfg.system ~= p.XBOX360 then\nlocal subsystem = iif(cfg.kind == p.CONSOLEAPP, \"Console\", \"Windows\")\nm.element(\"SubSystem\", nil, subsystem)\nend\nend\nfunction m.targetExt(cfg)\nlocal ext = cfg.buildtarget.extension\nif ext ~= \"\" then\nm.element(\"TargetExt\", nil, \"%s\", ext)\nelse\np.w('<TargetExt>')\np.w('</TargetExt>')\nend\nend\nfunction m.targetName(cfg)\nm.element(\"TargetName\", nil, \"%s%s\", cfg.buildtarget.prefix, cfg.buildtarget.basename)\nend\nfunction m.treatLinkerWarningAsErrors(cfg)\nif cfg.flags.FatalLinkWarnings then\nlocal el = iif(cfg.kind == p.STATICLIB, \"Lib\", \"Linker\")\nm.element(\"Treat\" .. el .. \"WarningAsErrors\", nil, \"true\")\nend\nend\nfunction m.treatWChar_tAsBuiltInType(cfg)\nlocal map = { On = \"true\", Off = \"false\" }\nlocal value = map[cfg.nativewchar]\nif value then\nm.element(\"TreatWChar_tAsBuiltInType\", nil, value)\nend\nend\nfunction m.treatWarningAsError(cfg)\nif cfg.flags.FatalCompileWarnings and cfg.warnings ~= p.OFF then\nm.element(\"TreatWarningAsError\", nil, \"true\")\nend\nend\nfunction m.disableSpecificWarnings(cfg, condition)\nif #cfg.disablewarnings > 0 then\nlocal warnings = table.concat(cfg.disablewarnings, \";\")\nwarnings = p.esc(warnings) .. \";%%(DisableSpecificWarnings)\"\nm.element('DisableSpecificWarnings', condition, warnings)\nend\nend\nfunction m.treatSpecificWarningsAsErrors(cfg, condition)\nif #cfg.fatalwarnings > 0 then\nlocal fatal = table.concat(cfg.fatalwarnings, \";\")\nfatal = p.esc(fatal) .. \";%%(TreatSpecificWarningsAsErrors)\"\nm.element('TreatSpecificWarningsAsErrors', condition, fatal)\nend\nend\nfunction m.useDebugLibraries(cfg)\nlocal runtime = config.getruntime(cfg)\nm.element(\"UseDebugLibraries\", nil, tostring(runtime:endswith(\"Debug\")))\nend\nfunction m.useOfMfc(cfg)\nif cfg.flags.MFC then\nm.element(\"UseOfMfc\", nil, iif(cfg.flags.StaticRuntime, \"Static\", \""
	"Dynamic\"))\nend\nend\nfunction m.useOfAtl(cfg)\nif cfg.atl then\nm.element(\"UseOfATL\", nil, cfg.atl)\nend\nend\nfunction m.userMacros(cfg)\np.w('<PropertyGroup Label=\"UserMacros\" />')\nend\nfunction m.warningLevel(cfg)\nlocal map = { Off = \"TurnOffAllWarnings\", Extra = \"Level4\" }\nm.element(\"WarningLevel\", nil, \"%s\", map[cfg.warnings] or \"Level3\")\nend\nfunction m.xmlDeclaration()\np.xmlUtf8()\nend\nfunction m.condition(cfg)\nreturn string.format('Condition=\"\\'$(Configuration)|$(Platform)\\'==\\'%s\\'\"', p.esc(vstudio.projectConfig(cfg)))\nend\nfunction m.element(name, condition, value, ...)\nif select('#',...) == 0 then\nvalue = p.esc(value)\nend\nlocal format\nif condition then\nformat = string.format('<%s %s>%s</%s>', name, condition, value, name)\nelse\nformat = string.format('<%s>%s</%s>', name, value, name)\nend\np.x(format, ...)\nend\n",

	"local p = premake\nlocal m = p.vstudio.vc2010\nm.elements.user = function(cfg)\nreturn {\nm.debugSettings,\n}\nend\nfunction m.generateUser(prj)\nlocal contents = {}\nlocal size = 0\nfor cfg in p.project.eachconfig(prj) do\ncontents[cfg] = p.capture(function()\np.push(2)\np.callArray(m.elements.user, cfg)\np.pop(2)\nend)\nsize = size + #contents[cfg]\nend\nif size > 0 then\nm.xmlDeclaration()\nm.userProject()\nfor cfg in p.project.eachconfig(prj) do\np.push('<PropertyGroup %s>', m.condition(cfg))\nif #contents[cfg] > 0 then\np.outln(contents[cfg])\nend\np.pop('</PropertyGroup>')\nend\np.pop('</Project>')\nend\nend\nfunction m.userProject()\nlocal action = premake.action.current()\np.push('<Project ToolsVersion=\"%s\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">',\naction.vstudio.toolsVersion)\nend\nm.elements.debugSettings = function(cfg)\nreturn {\nm.localDebuggerCommand,\nm.localDebuggerWorkingDirectory,\nm.debuggerFlavor,\nm.localDebuggerCommandArguments,\nm.localDebuggerDebuggerType,\nm.localDebuggerEnvironment,\nm.localDebuggerMergeEnvironment,\n}\nend\nfunction m.debugSettings(cfg)\np.callArray(m.elements.debugSettings, cfg)\nend\nfunction m.debuggerFlavor(cfg)\nif cfg.debugdir or cfg.debugcommand then\np.w('<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')\nend\nend\nfunction m.localDebuggerCommand(cfg)\nif cfg.debugcommand then\nlocal dir = path.translate(cfg.debugcommand)\np.w('<LocalDebuggerCommand>%s</LocalDebuggerCommand>', dir)\nend\nend\nfunction m.localDebuggerDebuggerType(cfg)\nif cfg.debuggertype then\np.w('<LocalDebuggerDebuggerType>%s</LocalDebuggerDebuggerType>', cfg.debuggertype)\nend\nend\nfunction m.localDebuggerCommandArguments(cfg)\nif #cfg.debugargs > 0 then\np.x('<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>', table.concat(cfg.debugargs, \" \"))\nend\nend\nfunction m.localDebuggerWorkingDirectory(cfg)\nif cfg.debugdir then\nlocal dir = p.vstudio.path(cfg, cfg.debugdir)\np.x('<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>', dir)\nend\nend\nfunction m.localDebuggerEnvironment(cfg)\nif #cfg.debugenvs > 0 then\nlocal envs = table.concat(cfg.debugenvs, \"\\n\")\nif cfg.flags.DebugEnvsInherit then\nenvs = envs .. \"\\n$(LocalDebuggerEnvironment)\"\nend\np.w('<LocalDebuggerEnvironment>%s</LocalDebuggerEnvironment>', envs)\nif cfg.flags.DebugEnvsDontMerge then\np.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')\nend\nend\nend\nfunction m.localDebuggerMergeEnvironment(cfg)\nif #cfg.debugenvs > 0 and cfg.flags.DebugEnvsDontMerge then\np.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')\nend\nend\n",

	"local p = premake\nlocal project = p.project\nlocal tree = p.tree\nlocal m = p.vstudio.vc2010\nfunction m.generateFilters(prj)\nm.xmlDeclaration()\nm.filtersProject()\nm.uniqueIdentifiers(prj)\nm.filterGroups(prj)\np.out('</Project>')\nend\nfunction m.filtersProject()\nlocal action = premake.action.current()\np.push('<Project ToolsVersion=\"%s\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">',\naction.vstudio.filterToolsVersion or action.vstudio.toolsVersion)\nend\nm.elements.filterGroups = {\n\"None\",\n\"ClInclude\",\n\"ClCompile\",\n\"ResourceCompile\",\n\"CustomBuild\",\n\"CustomRule\"\n}\nm.elements.filters = function(prj, groups)\nlocal calls = {}\nfor i, group in ipairs(m.elements.filterGroups) do\ncalls[i] = m[group .. \"Filters\"]\nend\nreturn calls\nend\nfunction m.filterGroups(prj)\nlocal groups = m.categorizeSources(prj)\np.callArray(m.elements.filters, prj, groups)\nend\nfunction m.uniqueIdentifiers(prj)\nlocal tr = project.getsourcetree(prj)\nlocal contents = p.capture(function()\np.push()\ntree.traverse(tr, {\nonbranch = function(node, depth)\np.push('<Filter Include=\"%s\">', path.translate(node.path))\np.w('<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(node.path))\np.pop('</Filter>')\nend\n}, false)\np.pop()\nend)\nif #contents > 0 then\np.push('<ItemGroup>')\np.outln(contents)\np.pop('</ItemGroup>')\nend\nend\nfunction m.ClCompileFilters(prj, groups)\nm.filterGroup(prj, groups, \"ClCompile\")\nend\nfunction m.ClIncludeFilters(prj, groups)\nm.filterGroup(prj, groups, \"ClInclude\")\nend\nfunction m.CustomBuildFilters(prj, groups)\nm.filterGroup(prj, groups, \"CustomBuild\")\nend\nfunction m.CustomRuleFilters(prj, groups)\nfor group, files in pairs(groups) do\nif not table.contains(m.elements.filterGroups, group) then\nm.filterGroup(prj, groups, group)\nend\nend\nend\nfunction m.NoneFilters(prj, groups)\nm.filterGroup(prj, groups, \"None\")\nend\nfunction m.ResourceCompileFilters(prj, groups)\nm.filterGroup(prj, groups, \"ResourceCompile\")\nend\nfunction m.filterGroup(prj, groups, group)\nlocal files = groups[group] or {}\nif #files > 0 then\np.push('<ItemGroup>')\nfor _, file in ipairs(files) do\nif file.parent.path then\np.push('<%s Include=\\\"%s\\\">', group, path.translate(file.relpath))\np.w('<Filter>%s</Filter>', path.translate(file.parent.path))\np.pop('</%s>', group)\nelse\np.w('<%s Include=\\\"%s\\\" />', group, path.translate(file.relpath))\nend\nend\np.pop('</ItemGroup>')\nend\nend\n",

	"premake.vstudio.vs2010.rules = {}\npremake.vstudio.vs2010.rules.props = {}\nlocal m = premake.vstudio.vs2010.rules.props\nm.elements = {}\nlocal p = premake\nm.elements.project = function(r)\nreturn {\np.vstudio.projectElement,\nm.targetsGroup,\nm.dependsOnGroup,\nm.ruleGroup,\n}\nend\nfunction m.generate(r)\np.xmlUtf8()\np.callArray(m.elements.project, r)\np.pop()\np.out('</Project>')\nend\nm.elements.targetsGroup = function(r)\nreturn {\nm.beforeTargets,\nm.afterTargets,\n}\nend\nfunction m.targetsGroup(r)\np.w('<PropertyGroup')\np.push('  Condition=\"\\'$(%sBeforeTargets)\\' == \\'\\' and \\'$(%sAfterTargets)\\' == \\'\\' and \\'$(ConfigurationType)\\' != \\'Makefile\\'\">',\nr.name, r.name)\np.callArray(m.elements.targetsGroup, r)\np.pop('</PropertyGroup>')\nend\nm.elements.dependsOnGroup = function(r)\nreturn {\nm.dependsOn,\n}\nend\nfunction m.dependsOnGroup(r)\np.push('<PropertyGroup>')\np.callArray(m.elements.dependsOnGroup, r)\np.pop('</PropertyGroup>')\nend\nm.elements.ruleGroup = function(r)\nreturn {\nm.propertyDefaults,\nm.commandLineTemplates,\nm.outputs,\nm.executionDescription,\nm.additionalDependencies,\n}\nend\nfunction m.ruleGroup(r)\np.push('<ItemDefinitionGroup>')\np.push('<%s>', r.name)\np.callArray(m.elements.ruleGroup, r)\np.pop('</%s>', r.name)\np.pop('</ItemDefinitionGroup>')\nend\nfunction m.propertyDefaults(r)\nlocal defs = r.propertydefinition\nfor i = 1, #defs do\nlocal def = defs[i]\nlocal value = def.value\nif value then\nif def.kind == \"path\" then\nvalue = path.translate(value)\nend\np.w('<%s>%s</%s>', def.name, value, def.name)\nend\nend\nend\nfunction m.additionalDependencies(r)\nlocal deps = table.concat(r.builddependencies, \";\")\np.x('<AdditionalDependencies>%s</AdditionalDependencies>', deps)\nend\nfunction m.afterTargets(r)\np.w('<%sAfterTargets>CustomBuild</%sAfterTargets>', r.name, r.name)\nend\nfunction m.beforeTargets(r)\np.w('<%sBeforeTargets>Midl</%sBeforeTargets>', r.name, r.name)\nend\nfunction m.commandLineTemplates(r)\nif #r.buildcommands then\nlocal cmds = os.translateCommands(r.buildcommands, p.WINDOWS)\ncmds = table.concat(cmds, p.eol())\np.x('<CommandLineTemplate>%s</CommandLineTemplate>', cmds)\nend\nend\nfunction m.dependsOn(r)\n    p.w('<%sDependsOn', r.name)\n    p.w('  Condition=\"\\'$(ConfigurationType)\\' != \\'Makefile\\'\">_SelectedFiles;$(%sDependsOn)</%sDependsOn>',\n    r.name, r.name, r.name)\nend\nfunction m.executionDescription(r)\nif r.buildmessage then\np.x('<ExecutionDescription>%s</ExecutionDescription>', r.buildmessage)\nend\nend\nfunction m.outputs(r)\nif #r.buildoutputs then\nlocal outputs = table.concat(r.buildoutputs, \";\")\np.x('<Outputs>%s</Outputs>', path.translate(outputs))\nend\nend\n",

	"premake.vstudio.vs2010.rules.targets = {}\nlocal m = premake.vstudio.vs2010.rules.targets\nm.elements = {}\nlocal p = premake\nm.elements.project = function(r)\nreturn {\np.vstudio.projectElement,\nm.availableItemGroup,\nm.computeInputsGroup,\nm.usingTask,\nm.ruleTarget,\nm.computeOutputTarget,\n}\nend\nfunction m.generate(r)\np.xmlUtf8()\np.callArray(m.elements.project, r)\np.pop()\np.out('</Project>')\nend\nm.elements.availableItemGroup = function(r)\nreturn {\nm.propertyPageSchema,\nm.availableItemName,\n}\nend\nfunction m.availableItemGroup(r)\np.push('<ItemGroup>')\np.callArray(m.elements.availableItemGroup, r)\np.pop('</ItemGroup>')\nend\nm.elements.computeInputsGroup = function(r)\nreturn {\nm.computeLinkInputsTargets,\nm.computeLibInputsTargets,\n}\nend\nfunction m.computeInputsGroup(r)\np.push('<PropertyGroup>')\np.callArray(m.elements.computeInputsGroup, r)\np.pop('</PropertyGroup>')\nend\nm.elements.ruleTargetAttributes = function(r)\nreturn {\nm.targetName,\nm.beforeTargets,\nm.afterTargets,\nm.targetCondition,\nm.targetOutputs,\nm.targetInputs,\nm.dependsOnTargets,\n}\nend\nm.elements.ruleTarget = function(r)\nreturn {\nm.selectedFiles,\nm.tlog,\nm.message,\nm.tlogWrite,\nm.tlogRead,\nm.rule,\n}\nend\nfunction m.ruleTarget(r)\nlocal attribs = p.capture(function()\np.push()\np.callArray(m.elements.ruleTargetAttributes, r)\np.pop()\nend)\np.push('<Target')\np.outln(attribs .. '>')\np.callArray(m.elements.ruleTarget, r)\np.pop('</Target>')\nend\nm.elements.tlog = function(r)\nreturn {\nm.tlogSource,\nm.tlogInputs,\nm.tlogProperties,\n}\nend\nfunction m.tlog(r)\np.push('<ItemGroup>')\np.push('<%s_tlog', r.name)\np.w('Include=\"%%(%s.Outputs)\"', r.name)\np.w('Condition=\"\\'%%(%s.Outputs)\\' != \\'\\' and \\'%%(%s.ExcludedFromBuild)\\' != \\'true\\'\">', r.name, r.name)\np.callArray(m.elements.tlog, r)\np.pop('</%s_tlog>', r.name)\np.pop('</ItemGroup>')\nend\nm.elements.ruleAttributes = function(r)\nreturn {\nm.ruleCondition,\nm.commandLineTemplate,\nm.properties,\nm.additionalOptions,\nm.inputs,\nm.standardOutputImportance,\n}\nend\nfunction m.rule(r)\nlocal attribs = p.capture(function()\np.push()\np.callArray(m.elements.ruleAttributes, r)\np.pop()\nend)\np.w('<%s', r.name)\np.outln(attribs .. ' />')\nend\nm.elements.computeOutputItems = function(r)\nreturn {\nm.outputs,\nm.linkLib,\n}\nend\nm.elements.computeOutputTarget = function(r)\nreturn {\nm.makeDir,\n}\nend\nfunction m.computeOutputTarget(r)\np.push('<Target')\np.w('Name=\"Compute%sOutput\"', r.name)\np.w('Condition=\"\\'@(%s)\\' != \\'\\'\">', r.name)\np.push('<ItemGroup>')\np.callArray(m.elements.computeOutputItems, r)\np.pop('</ItemGroup>')\np.callArray(m.elements.computeOutputTarget, r)\np.pop('</Target>')\nend\nfunction m.additionalOptions(r)\np.w('AdditionalOptions=\"%%(%s.AdditionalOptions)\"', r.name)\nend\nfunction m.commandLineTemplate(r)\np.w('CommandLineTemplate=\"%%(%s.CommandLineTemplate)\"', r.name)\nend\nfunction m.afterTargets(r)\np.w('AfterTargets=\"$(%sAfterTargets)\"', r.name)\nend\nfunction m.availableItemName(r)\np.push('<AvailableItemName Include=\"%s\">', r.name)\np.w('<Targets>_%s</Targets>', r.name)\np.pop('</AvailableItemName>')\nend\nfunction m.beforeTargets(r)\np.w('BeforeTargets=\"$(%sBeforeTargets)\"', r.name)\nend\nfunction m.computeLibInputsTargets(r)\np.push('<ComputeLibInputsTargets>')\np.w('$(ComputeLibInputsTargets);')\np.w('Compute%sOutput;', r.name)\np.pop('</ComputeLibInputsTargets>')\nend\nfunction m.computeLinkInputsTargets(r)\np.push('<ComputeLinkInputsTargets>')\np.w('$(ComputeLinkInputsTargets);')\np.w('Compute%sOutput;', r.name)\np.pop('</ComputeLinkInputsTargets>')\nend\nfunction m.dependsOnTargets(r)\np.w('DependsOnTargets=\"$(%sDependsOn);Compute%sOutput\"', r.name, r.name)\nend\nfunction m.inputs(r)\np.w('Inputs=\"%%(%s.Identity)\"', r.name)\nend\nfunction m.linkLib(r)\nlocal linkable\nfor i = 1, #r.buildoutputs do\nif (path.islinkable(r.buildoutputs[i])) then\nlinkable = true\nend\nend\nif linkable then\nfor i, el in pairs { 'Link', 'Lib', 'ImpLib' } do\np.push('<%s', el)\np.w('Include=\"%%(%sOutputs.Id"
	"entity)\"', r.name)\np.w('Condition=\"\\'%%(Extension)\\'==\\'.obj\\' or \\'%%(Extension)\\'==\\'.res\\' or \\'%%(Extension)\\'==\\'.rsc\\' or \\'%%(Extension)\\'==\\'.lib\\'\" />')\np.pop()\nend\nend\nend\nfunction m.makeDir(r)\np.w('<MakeDir Directories=\"@(%sOutputs->\\'%%(RootDir)%%(Directory)\\')\" />', r.name)\nend\nfunction m.message(r)\np.w('<Message')\np.w('  Importance=\"High\"')\np.w('  Text=\"%%(%s.ExecutionDescription)\" />', r.name)\n end\nfunction m.outputs(r)\np.w('<%sOutputs', r.name)\np.w('  Condition=\"\\'@(%s)\\' != \\'\\' and \\'%%(%s.ExcludedFromBuild)\\' != \\'true\\'\"', r.name, r.name)\n        p.w('  Include=\"%%(%s.Outputs)\" />', r.name)\nend\n function m.properties(r)\nlocal defs = r.propertydefinition\nfor i = 1, #defs do\nlocal name = defs[i].name\np.w('%s=\"%%(%s.%s)\"', name, r.name, name)\nend\n end\nfunction m.propertyPageSchema(r)\np.w('<PropertyPageSchema')\np.w('  Include=\"$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml\" />')\nend\nfunction m.ruleCondition(r)\np.w('Condition=\"\\'@(%s)\\' != \\'\\' and \\'%%(%s.ExcludedFromBuild)\\' != \\'true\\'\"', r.name, r.name)\nend\nfunction m.selectedFiles(r)\np.push('<ItemGroup Condition=\"\\'@(SelectedFiles)\\' != \\'\\'\">')\np.w('<%s Remove=\"@(%s)\" Condition=\"\\'%%(Identity)\\' != \\'@(SelectedFiles)\\'\" />', r.name, r.name)\np.pop('</ItemGroup>')\nend\nfunction m.standardOutputImportance(r)\np.w('StandardOutputImportance=\"High\"')\np.w('StandardErrorImportance=\"High\"')\nend\nfunction m.targetCondition(r)\np.w('Condition=\"\\'@(%s)\\' != \\'\\'\"', r.name)\nend\nfunction m.targetInputs(r)\nlocal extra = {}\nlocal defs = r.propertydefinition\nfor i = 1, #defs do\nlocal def = defs[i]\nif def.dependency then\ntable.insert(extra, string.format(\"%%(%s.%s);\", r.name, def.name))\nend\nend\nextra = table.concat(extra)\np.w('Inputs=\"%%(%s.Identity);%%(%s.AdditionalDependencies);%s$(MSBuildProjectFile)\"', r.name, r.name, extra)\nend\nfunction m.targetName(r)\np.w('Name=\"_%s\"', r.name)\nend\nfunction m.targetOutputs(r)\np.w('Outputs=\"%%(%s.Outputs)\"', r.name)\nend\nfunction m.tlogInputs(r)\np.w(\"<Inputs>@(%s, ';')</Inputs>\", r.name)\nend\nfunction m.tlogProperties(r)\nlocal defs = r.propertydefinition\nfor i = 1, #defs do\nlocal def = defs[i]\nif def.dependency then\np.w('<%s>%%(%s.%s)</%s>', def.name, r.name, def.name, def.name)\nend\nend\nend\nfunction m.tlogRead(r)\nlocal extra = {}\nlocal defs = r.propertydefinition\nfor i = 1, #defs do\nlocal def = defs[i]\nif def.dependency then\ntable.insert(extra, string.format(\"%%(%s_tlog.%s);\", r.name, def.name))\nend\nend\nextra = table.concat(extra)\np.w('<WriteLinesToFile')\np.w('  Condition=\"\\'@(%s_tlog)\\' != \\'\\' and \\'%%(%s_tlog.ExcludedFromBuild)\\' != \\'true\\'\"', r.name, r.name)\np.w('  File=\"$(IntDir)$(ProjectName).read.1.tlog\"')\np.w('  Lines=\"^%%(%s_tlog.Inputs);%s$(MSBuildProjectFullPath);%%(%s_tlog.Fullpath)\" />', r.name, extra, r.name)\nend\nfunction m.tlogWrite(r)\np.w('<WriteLinesToFile')\np.w('  Condition=\"\\'@(%s_tlog)\\' != \\'\\' and \\'%%(%s_tlog.ExcludedFromBuild)\\' != \\'true\\'\"', r.name, r.name)\np.w('  File=\"$(IntDir)$(ProjectName).write.1.tlog\"')\np.w('  Lines=\"^%%(%s_tlog.Source);%%(%s_tlog.Fullpath)\" />', r.name, r.name)\nend\nfunction m.tlogSource(r)\np.w(\"<Source>@(%s, '|')</Source>\", r.name)\nend\nfunction m.usingTask(r)\np.push('<UsingTask')\np.w('TaskName=\"%s\"', r.name)\np.w('TaskFactory=\"XamlTaskFactory\"')\np.w('AssemblyName=\"Microsoft.Build.Tasks.v4.0\">')\np.w('<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>')\np.pop('</UsingTask>')\nend\n",

	"premake.vstudio.vs2010.rules.xml = {}\nlocal m = premake.vstudio.vs2010.rules.xml\nm.elements = {}\nlocal p = premake\nm.elements.project = function(r)\nreturn {\np.xmlUtf8,\nm.projectSchemaDefinitions,\nm.rule,\nm.ruleItem,\nm.fileExtension,\nm.contentType,\n}\nend\nfunction m.generate(r)\np.callArray(m.elements.project, r)\np.out('</ProjectSchemaDefinitions>')\nend\nm.elements.rule = function(r)\nreturn {\nm.dataSource,\nm.categories,\nm.inputs,\nm.properties,\nm.commandLineTemplate,\nm.beforeTargets,\nm.afterTargets,\nm.outputs,\nm.executionDescription,\nm.additionalDependencies,\nm.additionalOptions,\n}\nend\nfunction m.rule(r)\np.push('<Rule')\np.w('Name=\"%s\"', r.name)\np.w('PageTemplate=\"tool\"')\np.w('DisplayName=\"%s\"', r.display or r.name)\np.w('Order=\"200\">')\np.callArray(m.elements.rule, r)\np.pop('</Rule>')\nend\nfunction m.categories(r)\nlocal categories = {\n[1] = { name=\"General\" },\n[2] = { name=\"Command Line\", subtype=\"CommandLine\" },\n}\np.push('<Rule.Categories>')\nfor i = 1, #categories do\nm.category(categories[i])\nend\np.pop('</Rule.Categories>')\nend\nfunction m.category(cat)\nlocal attribs = p.capture(function()\np.push()\np.w('Name=\"%s\"', cat.name)\nif cat.subtype then\np.w('Subtype=\"%s\"', cat.subtype)\nend\np.pop()\nend)\np.push('<Category')\np.outln(attribs .. '>')\np.push('<Category.DisplayName>')\np.w('<sys:String>%s</sys:String>', cat.name)\np.pop('</Category.DisplayName>')\np.pop('</Category>')\nend\nfunction m.properties(r)\nlocal defs = r.propertydefinition\nfor i = 1, #defs do\nlocal def = defs[i]\nif def.kind == \"boolean\" then\nm.boolProperty(def)\nelseif def.kind == \"list\" then\nm.stringListProperty(def)\nelseif type(def.values) == \"table\" then\nm.enumProperty(def)\nelse\nm.stringProperty(def)\nend\nend\nend\nfunction m.baseProperty(def, suffix)\nlocal c = p.capture(function ()\np.w('Name=\"%s\"', def.name)\np.w('HelpContext=\"0\"')\np.w('DisplayName=\"%s\"', def.display or def.name)\nif def.description then\np.w('Description=\"%s\"', def.description)\nend\nend)\nif suffix then\nc = c .. suffix\nend\np.outln(c)\nend\nfunction m.boolProperty(def)\np.push('<BoolProperty')\nm.baseProperty(def)\np.w('Switch=\"%s\" />', def.switch or \"[value]\")\np.pop()\nend\nfunction m.enumProperty(def)\np.push('<EnumProperty')\nm.baseProperty(def, '>')\nlocal values = def.values\nlocal switches = def.switch or {}\nlocal keys = table.keys(def.values)\ntable.sort(keys)\nfor _, key in pairs(keys) do\np.push('<EnumValue')\np.w('Name=\"%d\"', key)\nif switches[key] then\np.w('DisplayName=\"%s\"', values[key])\np.w('Switch=\"%s\" />', switches[key])\nelse\np.w('DisplayName=\"%s\" />', values[key])\nend\np.pop()\nend\np.pop('</EnumProperty>')\nend\nfunction m.stringProperty(def)\np.push('<StringProperty')\nm.baseProperty(def)\np.w('Switch=\"%s\" />', def.switch or \"[value]\")\np.pop()\nend\nfunction m.stringListProperty(def)\np.push('<StringListProperty')\nm.baseProperty(def)\np.w('Separator=\"%s\"', def.separator or \" \")\np.w('Switch=\"%s\" />', def.switch or \"[value]\")\np.pop()\nend\nfunction m.additionalDependencies(r)\np.push('<StringListProperty')\np.w('Name=\"AdditionalDependencies\"')\np.w('DisplayName=\"Additional Dependencies\"')\np.w('IncludeInCommandLine=\"False\"')\np.w('Visible=\"false\" />')\np.pop()\nend\nfunction m.additionalOptions(r)\np.push('<StringProperty')\np.w('Subtype=\"AdditionalOptions\"')\np.w('Name=\"AdditionalOptions\"')\np.w('Category=\"Command Line\">')\np.push('<StringProperty.DisplayName>')\np.w('<sys:String>Additional Options</sys:String>')\np.pop('</StringProperty.DisplayName>')\np.push('<StringProperty.Description>')\np.w('<sys:String>Additional Options</sys:String>')\np.pop('</StringProperty.Description>')\np.pop('</StringProperty>')\nend\nfunction m.afterTargets(r)\np.push('<DynamicEnumProperty')\np.w('Name=\"%sAfterTargets\"', r.name)\np.w('Category=\"General\"')\np.w('EnumProvider=\"Targets\"')\np.w('IncludeInCommandLine=\"False\">')\np.push('<DynamicEnumProperty.DisplayName>')\np.w('<sys:String>Execute After</sys:String>')\np.pop('</DynamicEnu"
	"mProperty.DisplayName>')\np.push('<DynamicEnumProperty.Description>')\np.w('<sys:String>Specifies the targets for the build customization to run after.</sys:String>')\np.pop('</DynamicEnumProperty.Description>')\np.push('<DynamicEnumProperty.ProviderSettings>')\np.push('<NameValuePair')\np.w('Name=\"Exclude\"')\np.w('Value=\"^%sAfterTargets|^Compute\" />', r.name)\np.pop()\np.pop('</DynamicEnumProperty.ProviderSettings>')\np.push('<DynamicEnumProperty.DataSource>')\np.push('<DataSource')\np.w('Persistence=\"ProjectFile\"')\np.w('ItemType=\"\"')\np.w('HasConfigurationCondition=\"true\" />')\np.pop()\np.pop('</DynamicEnumProperty.DataSource>')\np.pop('</DynamicEnumProperty>')\nend\nfunction m.beforeTargets(r)\np.push('<DynamicEnumProperty')\np.w('Name=\"%sBeforeTargets\"', r.name)\np.w('Category=\"General\"')\np.w('EnumProvider=\"Targets\"')\np.w('IncludeInCommandLine=\"False\">')\np.push('<DynamicEnumProperty.DisplayName>')\np.w('<sys:String>Execute Before</sys:String>')\np.pop('</DynamicEnumProperty.DisplayName>')\np.push('<DynamicEnumProperty.Description>')\np.w('<sys:String>Specifies the targets for the build customization to run before.</sys:String>')\np.pop('</DynamicEnumProperty.Description>')\np.push('<DynamicEnumProperty.ProviderSettings>')\np.push('<NameValuePair')\np.w('Name=\"Exclude\"')\np.w('Value=\"^%sBeforeTargets|^Compute\" />', r.name)\np.pop()\np.pop('</DynamicEnumProperty.ProviderSettings>')\np.push('<DynamicEnumProperty.DataSource>')\np.push('<DataSource')\np.w('Persistence=\"ProjectFile\"')\np.w('HasConfigurationCondition=\"true\" />')\np.pop()\np.pop('</DynamicEnumProperty.DataSource>')\np.pop('</DynamicEnumProperty>')\nend\nfunction m.commandLineTemplate(r)\np.push('<StringProperty')\np.w('Name=\"CommandLineTemplate\"')\np.w('DisplayName=\"Command Line\"')\np.w('Visible=\"False\"')\np.w('IncludeInCommandLine=\"False\" />')\np.pop()\nend\nfunction m.contentType(r)\np.push('<ContentType')\np.w('Name=\"%s\"', r.name)\np.w('DisplayName=\"%s\"', r.display or r.name)\np.w('ItemType=\"%s\" />', r.name)\np.pop()\nend\nfunction m.dataSource(r)\np.push('<Rule.DataSource>')\np.push('<DataSource')\np.w('Persistence=\"ProjectFile\"')\np.w('ItemType=\"%s\" />', r.name)\np.pop()\np.pop('</Rule.DataSource>')\nend\nfunction m.executionDescription(r)\np.push('<StringProperty')\np.w('Name=\"ExecutionDescription\"')\np.w('DisplayName=\"Execution Description\"')\np.w('Visible=\"False\"')\np.w('IncludeInCommandLine=\"False\" />')\np.pop()\nend\nfunction m.fileExtension(r)\np.push('<FileExtension')\np.w('Name=\"*%s\"', r.fileextension)\np.w('ContentType=\"%s\" />', r.name)\np.pop()\nend\nfunction m.inputs(r)\np.push('<StringListProperty')\np.w('Name=\"Inputs\"')\np.w('Category=\"Command Line\"')\np.w('IsRequired=\"true\"')\np.w('Switch=\" \">')\np.push('<StringListProperty.DataSource>')\np.push('<DataSource')\np.w('Persistence=\"ProjectFile\"')\np.w('ItemType=\"%s\"', r.name)\np.w('SourceType=\"Item\" />')\np.pop()\np.pop('</StringListProperty.DataSource>')\np.pop('</StringListProperty>')\nend\nfunction m.outputs(r)\np.push('<StringListProperty')\np.w('Name=\"Outputs\"')\np.w('DisplayName=\"Outputs\"')\np.w('Visible=\"False\"')\np.w('IncludeInCommandLine=\"False\" />')\np.pop()\nend\nfunction m.ruleItem(r)\np.push('<ItemType')\np.w('Name=\"%s\"', r.name)\np.w('DisplayName=\"%s\" />', r.display or r.name)\np.pop()\nend\nfunction m.projectSchemaDefinitions(r)\np.push('<ProjectSchemaDefinitions xmlns=\"http://schemas.microsoft.com/build/2009/properties\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:sys=\"clr-namespace:System;assembly=mscorlib\">')\nend\n",

	"local vstudio = premake.vstudio\nlocal cs2005 = vstudio.cs2005\nlocal vc2010 = vstudio.vc2010\nlocal p = premake\nnewaction {\ntrigger     = \"vs2012\",\nshortname   = \"Visual Studio 2012\",\ndescription = \"Generate Visual Studio 2012 project files\",\nos = \"windows\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Makefile\", \"None\", \"Utility\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"msc\"   },\ndotnet = { \"msnet\" },\n},\nonWorkspace = function(wks)\nvstudio.vs2005.generateSolution(wks)\nend,\nonProject = function(prj)\nvstudio.vs2010.generateProject(prj)\nend,\nonRule = function(rule)\nvstudio.vs2010.generateRule(rule)\nend,\nonCleanWorkspace = function(wks)\nvstudio.cleanSolution(wks)\nend,\nonCleanProject = function(prj)\nvstudio.cleanProject(prj)\nend,\nonCleanTarget = function(prj)\nvstudio.cleanTarget(prj)\nend,\npathVars        = vstudio.pathVars,\nvstudio = {\nsolutionVersion = \"12\",\nversionName     = \"2012\",\ntargetFramework = \"4.5\",\ntoolsVersion    = \"4.0\",\nplatformToolset = \"v110\"\n}\n}\n",

	"premake.vstudio.vc2013 = {}\nlocal p = premake\nlocal vstudio = p.vstudio\nlocal vc2010 = vstudio.vc2010\nlocal m = vstudio.vc2013\nnewaction {\ntrigger     = \"vs2013\",\nshortname   = \"Visual Studio 2013\",\ndescription = \"Generate Visual Studio 2013 project files\",\nos = \"windows\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Makefile\", \"None\", \"Utility\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"msc\"   },\ndotnet = { \"msnet\" },\n},\nonWorkspace = function(wks)\nvstudio.vs2005.generateSolution(wks)\nend,\nonProject = function(prj)\nvstudio.vs2010.generateProject(prj)\nend,\nonRule = function(rule)\nvstudio.vs2010.generateRule(rule)\nend,\nonCleanWorkspace = function(wks)\nvstudio.cleanSolution(wks)\nend,\nonCleanProject = function(prj)\nvstudio.cleanProject(prj)\nend,\nonCleanTarget = function(prj)\nvstudio.cleanTarget(prj)\nend,\npathVars        = vstudio.pathVars,\nvstudio = {\nsolutionVersion = \"12\",\nversionName     = \"2013\",\ntargetFramework = \"4.5\",\ntoolsVersion    = \"12.0\",\nfilterToolsVersion = \"4.0\",\nplatformToolset = \"v120\"\n}\n}\n",

	"premake.vstudio.vc2015 = {}\nlocal p = premake\nlocal vstudio = p.vstudio\nlocal vc2010 = vstudio.vc2010\nlocal m = vstudio.vc2015\nnewaction {\ntrigger     = \"vs2015\",\nshortname   = \"Visual Studio 2015\",\ndescription = \"Generate Visual Studio 2015 project files\",\nos = \"windows\",\nvalid_kinds     = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Makefile\", \"None\", \"Utility\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools     = {\ncc     = { \"msc\"   },\ndotnet = { \"msnet\" },\n},\nonWorkspace = function(wks)\nvstudio.vs2005.generateSolution(wks)\nend,\nonProject = function(prj)\nvstudio.vs2010.generateProject(prj)\nend,\nonRule = function(rule)\nvstudio.vs2010.generateRule(rule)\nend,\nonCleanWorkspace = function(wks)\nvstudio.cleanSolution(wks)\nend,\nonCleanProject = function(prj)\nvstudio.cleanProject(prj)\nend,\nonCleanTarget = function(prj)\nvstudio.cleanTarget(prj)\nend,\npathVars        = vstudio.pathVars,\nvstudio = {\nsolutionVersion = \"12\",\nversionName     = \"2015\",\ntargetFramework = \"4.5\",\ntoolsVersion    = \"14.0\",\nfilterToolsVersion = \"4.0\",\nplatformToolset = \"v140\"\n}\n}\n",

	"premake.clean = {}\nnewaction {\ntrigger     = \"clean\",\ndescription = \"Remove all binaries and generated files\",\nexecute = function()\nprint(\"** The clean action has not yet been ported\")\nend\n}\n",

	"local p = premake\nlocal api = p.api\nlocal DOC_URL = \"See https://github.com/premake/premake-core/wiki/\"\napi.register {\nname = \"architecture\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"universal\",\np.X86,\np.X86_64,\n},\naliases = {\ni386  = p.X86,\namd64 = p.X86_64,\nx32   = p.X86,-- these should be DEPRECATED\nx64   = p.X86_64,\n},\n}\napi.register {\nname = \"atl\",\nscope = \"config\",\nkind  = \"string\",\nallowed = {\n\"Off\",\n\"Dynamic\",\n\"Static\",\n},\n}\napi.register {\nname = \"basedir\",\nscope = \"project\",\nkind = \"path\"\n}\napi.register {\nname = \"buildaction\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Application\",\n\"Compile\",\n\"Component\",\n\"Copy\",\n\"Embed\",\n\"Form\",\n\"None\",\n\"Resource\",\n\"UserControl\",\n},\n}\napi.register {\nname = \"buildcommands\",\nscope = { \"config\", \"rule\" },\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"builddependencies\",\nscope = { \"rule\" },\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"buildlog\",\nscope = { \"config\" },\nkind = \"path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"buildmessage\",\nscope = { \"config\", \"rule\" },\nkind = \"string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"buildoptions\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"buildoutputs\",\nscope = { \"config\", \"rule\" },\nkind = \"list:path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"buildinputs\",\nscope = \"config\",\nkind = \"list:path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"buildrule\",     -- DEPRECATED\nscope = \"config\",\nkind = \"table\",\ntokens = true,\n}\napi.register {\nname = \"cleancommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"cleanextensions\",\nscope = \"config\",\nkind = \"list:string\",\n}\napi.register {\nname = \"clr\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Off\",\n\"On\",\n\"Pure\",\n\"Safe\",\n\"Unsafe\",\n}\n}\napi.register {\nname = \"configmap\",\nscope = \"project\",\nkind = \"list:keyed:array:string\",\n}\napi.register {\nname = \"configfile\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"configurations\",\nscope = \"project\",\nkind = \"list:string\",\n}\napi.register {\nname = \"copylocal\",\nscope = \"config\",\nkind = \"list:mixed\",\ntokens = true,\n}\napi.register {\nname = \"debugargs\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"debugcommand\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"debugconnectcommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"debugdir\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"debugenvs\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"debugextendedprotocol\",\nscope = \"config\",\nkind = \"boolean\",\n}\napi.register {\nname = \"debugformat\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"c7\",\n},\n}\napi.register {\nname = \"debugger\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"GDB\",\n\"LLDB\",\n}\n}\napi.register {\nname = \"debuggertype\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Mixed\",\n\"NativeOnly\",\n\"ManagedOnly\",\n}\n}\napi.register {\nname = \"debugpathmap\",\nscope = \"config\",\nkind = \"list:keyed:path\",\ntokens = true,\n}\napi.register {\nname = \"debugport\",\nscope = \"config\",\nkind = \"integer\",\n}\napi.register {\nname = \"debugremotehost\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"debugsearchpaths\",\nscope = \"config\",\nkind = \"list:path\",\ntokens = true,\n}\napi.register {\nn"
	"ame = \"debugstartupcommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"debugtoolargs\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"debugtoolcommand\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"defaultplatform\",\nscope = \"project\",\nkind = \"string\",\n}\napi.register {\nname = \"defines\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"dependson\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"deploymentoptions\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"disablewarnings\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"display\",\nscope = \"rule\",\nkind = \"string\",\n}\napi.register {\nname = \"editandcontinue\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"On\",\n\"Off\",\n},\n}\napi.register {\nname = \"exceptionhandling\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"On\",\n\"Off\",\n\"SEH\"\n},\n}\napi.register {\nname = \"enablewarnings\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"endian\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"Little\",\n\"Big\",\n},\n}\napi.register {\nname = \"entrypoint\",\nscope = \"config\",\nkind = \"string\",\n}\napi.register {\nname = \"fatalwarnings\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"fileextension\",\nscope = \"rule\",\nkind = \"string\",\n}\napi.register {\nname = \"filename\",\nscope = { \"project\", \"rule\" },\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"files\",\nscope = \"config\",\nkind = \"list:file\",\ntokens = true,\n}\napi.register {\nname = \"flags\",\nscope = \"config\",\nkind  = \"list:string\",\nallowed = {\n\"Component\",           -- DEPRECATED\n\"DebugEnvsDontMerge\",\n\"DebugEnvsInherit\",\n\"EnableSSE\",           -- DEPRECATED\n\"EnableSSE2\",          -- DEPRECATED\n\"ExcludeFromBuild\",\n\"ExtraWarnings\",       -- DEPRECATED\n\"FatalCompileWarnings\",\n\"FatalLinkWarnings\",\n\"FloatFast\",           -- DEPRECATED\n\"FloatStrict\",         -- DEPRECATED\n\"LinkTimeOptimization\",\n\"Managed\",             -- DEPRECATED\n\"Maps\",\n\"MFC\",\n\"MultiProcessorCompile\",\n\"NativeWChar\",         -- DEPRECATED\n\"No64BitChecks\",\n\"NoCopyLocal\",\n\"NoEditAndContinue\",   -- DEPRECATED\n\"NoExceptions\",        -- DEPRECATED\n\"NoFramePointer\",\n\"NoImplicitLink\",\n\"NoImportLib\",\n\"NoIncrementalLink\",\n\"NoManifest\",\n\"NoMinimalRebuild\",\n\"NoNativeWChar\",       -- DEPRECATED\n\"NoPCH\",\n\"NoRuntimeChecks\",\n\"NoRTTI\",              -- DEPRECATED\n\"NoBufferSecurityCheck\",\n\"NoWarnings\",          -- DEPRECATED\n\"OmitDefaultLibrary\",\n\"Optimize\",            -- DEPRECATED\n\"OptimizeSize\",        -- DEPRECATED\n\"OptimizeSpeed\",       -- DEPRECATED\n\"RelativeLinks\",\n\"ReleaseRuntime\",      -- DEPRECATED\n\"SEH\",                 -- DEPRECATED\n\"ShadowedVariables\",\n\"StaticRuntime\",\n\"Symbols\",\n\"UndefinedIdentifiers\",\n\"Unicode\",\n\"Unsafe\",              -- DEPRECATED\n\"WinMain\",\n\"WPF\",\n\"C++11\",\n\"C++14\",\n},\naliases = {\nFatalWarnings = { \"FatalWarnings\", \"FatalCompileWarnings\", \"FatalLinkWarnings\" },\nOptimise = 'Optimize',\nOptimiseSize = 'OptimizeSize',\nOptimiseSpeed = 'OptimizeSpeed',\n},\n}\napi.register {\nname = \"floatingpoint\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"Fast\",\n\"Strict\",\n}\n}\napi.register {\nname = \"inlining\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"Disabled\",\n\"Explicit\",\n\"Auto\"\n}\n}\napi.register {\nname = \"callingconvention\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Cdecl\",\n\"FastCall\",\n\"StdCall\",\n\"VectorCall\",\n}\n}\napi."
	"register {\nname = \"forceincludes\",\nscope = \"config\",\nkind = \"list:mixed\",\ntokens = true,\n}\napi.register {\nname = \"forceusings\",\nscope = \"config\",\nkind = \"list:file\",\ntokens = true,\n}\napi.register {\nname = \"fpu\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Software\",\n\"Hardware\",\n}\n}\napi.register {\nname = \"framework\",\nscope = \"config\",\nkind = \"string\",\n}\napi.register {\nname = \"gccprefix\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"ignoredefaultlibraries\",\nscope = \"config\",\nkind = \"list:mixed\",\ntokens = true,\n}\napi.register {\nname = \"icon\",\nscope = \"project\",\nkind = \"file\",\ntokens = true,\n}\napi.register {\nname = \"imageoptions\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"imagepath\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"implibdir\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"implibextension\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"implibname\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"implibprefix\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"implibsuffix\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"includedirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"bindirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"kind\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"ConsoleApp\",\n\"Makefile\",\n\"None\",\n\"SharedLib\",\n\"StaticLib\",\n\"WindowedApp\",\n\"Utility\",\n},\n}\napi.register {\nname = \"language\",\nscope = \"project\",\nkind = \"string\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\",\n},\n}\napi.register {\nname = \"libdirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"linkoptions\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"links\",\nscope = \"config\",\nkind = \"list:mixed\",\ntokens = true,\n}\napi.register {\nname = \"locale\",\nscope = \"config\",\nkind = \"string\",\ntokens = false,\n}\napi.register {\nname = \"location\",\nscope = { \"project\", \"rule\" },\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"makesettings\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"namespace\",\nscope = \"project\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"nativewchar\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"On\",\n\"Off\",\n}\n}\napi.register {\nname = \"objdir\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"optimize\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Off\",\n\"On\",\n\"Debug\",\n\"Size\",\n\"Speed\",\n\"Full\",\n}\n}\napi.register {\nname = \"runtime\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Debug\",\n\"Release\",\n}\n}\napi.register {\nname = \"pchheader\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"pchsource\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"pic\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Off\",\n\"On\",\n}\n}\napi.register {\nname = \"platforms\",\nscope = \"project\",\nkind = \"list:string\",\n}\napi.register {\nname = \"postbuildcommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"postbuildmessage\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"prebuildcommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"prebuildmessage\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\npa"
	"thVars = true,\n}\napi.register {\nname = \"prelinkcommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"prelinkmessage\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"propertydefinition\",\nscope = \"rule\",\nkind = \"list:table\",\n}\napi.register {\nname = \"rebuildcommands\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"resdefines\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"resincludedirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"resoptions\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\napi.register {\nname = \"rtti\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"On\",\n\"Off\",\n},\n}\napi.register {\nname = \"rules\",\nscope = \"project\",\nkind = \"list:string\",\n}\napi.register {\nname = \"startproject\",\nscope = \"workspace\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"strictaliasing\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Off\",\n\"Level1\",\n\"Level2\",\n\"Level3\",\n}\n}\napi.register {\nname = \"sysincludedirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"syslibdirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"system\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"aix\",\n\"bsd\",\n\"haiku\",\n\"linux\",\n\"macosx\",\n\"solaris\",\n\"wii\",\n\"windows\",\n\"xbox360\",\n},\n}\napi.register {\nname = \"targetdir\",\nscope = \"config\",\nkind = \"path\",\ntokens = true,\n}\napi.register {\nname = \"targetextension\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"targetname\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"targetprefix\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"targetsuffix\",\nscope = \"config\",\nkind = \"string\",\ntokens = true,\n}\napi.register {\nname = \"toolset\",\nscope = \"config\",\nkind = \"string\",\nallowed = function(value)\nvalue = value:lower()\nlocal tool, version = p.tools.canonical(value)\nif tool then\nreturn value\nend\nend,\n}\napi.register {\nname = \"customtoolnamespace\",\nscope = \"config\",\nkind = \"string\",\n}\napi.register {\nname = \"undefines\",\nscope = \"config\",\nkind = \"list:string\",\ntokens = true,\n}\n api.register {\nname = \"usingdirs\",\nscope = \"config\",\nkind = \"list:directory\",\ntokens = true,\n}\napi.register {\nname = \"uuid\",\nscope = \"project\",\nkind = \"string\",\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}\napi.register {\nname = \"vectorextensions\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Default\",\n\"AVX\",\n\"AVX2\",\n\"SSE\",\n\"SSE2\",\n\"SSE3\",\n\"SSSE3\",\n\"SSE4.1\",\n}\n}\napi.register {\nname = \"vpaths\",\nscope = \"project\",\nkind = \"list:keyed:list:path\",\ntokens = true,\npathVars = true,\n}\napi.register {\nname = \"warnings\",\nscope = \"config\",\nkind = \"string\",\nallowed = {\n\"Off\",\n\"Default\",\n\"Extra\",\n}\n}\napi.alias(\"buildcommands\", \"buildCommands\")\napi.alias(\"builddependencies\", \"buildDependencies\")\napi.alias(\"buildmessage\", \"buildMessage\")\napi.alias(\"buildoutputs\", \"buildOutputs\")\napi.alias(\"cleanextensions\", \"cleanExtensions\")\napi.alias(\"configfile\", \"configFile\")\napi.alias(\"editandcontinue\", \"ed"
	"itAndContinue\")\napi.alias(\"fileextension\", \"fileExtension\")\napi.alias(\"propertydefinition\", \"propertyDefinition\")\napi.alias(\"removefiles\", \"excludes\")\napi.deprecateField(\"buildrule\", nil,\nfunction(value)\nif value.description then\nbuildmessage(value.description)\nend\nbuildcommands(value.commands)\nbuildoutputs(value.outputs)\nend)\napi.deprecateValue(\"flags\", \"Component\", nil,\nfunction(value)\nbuildaction \"Component\"\nend)\napi.deprecateValue(\"flags\", { \"EnableSSE\", \"EnableSSE2\" }, nil,\nfunction(value)\nvectorextensions(value:sub(7))\nend,\nfunction(value)\nvectorextension \"Default\"\nend)\napi.deprecateValue(\"flags\", { \"FloatFast\", \"FloatStrict\" }, nil,\nfunction(value)\nfloatingpoint(value:sub(6))\nend,\nfunction(value)\nfloatingpoint \"Default\"\nend)\napi.deprecateValue(\"flags\", { \"NativeWChar\", \"NoNativeWChar\" }, nil,\nfunction(value)\nlocal map = { NativeWChar = \"On\", NoNativeWChar = \"Off\" }\nnativewchar(map[value] or \"Default\")\nend,\nfunction(value)\nnativewchar \"Default\"\nend)\napi.deprecateValue(\"flags\", { \"Optimize\", \"OptimizeSize\", \"OptimizeSpeed\" }, nil,\nfunction(value)\nlocal map = { Optimize = \"On\", OptimizeSize = \"Size\", OptimizeSpeed = \"Speed\" }\noptimize (map[value] or \"Off\")\nend,\nfunction(value)\noptimize \"Off\"\nend)\napi.deprecateValue(\"flags\", { \"ReleaseRuntime\" }, nil,\nfunction(value)\nruntime 'Release'\nend,\nfunction(value)\nend)\napi.deprecateValue(\"flags\", { \"Optimise\", \"OptimiseSize\", \"OptimiseSpeed\" }, nil,\nfunction(value)\nlocal map = { Optimise = \"On\", OptimiseSize = \"Size\", OptimiseSpeed = \"Speed\" }\noptimize (map[value] or \"Off\")\nend,\nfunction(value)\noptimize \"Off\"\nend)\napi.deprecateValue(\"flags\", { \"ExtraWarnings\", \"NoWarnings\" }, nil,\nfunction(value)\nlocal map = { ExtraWarnings = \"Extra\", NoWarnings = \"Off\" }\nwarnings (map[value] or \"Default\")\nend,\nfunction(value)\nwarnings \"Default\"\nend)\napi.deprecateValue(\"flags\", \"Managed\", nil,\nfunction(value)\nclr \"On\"\nend,\nfunction(value)\nclr \"Off\"\nend)\napi.deprecateValue(\"flags\", \"NoEditAndContinue\", nil,\nfunction(value)\neditandcontinue \"Off\"\nend,\nfunction(value)\neditandcontinue \"On\"\nend)\napi.deprecateValue(\"flags\", \"NoExceptions\", 'Use `exceptionhandling \"Off\"` instead',\nfunction(value)\nexceptionhandling \"Off\"\nend,\nfunction(value)\nexceptionhandling \"On\"\nend)\napi.deprecateValue(\"flags\", \"NoRTTI\", 'Use `rtti \"Off\"` instead',\nfunction(value)\nrtti \"Off\"\nend,\nfunction(value)\nrtti \"On\"\nend)\napi.deprecateValue(\"flags\", \"SEH\", 'Use `exceptionhandling \"SEH\"` instead',\nfunction(value)\nexceptionhandling \"SEH\"\nend,\nfunction(value)\nexceptionhandling \"Default\"\nend)\napi.deprecateValue(\"flags\", \"Unsafe\", nil,\nfunction(value)\nclr \"Unsafe\"\nend,\nfunction(value)\nclr \"On\"\nend)\nnewoption\n{\ntrigger     = \"cc\",\nvalue       = \"VALUE\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"clang\", \"Clang (clang)\" },\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n}\n}\nnewoption\n{\ntrigger     = \"dotnet\",\nvalue       = \"VALUE\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\",   \"Microsoft .NET (csc)\" },\n{ \"mono\",    \"Novell Mono (mcs)\"    },\n{ \"pnet\",    \"Portable.NET (cscc)\"  },\n}\n}\nnewoption\n{\ntrigger     = \"fatal\",\ndescription = \"Treat warnings from project scripts as errors\"\n}\nnewoption\n{\ntrigger     = \"file\",\nvalue       = \"FILE\",\ndescription = \"Read FILE as a Premake script; default is 'premake5.lua'\"\n}\nnewoption\n{\ntrigger     = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger     = \"verbose\",\ndescription = \"Generate extra debug text output\"\n}\nnewoption\n{\ntrigger = \"interactive\",\ndescription = \"Interactive command prompt\"\n}\nnewoption\n{\ntrigger     = \"os\",\nvalue       = \"VALUE\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"aix\",      \"IBM AIX\" },\n{ \"bsd\",      \"OpenBSD, "
	"NetBSD, or FreeBSD\" },\n{ \"haiku\",    \"Haiku\" },\n{ \"hurd\",     \"GNU/Hurd\" },\n{ \"linux\",    \"Linux\" },\n{ \"macosx\",   \"Apple Mac OS X\" },\n{ \"solaris\",  \"Solaris\" },\n{ \"windows\",  \"Microsoft Windows\" },\n}\n}\nnewoption\n{\ntrigger     = \"scripts\",\nvalue       = \"PATH\",\ndescription = \"Search for additional scripts on the given path\"\n}\nnewoption\n{\ntrigger     = \"systemscript\",\nvalue       = \"FILE\",\ndescription = \"Override default system script (premake5-system.lua)\"\n}\nnewoption\n{\ntrigger     = \"version\",\ndescription = \"Display version information\"\n}\nclr \"Off\"\nexceptionhandling \"Default\"\nrtti \"Default\"\nlanguage \"C++\"\nfilter { \"kind:SharedLib\" }\ntargetprefix \"lib\"\ntargetextension \".so\"\nfilter { \"kind:StaticLib\" }\ntargetprefix \"lib\"\ntargetextension \".a\"\nfilter { \"system:MacOSX\", \"kind:SharedLib\" }\ntargetextension \".dylib\"\nfilter { \"system:Windows or language:C#\", \"kind:ConsoleApp or WindowedApp\" }\ntargetextension \".exe\"\nfilter { \"system:Xbox360\", \"kind:ConsoleApp or WindowedApp\" }\ntargetextension \".exe\"\nfilter { \"system:Windows or Xbox360\", \"kind:SharedLib\" }\ntargetprefix \"\"\ntargetextension \".dll\"\nimplibextension \".lib\"\nfilter { \"system:Windows or Xbox360\", \"kind:StaticLib\" }\ntargetprefix \"\"\ntargetextension \".lib\"\nfilter { \"language:C#\", \"kind:SharedLib\" }\ntargetprefix \"\"\ntargetextension \".dll\"\nimplibextension \".dll\"\nfilter { \"kind:SharedLib\", \"system:not Windows\" }\npic \"On\"\nfilter {}\n",

	"local shorthelp     = \"Type 'premake5 --help' for help\"\nlocal versionhelp   = \"premake5 (Premake Build Script Generator) %s\"\nlocal modules = dofile(\"_modules.lua\")\nlocal manifest = dofile(\"_manifest.lua\")\nfor i = 1, #manifest do\ndofile(manifest[i])\nend\nlocal p = premake\np.main = {}\nlocal m = p.main\nm._preloaded = {}\nfunction m.installModuleLoader()\ntable.insert(package.loaders, 2, m.moduleLoader)\nend\nfunction m.moduleLoader(name)\nlocal dir = path.getdirectory(name)\nlocal base = path.getname(name)\nif dir ~= \".\" then\ndir = dir .. \"/\" .. base\nelse\ndir = base\nend\nlocal full = dir .. \"/\" .. base .. \".lua\"\nlocal paths = {\n\"modules/\" .. full,\nfull,\nname .. \".lua\"\n}\nfor _, p in ipairs(paths) do\nlocal file = os.locate(p)\nif file then\nlocal chunk, err = loadfile(file)\nif chunk then\nreturn chunk\nend\nif err then\nreturn \"\\n\\tload error \" .. err\nend\nend\nend\nfor _, p in ipairs(paths) do\nlocal chunk, err = loadfile(\"$/\" .. p)\nif chunk then\nreturn chunk\nend\nend\nend\nfunction m.prepareEnvironment()\nmath.randomseed(os.time())\n_PREMAKE_DIR = path.getdirectory(_PREMAKE_COMMAND)\npremake.path = premake.path .. \";\" .. _PREMAKE_DIR .. \";\" .. _MAIN_SCRIPT_DIR\nend\nfunction m.preloadModules()\nfor i = 1, #modules do\nlocal name = modules[i]\nlocal preloader = name .. \"/_preload.lua\"\npreloader = os.locate(\"modules/\" .. preloader) or os.locate(preloader)\nif preloader then\nm._preloaded[name] = include(preloader)\nif not m._preloaded[name] then\np.warn(\"module '%s' should return function from _preload.lua\", name)\nend\nelse\nrequire(name)\nend\nend\nend\nfunction m.runSystemScript()\ndofileopt(_OPTIONS[\"systemscript\"] or { \"premake5-system.lua\", \"premake-system.lua\" })\nfilter {}\nend\nfunction m.locateUserScript()\nlocal defaults = { \"premake5.lua\", \"premake4.lua\" }\nfor i = 1, #defaults do\nif os.isfile(defaults[i]) then\n_MAIN_SCRIPT = defaults[i]\nbreak\nend\nend\nif not _MAIN_SCRIPT then\n_MAIN_SCRIPT = defaults[1]\nend\nif _OPTIONS.file then\n_MAIN_SCRIPT = _OPTIONS.file\nend\n_MAIN_SCRIPT = path.getabsolute(_MAIN_SCRIPT)\n_MAIN_SCRIPT_DIR = path.getdirectory(_MAIN_SCRIPT)\nend\nfunction m.prepareAction()\nif _ACTION and _ACTION:endswith(\"ng\") then\npremake.warnOnce(_ACTION, \"'%s' has been deprecated; use '%s' instead\", _ACTION, _ACTION:sub(1, -3))\nend\npremake.action.set(_ACTION)\nend\nfunction m.runUserScript()\nif os.isfile(_MAIN_SCRIPT) then\ndofile(_MAIN_SCRIPT)\nend\nend\nfunction m.checkInteractive()\nif _OPTIONS.interactive then\ndebug.prompt()\nend\nend\nfunction m.processCommandLine()\nif (_OPTIONS[\"version\"]) then\nprintf(versionhelp, _PREMAKE_VERSION)\nos.exit(0)\nend\nif (_OPTIONS[\"help\"]) then\npremake.showhelp()\nos.exit(1)\nend\nok, err = premake.option.validate(_OPTIONS)\nif not ok then\nprint(\"Error: \" .. err)\nos.exit(1)\nend\nif not _OPTIONS.interactive then\nif not _ACTION then\nprint(shorthelp)\nos.exit(1)\nend\nlocal action = premake.action.current()\nif not action then\nprint(\"Error: no such action '\" .. _ACTION .. \"'\")\nos.exit(1)\nend\nif p.action.isConfigurable() and not os.isfile(_MAIN_SCRIPT) then\nprint(string.format(\"No Premake script (%s) found!\", path.getname(_MAIN_SCRIPT)))\nos.exit(1)\nend\nend\nend\nfunction m.preBake()\nif p.action.isConfigurable() then\nprint(\"Building configurations...\")\nend\nend\nfunction m.bake()\nif p.action.isConfigurable() then\npremake.oven.bake()\nend\nend\nfunction m.postBake()\nlocal function shouldLoad(func)\nfor wks in p.global.eachWorkspace() do\nfor prj in p.workspace.eachproject(wks) do\nfor cfg in p.project.eachconfig(prj) do\nif func(cfg) then\nreturn true\nend\nend\nend\nend\nend\nfor module, func in pairs(m._preloaded) do\nif not package.loaded[module] and shouldLoad(func) then\nrequire(module)\nend\nend\nend\nfunction m.validate()\nif p.action.isConfigurable() then\np.container.validate(p.api.rootContainer())\nend\nend\nfunction m.preAction()\nlocal action = premake.action.current()\nprintf(\"Running action '%s'...\", action.trigger)\nend\nfunction m.callA"
	"ction()\nlocal action = premake.action.current()\npremake.action.call(action.trigger)\nend\nfunction m.postAction()\nif p.action.isConfigurable() then\nprint(\"Done.\")\nend\nend\nm.elements = {\nm.installModuleLoader,\nm.locateUserScript,\nm.prepareEnvironment,\nm.preloadModules,\nm.runSystemScript,\nm.prepareAction,\nm.runUserScript,\nm.checkInteractive,\nm.processCommandLine,\nm.preBake,\nm.bake,\nm.postBake,\nm.validate,\nm.preAction,\nm.callAction,\nm.postAction,\n}\nfunction _premake_main()\np.callArray(m.elements)\nreturn 0\nend\n",

	"return\n{\n\"base/_foundation.lua\",\n\"base/string.lua\",\n\"base/table.lua\",\n\"base/path.lua\",\n\"base/os.lua\",\n\"base/io.lua\",\n\"base/tools.lua\",\n\"base/tree.lua\",\n\"base/globals.lua\",\n\"base/field.lua\",\n\"base/criteria.lua\",\n\"base/detoken.lua\",\n\"base/configset.lua\",\n\"base/context.lua\",\n\"base/container.lua\",\n\"base/option.lua\",\n\"base/action.lua\",\n\"base/api.lua\",\n\"base/global.lua\",\n\"base/workspace.lua\",\n\"base/group.lua\",\n\"base/project.lua\",\n\"base/config.lua\",\n\"base/fileconfig.lua\",\n\"base/rule.lua\",\n\"base/oven.lua\",\n\"base/validation.lua\",\n\"base/premake.lua\",\n\"base/help.lua\",\n\"tools/dotnet.lua\",\n\"tools/gcc.lua\",\n\"tools/msc.lua\",\n\"tools/snc.lua\",\n\"tools/clang.lua\",\n\"actions/make/_make.lua\",\n\"actions/make/make_workspace.lua\",\n\"actions/make/make_cpp.lua\",\n\"actions/make/make_csharp.lua\",\n\"actions/vstudio/_vstudio.lua\",\n\"actions/vstudio/vs2005.lua\",\n\"actions/vstudio/vs2008.lua\",\n\"actions/vstudio/vs200x_vcproj.lua\",\n\"actions/vstudio/vs200x_vcproj_user.lua\",\n\"actions/vstudio/vs2005_solution.lua\",\n\"actions/vstudio/vs2005_csproj.lua\",\n\"actions/vstudio/vs2005_csproj_user.lua\",\n\"actions/vstudio/vs2010.lua\",\n\"actions/vstudio/vs2010_vcxproj.lua\",\n\"actions/vstudio/vs2010_vcxproj_user.lua\",\n\"actions/vstudio/vs2010_vcxproj_filters.lua\",\n\"actions/vstudio/vs2010_rules_props.lua\",\n\"actions/vstudio/vs2010_rules_targets.lua\",\n\"actions/vstudio/vs2010_rules_xml.lua\",\n\"actions/vstudio/vs2012.lua\",\n\"actions/vstudio/vs2013.lua\",\n\"actions/vstudio/vs2015.lua\",\n\"actions/clean/_clean.lua\",\n\"_premake_init.lua\",\n}\n",

	"return {\"xcode\",\n\"monodevelop\",\n\"codelite\",\n\"d\"}",

	NULL
};
