This commit is contained in:
liamDevine 2010-11-01 22:02:08 +00:00
commit ac8d017332
4 changed files with 350 additions and 41 deletions

View File

@ -1,3 +1,10 @@
-------
4.4 (in progress)
-------
* Patch 2963313: Enable setting .NET framework version (Justen Hyde)
-------
4.3 (in progress)
-------
@ -119,7 +126,6 @@
- Bug 2790865: SharedLib on OSX fixes (Ash Berlin)
- Bug 2790882: Trailing slash in path.getabsolute (Ash Berlin)
RC2 -> RC3
- Bug 2805763: GCC PCH breaks on path

View File

@ -52,6 +52,7 @@
{
kind = "list",
scope = "config",
usagecopy = true,
},
excludes =
@ -71,6 +72,7 @@
kind = "list",
scope = "config",
isflags = true,
usagecopy = true,
allowed = {
"EnableSSE",
"EnableSSE2",
@ -100,7 +102,7 @@
"Unicode",
"Unsafe",
"WinMain"
}
},
},
framework =
@ -163,6 +165,7 @@
{
kind = "dirlist",
scope = "config",
usagecopy = true,
},
kind =
@ -192,6 +195,7 @@
{
kind = "dirlist",
scope = "config",
linkagecopy = true,
},
linkoptions =
@ -210,8 +214,8 @@
value = path.getabsolute(value)
end
return value
end
end,
linkagecopy = true,
},
location =
@ -338,6 +342,12 @@
return value:upper()
end
},
uses =
{
kind = "list",
scope = "config",
},
}
@ -599,10 +609,53 @@
return cfg
end
local function createproject(name, sln, isUsage)
local prj = {}
function project(name)
if not name then
return iif(type(premake.CurrentContainer) == "project", premake.CurrentContainer, nil)
-- attach a type
setmetatable(prj, {
__type = "project",
})
-- add to master list keyed by both name and index
table.insert(sln.projects, prj)
if(isUsage) then
--If we're creating a new usage project, and there's already a project
--with our name, then set us as the usage project for that project.
--Otherwise, set us as the project in that slot.
if(sln.projects[name]) then
sln.projects[name].usageProj = prj;
else
sln.projects[name] = prj
end
else
--If we're creating a regular project, and there's already a project
--with our name, then it must be a usage project. Set it as our usage project
--and set us as the project in that slot.
if(sln.projects[name]) then
prj.usageProj = sln.projects[name];
end
sln.projects[name] = prj
end
prj.solution = sln
prj.name = name
prj.basedir = os.getcwd()
prj.location = prj.basedir
prj.uuid = os.uuid()
prj.blocks = { }
prj.usage = isUsage;
return prj;
end
function usage(name)
if (not name) then
--Only return usage projects.
if(type(premake.CurrentContainer) ~= "project") then return nil end
if(not premake.CurrentContainer.usage) then return nil end
return premake.CurrentContainer
end
-- identify the parent solution
@ -616,26 +669,45 @@
error("no active solution", 2)
end
-- if this is a new project, create it
premake.CurrentContainer = sln.projects[name]
if (not premake.CurrentContainer) then
local prj = { }
premake.CurrentContainer = prj
-- if this is a new project, or the project in that slot doesn't have a usage, create it
if((not sln.projects[name]) or
((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then
premake.CurrentContainer = createproject(name, sln, true)
else
premake.CurrentContainer = iff(sln.projects[name].usage,
sln.projects[name], sln.projects[name].usageProj)
end
-- add to master list keyed by both name and index
table.insert(sln.projects, prj)
sln.projects[name] = prj
-- add an empty, global configuration to the project
configuration { }
-- attach a type
setmetatable(prj, {
__type = "project",
})
return premake.CurrentContainer
end
prj.solution = sln
prj.name = name
prj.basedir = os.getcwd()
prj.uuid = os.uuid()
prj.blocks = { }
function project(name)
if (not name) then
--Only return non-usage projects
if(type(premake.CurrentContainer) ~= "project") then return nil end
if(premake.CurrentContainer.usage) then return nil end
return premake.CurrentContainer
end
-- identify the parent solution
local sln
if (type(premake.CurrentContainer) == "project") then
sln = premake.CurrentContainer.solution
else
sln = premake.CurrentContainer
end
if (type(sln) ~= "solution") then
error("no active solution", 2)
end
-- if this is a new project, or the old project is a usage project, create it
if((not sln.projects[name]) or sln.projects[name].usage) then
premake.CurrentContainer = createproject(name, sln)
else
premake.CurrentContainer = sln.projects[name];
end
-- add an empty, global configuration to the project

View File

@ -453,7 +453,192 @@
end
end
local function getCfgKind(cfg)
if(cfg.kind) then
return cfg.kind;
end
if(cfg.project.__configs[""] and cfg.project.__configs[""].kind) then
return cfg.project.__configs[""].kind;
end
return nil
end
local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)
if(not cfg) then return end
local foundUsePrjs = {};
for _, useName in ipairs(cfg[searchField]) do
local testName = useName:lower();
if((not foundList[testName])) then
local theProj = nil;
local theUseProj = nil;
for _, prj in ipairs(cfg.project.solution.projects) do
if (prj.name:lower() == testName) then
if(prj.usage) then
theUseProj = prj;
else
theProj = prj;
end
end
end
--Must connect to a usage project.
if(theUseProj) then
foundList[testName] = true;
local prjEntry = {
name = testName,
proj = theProj,
usageProj = theUseProj,
bLinkageOnly = bLinkage,
};
dstArray[testName] = prjEntry;
table.insert(foundUsePrjs, theUseProj);
end
end
end
for _, usePrj in ipairs(foundUsePrjs) do
--Links can only recurse through static libraries.
if((searchField ~= "links") or
(getCfgKind(usePrj.__configs[cfgname]) == "StaticLib")) then
getprojrec(dstArray, foundList, usePrj.__configs[cfgname],
cfgname, searchField, bLinkage);
end
end
end
--
-- This function will recursively get all projects that the given configuration has in its "uses"
-- field. The return values are a list of tables. Each table in that list contains the following:
-- name = The lowercase name of the project.
-- proj = The project. Can be nil if it is usage-only.
-- usageProj = The usage project. Can't be nil, as using a project that has no
-- usage project is not put into the list.
-- bLinkageOnly = If this is true, then only the linkage information should be copied.
-- The recursion will only look at the "uses" field on *usage* projects.
-- This function will also add projects to the list that are mentioned in the "links"
-- field of usage projects. These will only copy linker information, but they will recurse.
-- through other "links" fields.
--
local function getprojectsconnections(cfg, cfgname)
local dstArray = {};
local foundList = {};
foundList[cfg.project.name:lower()] = true;
--First, follow the uses recursively.
getprojrec(dstArray, foundList, cfg, cfgname, "uses", false);
--Next, go through all of the usage projects and recursively get their links.
--But only if they're not already there. Get the links as linkage-only.
local linkArray = {};
for prjName, prjEntry in pairs(dstArray) do
getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname,
"links", true);
end
--Copy from linkArray into dstArray.
for prjName, prjEntry in pairs(linkArray) do
dstArray[prjName] = prjEntry;
end
return dstArray;
end
local function isnameofproj(cfg, strName)
local sln = cfg.project.solution;
local strTest = strName:lower();
for prjIx, prj in ipairs(sln.projects) do
if (prj.name:lower() == strTest) then
return true;
end
end
return false;
end
--
-- Copies the field from dstCfg to srcCfg.
--
local function copydependentfield(srcCfg, dstCfg, strSrcField)
local srcField = premake.fields[strSrcField];
local strDstField = strSrcField;
if type(srcCfg[strSrcField]) == "table" then
--handle paths.
if (srcField.kind == "dirlist" or srcField.kind == "filelist") and
(not nofixup[strSrcField]) then
for i,p in ipairs(srcCfg[strSrcField]) do
table.insert(dstCfg[strDstField],
path.rebase(p, srcCfg.project.location, dstCfg.project.location))
end
else
if(strSrcField == "links") then
for i,p in ipairs(srcCfg[strSrcField]) do
if(not isnameofproj(dstCfg, p)) then
table.insert(dstCfg[strDstField], p)
else
printf("Failed to copy '%s' from proj '%s'.",
p, srcCfg.project.name);
end
end
else
for i,p in ipairs(srcCfg[strSrcField]) do
table.insert(dstCfg[strDstField], p)
end
end
end
else
if(srcField.kind == "path" and (not nofixup[strSrcField])) then
dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],
prj.location, dstCfg.project.location);
else
dstCfg[strDstField] = srcCfg[strSrcField];
end
end
end
--
-- This function will take the list of project entries and apply their usage project data
-- to the given configuration. It will copy compiling information for the projects that are
-- not listed as linkage-only. It will copy the linking information for projects only if
-- the source project is not a static library. It won't copy linking information
-- if the project is in this solution; instead it will add that project to the configuration's
-- links field, expecting that Premake will handle the rest.
--
local function copyusagedata(cfg, cfgname, linkToProjs)
local myPrj = cfg.project;
local bIsStaticLib = (getCfgKind(cfg) == "StaticLib");
for prjName, prjEntry in pairs(linkToProjs) do
local srcPrj = prjEntry.usageProj;
local srcCfg = srcPrj.__configs[cfgname];
for name, field in pairs(premake.fields) do
if(srcCfg[name]) then
if(field.usagecopy) then
if(not prjEntry.bLinkageOnly) then
copydependentfield(srcCfg, cfg, name)
end
elseif(field.linkagecopy) then
--Copy the linkage data if we're building a non-static thing
--and this is a pure usage project. If it's not pure-usage, then
--we will simply put the project's name in the links field later.
if((not bIsStaticLib) and (not prjEntry.proj)) then
copydependentfield(srcCfg, cfg, name)
end
end
end
end
if((not bIsStaticLib) and prjEntry.proj) then
printf("Adding direct link to project '%s' from project '%s'",
prjEntry.proj.name, getCfgKind(cfg));
table.insert(cfg.links, prjEntry.proj.name);
end
end
end
--
-- Takes the configuration information stored in solution->project->block
@ -488,6 +673,44 @@
end
end
--This loop finds the projects that a configuration is connected to
--via its "uses" field. It will then copy any usage project information from that
--usage project to the configuration in question.
for sln in premake.solution.each() do
for prjIx, prj in ipairs(sln.projects) do
if(not prj.usage) then
for cfgname, cfg in pairs(prj.__configs) do
printf("prj '%s', cfg '%s'", prj.name, cfgname);
printf("before:");
for _, linkName in ipairs(cfg.links) do
printf("\t link to '%s'.", linkName)
end
local usesPrjs = getprojectsconnections(cfg, cfgname);
copyusagedata(cfg, cfgname, usesPrjs)
printf("after:");
for _, linkName in ipairs(cfg.links) do
printf("link to '%s'", linkName)
end
end
end
end
end
-- Remove all usage projects.
for sln in premake.solution.each() do
local removeList = {};
for index, prj in ipairs(sln.projects) do
if(prj.usage) then
table.insert(removeList, 1, index); --Add in reverse order.
end
end
for _, index in ipairs(removeList) do
table.remove(sln.projects, index);
end
end
-- assign unique object directories to each configuration
builduniquedirs()

View File

@ -60,20 +60,28 @@ const char* builtin_scripts[] = {
"e\ndest[field] = value\nend\nend\nend\nend\nlocal function merge(dest, obj, basis, terms, cfgname, pltname)\nlocal key = cfgname or \"\"\npltname = pltname or \"Native\"\nif pltname ~= \"Native\" then\nkey = key .. pltname\nend\nterms.config = (cfgname or \"\"):lower()\nterms.platform = pltname:lower()\nlocal cfg = {}\nmergeobject(cfg, basis[key])\nadjustpaths(obj.location, cfg)\nmergeobject(cfg, obj)\nfor _, blk in ipairs(obj.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, terms)) then\nmergeobject(cfg, blk)\nend\nend\ncfg.name = cfgname\ncfg.platform = pltname\ncfg.terms = terms\ndest[key] = cfg\nend\nlocal function collapse(obj, basis)\nlocal result = {}\nbasis = basis or {}\nlocal sln = obj.solution or obj\nlocal terms = premake.getactiveterms()\nmerge(result, obj, basis, terms)\nif result[\"\"].kind then\nterms.kind = result[\"\"].kind:lower()\nend\nfor _, cfgname in ipairs(sln.configurations) do\nmerge(result, obj, basis, terms, cfgname, \"Native\")\nfor _, pltname in ipairs(sln.platforms"
" or {}) do\nif pltname ~= \"Native\" then\nmerge(result, obj, basis, terms, cfgname, pltname)\nend\nend\nend\nreturn result\nend\nlocal function postprocess(prj, cfg)\ncfg.project = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nlocal platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nelse\ncfg.system = os.get()\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\n"
"end\nend\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\nlocal function builduniquedirs()\nlocal num_variations = 4\nlocal cfg_dirs = {}\nlocal hit_counts = {}\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dirs = { }\ndirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \"obj\"))\ndirs[2] = path.join(dirs[1], iif(cfg.platform == \"Native\", \"\", cfg.platform))\ndirs[3] = path.join(dirs[2], cfg.name)\ndirs[4] = path.join(dirs[3], cfg.project.name)\ncfg_dirs[cfg] = dirs\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, num_variations do\nlocal d = dirs[v]\nhit_counts[d] = (hit_counts[d] or 0) + 1"
"\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\nfunction premake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.loc"
"ation or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor sln in premake.solution.each() do\nlocal basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\npostprocess(prj, cfg)\nend\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\n",
"\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\n local function getCfgKind(cfg)\n if(cfg.kind) then\n return cfg.kind;\n end\n \n if(cfg.project.__configs[\"\"] and cfg.projec"
"t.__configs[\"\"].kind) then\n return cfg.project.__configs[\"\"].kind;\n end\n \n return nil\n end\n \n local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)\n if(not cfg) then return end\n \n local foundUsePrjs = {};\n for _, useName in ipairs(cfg[searchField]) do\n local testName = useName:lower();\n if((not foundList[testName])) then\n local theProj = nil;\n local theUseProj = nil;\n for _, prj in ipairs(cfg.project.solution.projects) do\n if (prj.name:lower() == testName) then\n if(prj.usage) then\n theUseProj = prj;\n else\n theProj = prj;\n end\n end\n end\n \n --Must connect to a usage project.\n if(theUseProj) then\n foundList[testName] = true;\n local prjEntry = {\n name = testName,\n proj = theProj,\n usageProj = theUseProj,\n bLinkageOnly = bLinkage,\n };\n dstArray[testName] = prjEntry;\n table.insert(foundUsePrjs, theUseProj);\n end\n end\n end\n \n for _, usePrj in ipairs(foundUsePrjs) do\n --Links can only recurse through s"
"tatic libraries.\n if((searchField ~= \"links\") or\n (getCfgKind(usePrj.__configs[cfgname]) == \"StaticLib\")) then\n getprojrec(dstArray, foundList, usePrj.__configs[cfgname],\n cfgname, searchField, bLinkage);\n end\n end\n end\n \n --\n -- This function will recursively get all projects that the given configuration has in its \"uses\"\n -- field. The return values are a list of tables. Each table in that list contains the following:\n --name = The lowercase name of the project.\n --proj = The project. Can be nil if it is usage-only.\n --usageProj = The usage project. Can't be nil, as using a project that has no\n -- usage project is not put into the list.\n --bLinkageOnly = If this is true, then only the linkage information should be copied.\n -- The recursion will only look at the \"uses\" field on *usage* projects.\n -- This function will also add projects to the list that are mentioned in the \"links\"\n -- field of usage projects. These will only copy linker information, but they wil"
"l recurse.\n -- through other \"links\" fields.\n --\n local function getprojectsconnections(cfg, cfgname)\n local dstArray = {};\n local foundList = {};\n foundList[cfg.project.name:lower()] = true;\n \n --First, follow the uses recursively.\n getprojrec(dstArray, foundList, cfg, cfgname, \"uses\", false);\n \n --Next, go through all of the usage projects and recursively get their links.\n --But only if they're not already there. Get the links as linkage-only.\n local linkArray = {};\n for prjName, prjEntry in pairs(dstArray) do\n getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n \"links\", true);\n end\n \n --Copy from linkArray into dstArray.\n for prjName, prjEntry in pairs(linkArray) do\n dstArray[prjName] = prjEntry;\n end\n \n return dstArray;\n end\n \n \n local function isnameofproj(cfg, strName)\n local sln = cfg.project.solution;\n local strTest = strName:lower();\n for prjIx, prj in ipairs(sln.projects) do\n if (prj.name:lower() == s"
"trTest) then\n return true;\n end\n end\n \n return false;\n end\n --\n -- Copies the field from dstCfg to srcCfg.\n --\n local function copydependentfield(srcCfg, dstCfg, strSrcField)\n local srcField = premake.fields[strSrcField];\n local strDstField = strSrcField;\n \n if type(srcCfg[strSrcField]) == \"table\" then\n --handle paths.\n if (srcField.kind == \"dirlist\" or srcField.kind == \"filelist\") and\n (not nofixup[strSrcField]) then\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField],\n path.rebase(p, srcCfg.project.location, dstCfg.project.location))\n end\n else\n if(strSrcField == \"links\") then\n for i,p in ipairs(srcCfg[strSrcField]) do\n if(not isnameofproj(dstCfg, p)) then\n table.insert(dstCfg[strDstField], p)\n else\n printf(\"Failed to copy '%s' from proj '%s'.\",\n p, srcCfg.project.name);\n end\n end\n else\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField], p)\n end\n end\n end\n else\n if(srcFie"
"ld.kind == \"path\" and (not nofixup[strSrcField])) then\n dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],\n prj.location, dstCfg.project.location);\n else\n dstCfg[strDstField] = srcCfg[strSrcField];\n end\n end\n end\n \n --\n -- This function will take the list of project entries and apply their usage project data\n -- to the given configuration. It will copy compiling information for the projects that are\n -- not listed as linkage-only. It will copy the linking information for projects only if\n -- the source project is not a static library. It won't copy linking information\n -- if the project is in this solution; instead it will add that project to the configuration's\n -- links field, expecting that Premake will handle the rest.\n --\n local function copyusagedata(cfg, cfgname, linkToProjs)\n local myPrj = cfg.project;\n local bIsStaticLib = (getCfgKind(cfg) == \"StaticLib\");\n \n for prjName, prjEntry in pairs(linkToProjs) do\n local srcPrj = prjEntry.usageProj;\n local "
"srcCfg = srcPrj.__configs[cfgname];\n \n for name, field in pairs(premake.fields) do\n if(srcCfg[name]) then\n if(field.usagecopy) then\n if(not prjEntry.bLinkageOnly) then\n copydependentfield(srcCfg, cfg, name)\n end\n elseif(field.linkagecopy) then\n --Copy the linkage data if we're building a non-static thing\n --and this is a pure usage project. If it's not pure-usage, then\n --we will simply put the project's name in the links field later.\n if((not bIsStaticLib) and (not prjEntry.proj)) then\n copydependentfield(srcCfg, cfg, name)\n end\n end\n end\n end\n \n if((not bIsStaticLib) and prjEntry.proj) then\n printf(\"Adding direct link to project '%s' from project '%s'\",\n prjEntry.proj.name, getCfgKind(cfg));\n table.insert(cfg.links, prjEntry.proj.name);\n end\n end\n end\nfunction premake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _"
", blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor sln in premake.solution.each() do\nlocal basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\npostprocess(prj, cfg)\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nif(not prj.usage) then\nfor cfgname, cfg in pairs(prj.__configs) do\nprintf(\"prj '%s', cfg '%s'\", prj.name, cfgname);\nprintf(\"before:\");\nfor _, linkName in ipairs(cfg.links) do\nprintf(\"\\t link to '%s'.\", linkName)\nend\nlocal usesPrjs = getprojectsconnections(cfg, cfgname);\ncopyusagedata(cfg, cfgname, usesPrjs)\nprintf(\"after:\");\nfor _, linkName in ipairs(cfg.links) do\nprintf(\"link to '%s'\", linkName)\nend\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nlocal removeList = {};\nfor index, prj in ipairs(sln.projects) do\nif(prj.usage) then\ntable.insert(removeList,"
" 1, index); --Add in reverse order.\nend\nend\nfor _, index in ipairs(removeList) do\ntable.remove(sln.projects, index);\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\n",
/* base/api.lua */
"premake.fields = \n{\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nconfigurations = \n{\nkind = \"list\",\nscope = \"solution\",\n},\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndeploymentoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"config\",\nisflags = true,\nallowed = {\n\"EnableSSE\",\n\"EnableSSE2\",\n\"ExtraWarnings\",\n\"FatalWarnings\",\n\"FloatFast\",\n\"FloatStrict\",\n\"Managed\",\n\"MFC\",\n\"NativeWChar\",\n\"No64BitChecks\",\n\"NoEditAndContinue\",\n\"NoExceptions\",\n\"NoFramePointer\",\n\"NoImportLib\",\n\"NoManifest\",\n\"NoMinimalRebuild\",\n\"NoNativeWChar\",\n\"NoPCH\",\n\"NoRTTI\",\n\"Optimize\",\n\""
"OptimizeSize\",\n\"OptimizeSpeed\",\n\"SEH\",\n\"StaticRuntime\",\n\"Symbols\",\n\"Unicode\",\n\"Unsafe\",\n\"WinMain\"\n}\n},\nframework =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\"\n}\n},\nimagepath = \n{\nkind = \"path\",\nscope = \"config\",\n},\nimageoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibd"
"irs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend\n},\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\nplatforms = \n{\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nresoptions =\n{\nkind = \"list\",\nscope = \"config\""
",\n},\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == "
"\"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (not conta"
"iner[fieldname]) then\ncontainer[fieldname] = { }\nend\nlocal function doinsert(value, depth)\nif (type(value) == \"table\") then\nfor _,v in ipairs(value) do\ndoinsert(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, depth)\nend\ntable.insert(container[fieldname], value)\nend\nend\nif (value) then\ndoinsert(value, 5)\nend\nreturn container[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value), depth + 1)\nelse\ntable.insert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: expected string, got \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, "
"fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then \nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif ((kind == \"string\" or kind == \"path\") and value) then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nif (kind == \"string\") then\nreturn premake.setstring(scope, name, value, allowed)\nelseif (kind == \"path\") then\nif value then value = path.getabsolute(value) end"
"\nreturn premake.setstring(scope, name, value)\nelseif (kind == \"list\") then\nreturn premake.setarray(scope, name, value, allowed)\nelseif (kind == \"dirlist\") then\nreturn premake.setdirarray(scope, name, value)\nelseif (kind == \"filelist\") then\nreturn premake.setfilearray(scope, name, value)\nend\nend\nfor name,_ in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nfunction proj"
"ect(name)\nif not name then\nreturn iif(type(premake.CurrentContainer) == \"project\", premake.CurrentContainer, nil)\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\npremake.CurrentContainer = sln.projects[name]\nif (not premake.CurrentContainer) then\nlocal prj = { }\npremake.CurrentContainer = prj\ntable.insert(sln.projects, prj)\nsln.projects[name] = prj\nsetmetatable(prj, {\n__type = \"project\",\n})\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.uuid = os.uuid()\nprj.blocks = { }\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake"
".solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n",
"premake.fields = \n{\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nconfigurations = \n{\nkind = \"list\",\nscope = \"solution\",\n},\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndeploymentoptions =\n{\nkind = \"list\",\nscope = \"config\",\nusagecopy = true,\n},\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"config\",\nisflags = true,\nusagecopy = true,\nallowed = {\n\"EnableSSE\",\n\"EnableSSE2\",\n\"ExtraWarnings\",\n\"FatalWarnings\",\n\"FloatFast\",\n\"FloatStrict\",\n\"Managed\",\n\"MFC\",\n\"NativeWChar\",\n\"No64BitChecks\",\n\"NoEditAndContinue\",\n\"NoExceptions\",\n\"NoFramePointer\",\n\"NoImportLib\",\n\"NoManifest\",\n\"NoMinimalRebuild\",\n\"NoNativeWChar\",\n\"No"
"PCH\",\n\"NoRTTI\",\n\"Optimize\",\n\"OptimizeSize\",\n\"OptimizeSpeed\",\n\"SEH\",\n\"StaticRuntime\",\n\"Symbols\",\n\"Unicode\",\n\"Unsafe\",\n\"WinMain\"\n},\n},\nframework =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\"\n}\n},\nimagepath = \n{\nkind = \"path\",\nscope = \"config\",\n},\nimageoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n},\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind = \"string\",\nscope = \"contai"
"ner\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\nlinkagecopy = true,\n},\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend,\nlinkagecopy = true,\n},\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\nplatforms = \n{\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\n"
"kind = \"dirlist\",\nscope = \"config\",\n},\nresoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper"
"()\nend\n},\nuses =\n{\nkind = \"list\",\nscope = \"config\",\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction pre"
"make.setarray(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (not container[fieldname]) then\ncontainer[fieldname] = { }\nend\nlocal function doinsert(value, depth)\nif (type(value) == \"table\") then\nfor _,v in ipairs(value) do\ndoinsert(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, depth)\nend\ntable.insert(container[fieldname], value)\nend\nend\nif (value) then\ndoinsert(value, 5)\nend\nreturn container[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value), depth + 1)\nelse\ntable.insert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: expected string, g"
"ot \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then \nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif ((kind == \"string\" or kind == \"path\") and value) then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nif (kind =="
" \"string\") then\nreturn premake.setstring(scope, name, value, allowed)\nelseif (kind == \"path\") then\nif value then value = path.getabsolute(value) end\nreturn premake.setstring(scope, name, value)\nelseif (kind == \"list\") then\nreturn premake.setarray(scope, name, value, allowed)\nelseif (kind == \"dirlist\") then\nreturn premake.setdirarray(scope, name, value)\nelseif (kind == \"filelist\") then\nreturn premake.setfilearray(scope, name, value)\nend\nend\nfor name,_ in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, "
"field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nlocal function createproject(name, sln, isUsage)\nlocal prj = {}\nsetmetatable(prj, {\n__type = \"project\",\n})\ntable.insert(sln.projects, prj)\nif(isUsage) then\nif(sln.projects[name]) then\nsln.projects[name].usageProj = prj;\nelse\nsln.projects[name] = prj\nend\nelse\nif(sln.projects[name]) then\nprj.usageProj = sln.projects[name];\nend\nsln.projects[name] = prj\nend\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.location = prj.basedir\nprj.uuid = os.uuid()\nprj.blocks = { }\nprj.usage = isUsage;\nreturn prj;\nend\nfunction usage(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") then return nil end\nif(not premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = p"
"remake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\n -- if this is a new project, or the project in that slot doesn't have a usage, create it\n if((not sln.projects[name]) or\n ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\n premake.CurrentContainer = createproject(name, sln, true)\n else\n premake.CurrentContainer = iff(sln.projects[name].usage,\n sln.projects[name], sln.projects[name].usageProj)\n end\n \n -- add an empty, global configuration to the project\n configuration { }\n \n return premake.CurrentContainer\n end\n \n function project(name)\n if (not name) then\n --Only return non-usage projects\n if(type(premake.CurrentContainer) ~= \"project\") then return nil end\n if(premake.CurrentContainer.usage) then return nil end\n return premake.CurrentContainer\nend\n -- identify the parent solution\n local sln\n if (type(premake.CurrentContainer) == \""
"project\") then\n sln = premake.CurrentContainer.solution\n else\n sln = premake.CurrentContainer\n end\n if (type(sln) ~= \"solution\") then\n error(\"no active solution\", 2)\n end\n \n -- if this is a new project, or the old project is a usage project, create it\n if((not sln.projects[name]) or sln.projects[name].usage) then\n premake.CurrentContainer = createproject(name, sln)\n else\n premake.CurrentContainer = sln.projects[name];\n end\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake.solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n",
/* base/cmdline.lua */
"newoption \n{\ntrigger = \"cc\",\nvalue = \"VALUE\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n{ \"ow\", \"OpenWatcom\" },\n}\n}\nnewoption\n{\ntrigger = \"dotnet\",\nvalue = \"VALUE\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\", \"Microsoft .NET (csc)\" },\n{ \"mono\", \"Novell Mono (mcs)\" },\n{ \"pnet\", \"Portable.NET (cscc)\" },\n}\n}\nnewoption\n{\ntrigger = \"file\",\nvalue = \"FILE\",\ndescription = \"Read FILE as a Premake script; default is 'premake4.lua'\"\n}\nnewoption\n{\ntrigger = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger = \"os\",\nvalue = \"VALUE\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"bsd\", \"OpenBSD, NetBSD, or FreeBSD\" },\n{ \"linux\", \"Linux\" },\n{ \"macosx\", \"Apple Mac OS X\" },\n{ \"solaris\", \"Solaris\" },\n{ \"windows\", \"Microsoft W"