Merged premake/premake-dev into default

This commit is contained in:
neoaggelos 2013-09-15 11:36:41 +03:00
commit b98af00c11
116 changed files with 422 additions and 1037 deletions

View File

@ -22,8 +22,6 @@
"base/criteria.lua",
"base/option.lua",
"base/tree.lua",
"base/project.lua",
"base/config.lua",
"base/help.lua",
-- configuration APIs

View File

@ -7,7 +7,7 @@
premake.make = {}
local make = premake.make
local solution = premake.solution
local project = premake5.project
local project = premake.project
---
@ -19,9 +19,6 @@
shortname = "GNU Make",
description = "Generate GNU makefiles for POSIX, MinGW, and Cygwin",
-- temporary, until I can phase out the legacy implementations
isnextgen = true,
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
valid_languages = { "C", "C++", "C#" },

View File

@ -7,9 +7,9 @@
premake.make.cpp = {}
local make = premake.make
local cpp = premake.make.cpp
local project = premake5.project
local config = premake5.config
local fileconfig = premake5.fileconfig
local project = premake.project
local config = premake.config
local fileconfig = premake.fileconfig
---

View File

@ -7,9 +7,9 @@
premake.make.cs = {}
local make = premake.make
local cs = premake.make.cs
local project = premake5.project
local config = premake5.config
local fileconfig = premake5.fileconfig
local project = premake.project
local config = premake.config
local fileconfig = premake.fileconfig
--

View File

@ -6,7 +6,7 @@
local make = premake.make
local solution = premake.solution
local project = premake5.project
local project = premake.project
--
@ -38,7 +38,7 @@
function make.configmap(sln)
for cfg in solution.eachconfig(sln) do
_p('ifeq ($(config),%s)', cfg.shortname)
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
local prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)
if prjcfg then
_p(' %s_config = %s', make.tovar(prj.name), prjcfg.shortname)
@ -56,7 +56,7 @@
function make.cleanrules(sln)
_p('clean:')
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
local slnpath = solution.getlocation(sln)
local prjpath = project.getfilename(prj, make.getmakefilename(prj, true))
local prjdir = path.getdirectory(path.getrelative(slnpath, prjpath))
@ -87,7 +87,7 @@
_p(1,'@echo " all (default)"')
_p(1,'@echo " clean"')
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
_p(1,'@echo " %s"', prj.name)
end
@ -111,7 +111,7 @@
--
function make.projectrules(sln)
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
local deps = project.getdependencies(prj)
deps = table.extract(deps, "name")
_p('%s: %s', premake.esc(prj.name), table.concat(deps, " "))

View File

@ -7,8 +7,8 @@
premake.vstudio = {}
local vstudio = premake.vstudio
local solution = premake.solution
local project = premake5.project
local config = premake5.config
local project = premake.project
local config = premake.config
--
@ -90,11 +90,11 @@
-- Return true if the configuration kind is one of "Makefile" or "None". The
-- latter is generated like a Makefile project and excluded from the solution.
--
function vstudio.isMakefile(cfg)
return (cfg.kind == premake.MAKEFILE or cfg.kind == premake.NONE)
end
--
-- If a dependency of a project configuration is excluded from that particular
@ -215,7 +215,7 @@
local hascpp = false
local hasnet = false
local slnarch
for prj in solution.eachproject_ng(cfg.solution) do
for prj in solution.eachproject(cfg.solution) do
if project.iscpp(prj) then
hascpp = true
elseif project.isdotnet(prj) then
@ -269,7 +269,7 @@
-- if the platform identifier matches a known system or architecture,
--
for prj in solution.eachproject_ng(cfg.solution) do
for prj in solution.eachproject(cfg.solution) do
if project.iscpp(prj) then
hascpp = true
elseif project.isdotnet(prj) then

View File

@ -17,7 +17,7 @@
io.eol = "\r\n"
io.esc = vs2005.esc
premake.generate(sln, ".sln", vstudio.sln2005.generate_ng)
premake.generate(sln, ".sln", vstudio.sln2005.generate)
end
@ -25,9 +25,9 @@
io.eol = "\r\n"
io.esc = vs2005.esc
if premake5.project.isdotnet(prj) then
premake.generate(prj, ".csproj", vstudio.cs2005.generate_ng)
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user_ng)
if premake.project.isdotnet(prj) then
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user)
else
premake.generate(prj, ".vcproj", vstudio.vc200x.generate)
premake.generate(prj, ".vcproj.user", vstudio.vc200x.generate_user)
@ -69,10 +69,6 @@
os = "windows",
-- temporary, until I can phase out the legacy implementations
isnextgen = true,
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },

View File

@ -8,9 +8,9 @@
local vstudio = premake.vstudio
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
local config = premake5.config
local fileconfig = premake5.fileconfig
local project = premake.project
local config = premake.config
local fileconfig = premake.fileconfig
local dotnet = premake.tools.dotnet
@ -26,7 +26,7 @@
"projectProperties",
}
function cs2005.generate_ng(prj)
function cs2005.generate(prj)
io.indent = " "
io.utf8()
@ -244,7 +244,7 @@
else
_p(2,'<DebugType>pdbonly</DebugType>')
end
_p(2,'<Optimize>%s</Optimize>', iif(premake.config.isoptimizedbuild(cfg), "true", "false"))
_p(2,'<Optimize>%s</Optimize>', iif(config.isOptimizedBuild(cfg), "true", "false"))
end

View File

@ -5,14 +5,14 @@
--
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
local project = premake.project
--
-- Generate a Visual Studio 200x C# user file, with support for the new platforms API.
--
function cs2005.generate_user_ng(prj)
function cs2005.generate_user(prj)
io.indent = " "
_p('<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')

View File

@ -8,7 +8,7 @@
local vstudio = premake.vstudio
local sln2005 = premake.vstudio.sln2005
local solution = premake.solution
local project = premake5.project
local project = premake.project
local tree = premake.tree
@ -16,7 +16,7 @@
-- Generate a Visual Studio 200x solution, with support for the new platforms API.
--
function sln2005.generate_ng(sln)
function sln2005.generate(sln)
-- Mark the file as Unicode
_p('\239\187\191')
@ -96,7 +96,7 @@
_x('Project("{%s}") = "%s", "%s", "{%s}"', vstudio.tool(prj), prj.name, prjpath, prj.uuid)
if _ACTION < "vs2012" then
sln2005.projectdependencies_ng(prj)
sln2005.projectdependencies(prj)
end
_p('EndProject')
end,
@ -113,7 +113,7 @@
-- Write out the list of project dependencies for a particular project.
--
function sln2005.projectdependencies_ng(prj)
function sln2005.projectdependencies(prj)
local deps = project.getdependencies(prj)
if #deps > 0 then
_p(1,'ProjectSection(ProjectDependencies) = postProject')

View File

@ -24,10 +24,6 @@
os = "windows",
-- temporary, until I can phase out the legacy implementations
isnextgen = true,
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },

View File

@ -9,9 +9,9 @@
local vstudio = premake.vstudio
local vc200x = premake.vstudio.vc200x
local context = premake.context
local project = premake5.project
local config = premake5.config
local fileconfig = premake5.fileconfig
local project = premake.project
local config = premake.config
local fileconfig = premake.fileconfig
---
@ -545,7 +545,7 @@
_x(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
if cfg.kind ~= premake.STATICLIB then
_p(4,'LinkIncremental="%s"', iif(premake.config.canincrementallink(cfg) , 2, 1))
_p(4,'LinkIncremental="%s"', iif(config.canLinkIncremental(cfg) , 2, 1))
end
vc200x.additionalLibraryDirectories(cfg)
@ -982,7 +982,7 @@
function vc200x.basicRuntimeChecks(cfg)
if not premake.config.isoptimizedbuild(cfg)
if not config.isOptimizedBuild(cfg)
and not cfg.flags.Managed
and not cfg.flags.NoRuntimeChecks
then
@ -1065,7 +1065,7 @@
function vc200x.minimalRebuild(cfg)
if premake.config.isdebugbuild(cfg) and
if config.isDebugBuild(cfg) and
cfg.debugformat ~= "c7" and
not cfg.flags.NoMinimalRebuild and
not cfg.flags.Managed and

View File

@ -6,7 +6,7 @@
local vstudio = premake.vstudio
local vc200x = premake.vstudio.vc200x
local project = premake5.project
local project = premake.project
--
@ -24,7 +24,7 @@
_p(1,'<Configurations>')
for cfg in project.eachconfig(prj) do
vc200x.userconfiguration(cfg)
vc200x.debugdir_ng(cfg)
vc200x.debugdir(cfg)
_p(2,'</Configuration>')
end
_p(1,'</Configurations>')
@ -49,7 +49,7 @@
-- Write out the debug settings for this project.
--
function vc200x.debugdir_ng(cfg)
function vc200x.debugdir(cfg)
_p(3,'<DebugSettings')
if cfg.debugcommand then

View File

@ -35,9 +35,9 @@
io.eol = "\r\n"
io.esc = vs2010.esc
if premake5.project.isdotnet(prj) then
premake.generate(prj, ".csproj", vstudio.cs2005.generate_ng)
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user_ng)
if premake.project.isdotnet(prj) then
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user)
else
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate)
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generateUser)
@ -62,10 +62,6 @@
os = "windows",
-- temporary, until I can phase out the legacy implementations
isnextgen = true,
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },

View File

@ -8,9 +8,9 @@
local vc2010 = premake.vstudio.vc2010
local vstudio = premake.vstudio
local project = premake5.project
local config = premake5.config
local fileconfig = premake5.fileconfig
local project = premake.project
local config = premake.config
local fileconfig = premake.fileconfig
local tree = premake.tree
@ -695,7 +695,7 @@
value = "OldStyle"
elseif cfg.architecture == "x64" or
cfg.flags.Managed or
premake.config.isoptimizedbuild(cfg) or
config.isOptimizedBuild(cfg) or
cfg.flags.NoEditAndContinue
then
value = "ProgramDatabase"
@ -778,7 +778,7 @@
function vc2010.functionLevelLinking(cfg)
if premake.config.isoptimizedbuild(cfg) then
if config.isOptimizedBuild(cfg) then
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
end
end
@ -843,7 +843,7 @@
function vc2010.intrinsicFunctions(cfg)
if premake.config.isoptimizedbuild(cfg) then
if config.isOptimizedBuild(cfg) then
_p(3,'<IntrinsicFunctions>true</IntrinsicFunctions>')
end
end
@ -851,7 +851,7 @@
function vc2010.linkIncremental(cfg)
if cfg.kind ~= premake.STATICLIB then
_p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(premake.config.canincrementallink(cfg)))
_p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(config.canLinkIncremental(cfg)))
end
end
@ -869,7 +869,7 @@
function vc2010.minimalRebuild(cfg)
if premake.config.isoptimizedbuild(cfg) or
if config.isOptimizedBuild(cfg) or
cfg.flags.NoMinimalRebuild or
cfg.flags.MultiProcessorCompile or
cfg.debugformat == premake.C7
@ -929,7 +929,7 @@
function vc2010.optimizeReferences(cfg)
if premake.config.isoptimizedbuild(cfg) then
if config.isOptimizedBuild(cfg) then
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
_p(3,'<OptimizeReferences>true</OptimizeReferences>')
end
@ -1060,7 +1060,7 @@
end
function vc2010.stringPooling(cfg)
if premake.config.isoptimizedbuild(cfg) then
if config.isOptimizedBuild(cfg) then
_p(3,'<StringPooling>true</StringPooling>')
end
end

View File

@ -5,7 +5,7 @@
--
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
local tree = premake.tree

View File

@ -6,7 +6,7 @@
local vstudio = premake.vstudio
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--

View File

@ -24,10 +24,6 @@
os = "windows",
-- temporary, until I can phase out the legacy implementations
isnextgen = true,
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },

View File

@ -24,10 +24,6 @@
os = "windows",
-- temporary, until I can phase out the legacy implementations
isnextgen = true,
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },

View File

@ -61,7 +61,7 @@
if a.onsolution then
a.onsolution(sln)
end
for prj in premake.solution.eachproject_ng(sln) do
for prj in premake.solution.eachproject(sln) do
if a.onproject and not prj.external then
a.onproject(prj)
end

View File

@ -1151,7 +1151,7 @@
local prj = sln.projects[name]
if not prj then
prj = premake5.project.new(sln, name)
prj = premake.project.new(sln, name)
prj.group = api.scope.group or ""
premake.solution.addproject(sln, prj)
end

View File

@ -1,56 +0,0 @@
--
-- configs.lua
--
-- Functions for working with configuration objects (which can include
-- projects and solutions).
--
-- Copyright (c) 2008-2013 Jason Perkins and the Premake project
--
premake.config = {}
local config = premake.config
--
-- Determine if a configuration represents a "debug" or "release" build.
-- This controls the runtime library selected for Visual Studio builds
-- (and might also be useful elsewhere).
--
function premake.config.isdebugbuild(cfg)
-- If any of the optimize flags are set, it's a release build
if cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed then
return false
end
-- If symbols are not defined, it's a release build
if not cfg.flags.Symbols then
return false
end
return true
end
--
-- Determines if this configuration can be linked incrementally.
--
function premake.config.canincrementallink(cfg)
if cfg.kind == "StaticLib"
or config.isoptimizedbuild(cfg)
or cfg.flags.NoIncrementalLink then
return false
end
return true
end
--
-- Determine if this configuration uses one of the optimize flags.
-- Optimized builds get different treatment, such as full linking
-- instead of incremental.
--
function premake.config.isoptimizedbuild(cfg)
return cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed
end

View File

@ -5,13 +5,10 @@
--
--
-- Create a top-level namespace for Premake's own APIs. The premake5 namespace
-- is a place to do next-gen (5.0) work without breaking the existing code (yet).
-- I think it will eventually go away.
-- Create a top-level namespace for Premake's own APIs
--
premake = {}
premake5 = {}
premake.tools = {}

View File

@ -5,8 +5,8 @@
--
local solution = premake.solution
local project = premake5.project
local config = premake5.config
local project = premake.project
local config = premake.config
---
@ -155,7 +155,7 @@
--
function premake.generate(obj, ext, callback)
local fn = premake5.project.getfilename(obj, ext)
local fn = premake.project.getfilename(obj, ext)
printf("Generating %s...", path.getrelative(os.getcwd(), fn))
local f, err = io.open(fn, "wb")
@ -191,6 +191,23 @@
end
--
-- Wrap the provided value in double quotes if it contains spaces, or
-- if it contains a shell variable of the form $(...).
--
function premake.quoted(value)
local q = value:find(" ", 1, true)
if not q then
q = value:find("$%(.-%)", 1)
end
if q then
value = '"' .. value .. '"'
end
return value
end
--
-- Sanity check the project information loaded from the scripts, to
-- make sure it all meets some minimum requirements. Raises an error if
@ -203,7 +220,7 @@
for sln in solution.each() do
premake.validateSolution(sln, ctx)
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
premake.validateProject(prj, ctx)
for cfg in project.eachconfig(prj) do
@ -232,7 +249,7 @@
-- all project UUIDs must be unique
local uuids = {}
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
if uuids[prj.uuid] then
premake.error("projects '%s' and '%s' have the same UUID", uuids[prj.uuid], prj.name)
end

View File

@ -1,576 +0,0 @@
--
-- project.lua
-- Functions for working with the project data.
-- Copyright (c) 2002 Jason Perkins and the Premake project
--
premake.project = { }
--
-- Returns an iterator for a set of build configuration settings. If a platform is
-- specified, settings specific to that platform and build configuration pair are
-- returned.
--
function premake.eachconfig(prj, platform)
-- I probably have the project root config, rather than the actual project
if prj.project then prj = prj.project end
local cfgs = prj.solution.configurations
local i = 0
return function ()
i = i + 1
if i <= #cfgs then
return premake.getconfig(prj, cfgs[i], platform)
end
end
end
--
-- Iterator for a project's files; returns a file configuration object.
--
function premake.project.eachfile(prj)
-- project root config contains the file config list
if not prj.project then prj = premake.getconfig(prj) end
local i = 0
local t = prj.files
return function ()
i = i + 1
if (i <= #t) then
local name = premake5.project.getrelative(prj, t[i])
local fcfg = prj.__fileconfigs[name]
fcfg.vpath = premake.project.getvpath(prj, fcfg.name)
return fcfg
end
end
end
--
-- Given a map of supported platform identifiers, filters the solution's list
-- of platforms to match. A map takes the form of a table like:
--
-- { x32 = "Win32", x64 = "x64" }
--
-- Only platforms that are listed in both the solution and the map will be
-- included in the results. An optional default platform may also be specified;
-- if the result set would otherwise be empty this platform will be used.
--
function premake.filterplatforms(sln, map, default)
local result = { }
local keys = { }
if sln.platforms then
for _, p in ipairs(sln.platforms) do
if map[p] and not table.contains(keys, map[p]) then
table.insert(result, p)
table.insert(keys, map[p])
end
end
end
if #result == 0 and default then
table.insert(result, default)
end
return result
end
--
-- Locate a project by name; case insensitive.
--
function premake.findproject(name)
for sln in premake.solution.each() do
for prj in premake.solution.eachproject(sln) do
if (prj.name == name) then
return prj
end
end
end
end
--
-- Locate a file in a project with a given extension; used to locate "special"
-- items such as Windows .def files.
--
function premake.findfile(prj, extension)
for _, fname in ipairs(prj.files) do
if fname:endswith(extension) then return fname end
end
end
--
-- Retrieve a configuration for a given project/configuration pairing.
-- @param prj
-- The project to query.
-- @param cfgname
-- The target build configuration; only settings applicable to this configuration
-- will be returned. May be nil to retrieve project-wide settings.
-- @param pltname
-- The target platform; only settings applicable to this platform will be returned.
-- May be nil to retrieve platform-independent settings.
-- @returns
-- A configuration object containing all the settings for the given platform/build
-- configuration pair.
--
function premake.getconfig(prj, cfgname, pltname)
-- might have the root configuration, rather than the actual project
prj = prj.project or prj
-- if platform is not included in the solution, use general settings instead
if pltname == "Native" or not table.contains(prj.solution.platforms or {}, pltname) then
pltname = nil
end
local key = (cfgname or "")
if pltname then key = key .. pltname end
return prj.__configs[key]
end
--
-- Build a name from a build configuration/platform pair. The short name
-- is good for makefiles or anywhere a user will have to type it in. The
-- long name is more readable.
--
function premake.getconfigname(cfgname, platform, useshortname)
if cfgname then
local name = cfgname
if platform and platform ~= "Native" then
if useshortname then
name = name .. premake.platforms[platform].cfgsuffix
else
name = name .. "|" .. platform
end
end
return iif(useshortname, name:lower(), name)
end
end
--
-- Returns a list of sibling projects on which the specified project depends.
-- This is used to list dependencies within a solution or workspace. Must
-- consider all configurations because Visual Studio does not support per-config
-- project dependencies.
--
-- @param prj
-- The project to query.
-- @returns
-- A list of dependent projects, as an array of objects.
--
function premake.getdependencies(prj)
-- make sure I've got the project and not root config
prj = prj.project or prj
local function add_to_project_list(depproj, results)
local dep = premake.findproject(depproj)
if dep and not table.contains(results, dep) then
table.insert(results, dep)
end
end
local results = { }
for _, cfg in pairs(prj.__configs) do
for _, link in ipairs(cfg.links) do
add_to_project_list(link, results)
end
for _, depproj in ipairs(cfg.dependson) do
add_to_project_list(depproj, results)
end
end
return results
end
--
-- Uses information from a project (or solution) to format a filename.
--
-- @param prj
-- A project or solution object with the file naming information.
-- @param pattern
-- A naming pattern. The sequence "%%" will be replaced by the
-- project name.
-- @returns
-- A filename matching the specified pattern, with a relative path
-- from the current directory to the project location.
--
function premake.project.getfilename(prj, pattern)
local fname = pattern:gsub("%%%%", prj.filename or prj.name)
fname = path.join(premake5.project.getlocation(prj), fname)
return path.getrelative(os.getcwd(), fname)
end
--
-- Returns a list of link targets. Kind may be one of:
-- siblings - linkable sibling projects
-- system - system (non-sibling) libraries
-- dependencies - all sibling dependencies, including non-linkable
-- all - return everything
--
-- Part may be one of:
-- name - the decorated library name with no directory
-- basename - the undecorated library name
-- directory - just the directory, no name
-- fullpath - full path with decorated name
-- object - return the project object of the dependency
--
function premake.getlinks(cfg, kind, part)
-- if I'm building a list of link directories, include libdirs
local result = iif (part == "directory" and kind == "all", cfg.libdirs, {})
-- am I getting links for a configuration or a project?
local cfgname = iif(cfg.name == cfg.project.name, "", cfg.name)
-- how should files be named?
local pathstyle = premake.getpathstyle(cfg)
local namestyle = premake.getnamestyle(cfg)
local function canlink(source, target)
if (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then
return false
end
if project.iscpp(source) then
return project.iscpp(target)
elseif project.isdotnet(source) then
return project.isdotnet(target)
end
end
for _, link in ipairs(cfg.links) do
local item
-- is this a sibling project?
local prj = premake.findproject(link)
if prj and kind ~= "system" then
local prjcfg = premake.getconfig(prj, cfgname, cfg.platform)
if kind == "dependencies" or canlink(cfg, prjcfg) then
if (part == "directory") then
item = path.rebase(prjcfg.linktarget.directory, prjcfg.location, cfg.location)
elseif (part == "basename") then
item = prjcfg.linktarget.basename
elseif (part == "fullpath") then
item = path.rebase(prjcfg.linktarget.fullpath, prjcfg.location, cfg.location)
elseif (part == "object") then
item = prjcfg
end
end
elseif not prj and (kind == "system" or kind == "all") then
if (part == "directory") then
local dir = path.getdirectory(link)
if (dir ~= ".") then
item = dir
end
elseif (part == "fullpath") then
item = link
if namestyle == "windows" then
if project.iscpp(cfg) then
item = item .. ".lib"
elseif project.isdotnet(cfg) then
item = item .. ".dll"
end
end
if item:find("/", nil, true) then
item = path.getrelative(cfg.basedir, item)
end
else
item = link
end
end
if item then
if pathstyle == "windows" and part ~= "object" then
item = path.translate(item, "\\")
end
if not table.contains(result, item) then
table.insert(result, item)
end
end
end
return result
end
--
-- Gets the name style for a configuration, indicating what kind of prefix,
-- extensions, etc. should be used in target file names.
--
-- @param cfg
-- The configuration to check.
-- @returns
-- The target naming style, one of "windows", "posix", or "PS3".
--
function premake.getnamestyle(cfg)
return premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or "posix"
end
--
-- Gets the path style for a configuration, indicating what kind of path separator
-- should be used in target file names.
--
-- @param cfg
-- The configuration to check.
-- @returns
-- The target path style, one of "windows" or "posix".
--
function premake.getpathstyle(cfg)
if premake.action.current().os == "windows" then
return "windows"
else
return "posix"
end
end
--
-- Assembles a target for a particular tool/system/configuration.
--
-- @param cfg
-- The configuration to be targeted.
-- @param direction
-- One of 'build' for the build target, or 'link' for the linking target.
-- @param pathstyle
-- The path format, one of "windows" or "posix". This comes from the current
-- action: Visual Studio uses "windows", GMake uses "posix", etc.
-- @param namestyle
-- The file naming style, one of "windows" or "posix". This comes from the
-- current tool: GCC uses "posix", MSC uses "windows", etc.
-- @param system
-- The target operating system, which can modify the naming style. For example,
-- shared libraries on Mac OS X use a ".dylib" extension.
-- @returns
-- An object with these fields:
-- basename - the target with no directory or file extension
-- name - the target name and extension, with no directory
-- directory - relative path to the target, with no file name
-- prefix - the file name prefix
-- suffix - the file name suffix
-- fullpath - directory, name, and extension
-- bundlepath - the relative path and file name of the bundle
--
function premake.gettarget(cfg, direction, pathstyle, namestyle, system)
if system == "bsd" or system == "solaris" then
system = "linux"
end
-- Fix things up based on the current system
local kind = cfg.kind
if project.iscpp(cfg) then
-- On Windows, shared libraries link against a static import library
if (namestyle == "windows" or system == "windows")
and kind == "SharedLib" and direction == "link"
and not cfg.flags.NoImportLib
then
kind = "StaticLib"
end
-- Posix name conventions only apply to static libs on windows (by user request)
if namestyle == "posix" and system == "windows" and kind ~= "StaticLib" then
namestyle = "windows"
end
end
-- Initialize the target components
local field = iif(direction == "build", "target", "implib")
local name = cfg[field.."name"] or cfg.targetname or cfg.project.name
local dir = cfg[field.."dir"] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir)
local prefix = ""
local suffix = ""
local ext = ""
local bundlepath, bundlename
if namestyle == "windows" then
if kind == "ConsoleApp" or kind == "WindowedApp" then
ext = ".exe"
elseif kind == "SharedLib" then
ext = ".dll"
elseif kind == "StaticLib" then
ext = ".lib"
end
elseif namestyle == "posix" then
if kind == "WindowedApp" and system == "macosx" then
bundlename = name .. ".app"
bundlepath = path.join(dir, bundlename)
dir = path.join(bundlepath, "Contents/MacOS")
elseif kind == "SharedLib" then
prefix = "lib"
ext = iif(system == "macosx", ".dylib", ".so")
elseif kind == "StaticLib" then
prefix = "lib"
ext = ".a"
end
elseif namestyle == "PS3" then
if kind == "ConsoleApp" or kind == "WindowedApp" then
ext = ".elf"
elseif kind == "StaticLib" then
prefix = "lib"
ext = ".a"
end
end
prefix = cfg[field.."prefix"] or cfg.targetprefix or prefix
suffix = cfg[field.."suffix"] or cfg.targetsuffix or suffix
ext = cfg[field.."extension"] or cfg.targetextension or ext
-- build the results object
local result = { }
result.basename = name .. suffix
result.name = prefix .. name .. suffix .. ext
result.directory = dir
result.prefix = prefix
result.suffix = suffix
result.fullpath = path.join(result.directory, result.name)
result.bundlepath = bundlepath or result.fullpath
if pathstyle == "windows" then
result.directory = path.translate(result.directory, "\\")
result.fullpath = path.translate(result.fullpath, "\\")
end
return result
end
--
-- Return the appropriate tool interface, based on the target language and
-- any relevant command-line options.
--
function premake.gettool(cfg)
if project.iscpp(cfg) then
if _OPTIONS.cc then
return premake[_OPTIONS.cc]
end
local action = premake.action.current()
if action.valid_tools then
return premake[action.valid_tools.cc[1]]
end
return premake.gcc
else
return premake.dotnet
end
end
--
-- Given a source file path, return a corresponding virtual path based on
-- the vpath entries in the project. If no matching vpath entry is found,
-- the original path is returned.
--
function premake.project.getvpath(prj, filename)
prj = prj.project
-- if there is no match, return the input filename
local vpath = filename
for replacement,patterns in pairs(prj.vpaths or {}) do
for _,pattern in ipairs(patterns) do
pattern = premake5.project.getrelative(prj, pattern)
-- does the filename match this vpath pattern?
local i = vpath:find(path.wildcards(pattern))
if i == 1 then
-- yes; trim the leading portion of the path
i = pattern:find("*", 1, true) or (pattern:len() + 1)
local leaf = vpath:sub(i)
if leaf:startswith("/") then
leaf = leaf:sub(2)
end
-- check for (and remove) stars in the replacement pattern.
-- If there are none, then trim all path info from the leaf
-- and use just the filename in the replacement (stars should
-- really only appear at the end; I'm cheating here)
local stem = ""
if replacement:len() > 0 then
stem, stars = replacement:gsub("%*", "")
if stars == 0 then
leaf = path.getname(leaf)
end
end
vpath = path.join(stem, leaf)
end
end
end
-- remove any dot ("./", "../") patterns from the start of the path
local changed
repeat
changed = true
if vpath:startswith("./") then
vpath = vpath:sub(3)
elseif vpath:startswith("../") then
vpath = vpath:sub(4)
else
changed = false
end
until not changed
return vpath
end
--
-- Returns true if the solution contains at least one C/C++ project.
--
function premake.hascppproject(sln)
for prj in premake.solution.eachproject(sln) do
if project.iscpp(prj) then
return true
end
end
end
--
-- Returns true if the solution contains at least one .NET project.
--
function premake.hasdotnetproject(sln)
for prj in premake.solution.eachproject(sln) do
if project.isdotnet(prj) then
return true
end
end
end

View File

@ -6,8 +6,7 @@
premake.solution = { }
local solution = premake.solution
local oven = premake5.oven
local project = premake5.project
local project = premake.project
local configset = premake.configset
local context = premake.context
local tree = premake.tree
@ -180,7 +179,7 @@
-- fill in any calculated values
for _, cfg in ipairs(configs) do
cfg.solution = sln
premake5.config.bake(cfg)
premake.config.bake(cfg)
end
return configs
@ -226,7 +225,7 @@
local counts = {}
local configs = {}
for prj in premake.solution.eachproject_ng(sln) do
for prj in premake.solution.eachproject(sln) do
for cfg in project.eachconfig(prj) do
-- get the dirs for this config, and remember the association
local dirs = getobjdirs(cfg)
@ -296,26 +295,6 @@
end
--
-- Iterate over the projects of a solution.
--
-- @param sln
-- The solution.
-- @returns
-- An iterator function.
--
function solution.eachproject(sln)
local i = 0
return function ()
i = i + 1
if i <= #sln.projects then
return premake.solution.getproject(sln, i)
end
end
end
--
-- Iterate over the projects of a solution (next-gen).
--
@ -325,12 +304,12 @@
-- An iterator function, returning project configurations.
--
function solution.eachproject_ng(sln)
function solution.eachproject(sln)
local i = 0
return function ()
i = i + 1
if i <= #sln.projects then
return premake.solution.getproject_ng(sln, i)
return premake.solution.getproject(sln, i)
end
end
end
@ -405,7 +384,7 @@
-- build the tree of groups
local tr = tree.new()
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
local prjpath = path.join(prj.group, prj.name)
local node = tree.add(tr, prjpath)
node.project = prj
@ -438,29 +417,6 @@
solution.getlocation = project.getlocation
--
-- Retrieve the project at a particular index.
--
-- @param sln
-- The solution.
-- @param idx
-- An index into the array of projects.
-- @returns
-- The project at the given index.
--
function solution.getproject(sln, idx)
-- retrieve the root configuration of the project, with all of
-- the global (not configuration specific) settings collapsed
local prj = sln.projects[idx]
local cfg = premake.getconfig(prj)
-- root configuration doesn't have a name; use the project's
cfg.name = prj.name
return cfg
end
--
-- Retrieve the project configuration at a particular index.
--
@ -472,7 +428,7 @@
-- The project configuration at the given index.
--
function solution.getproject_ng(sln, idx)
function solution.getproject(sln, idx)
-- to make testing a little easier, allow this function to
-- accept an unbaked solution, and fix it on the fly
if not sln.baked then
@ -493,7 +449,7 @@
--
function solution.hascppproject(sln)
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
if project.iscpp(prj) then
return true
end
@ -514,7 +470,7 @@
--
function solution.hasdotnetproject(sln)
for prj in solution.eachproject_ng(sln) do
for prj in solution.eachproject(sln) do
if project.isdotnet(prj) then
return true
end

View File

@ -1,10 +1,19 @@
--
-- string.lua
-- Additions to Lua's built-in string functions.
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
-- Copyright (c) 2002-2013 Jason Perkins and the Premake project
--
--
-- Returns true if the string has a match for the plain specified pattern
--
function string.contains(s, match)
return string.find(s, match, 1, true) ~= nil
end
--
-- Returns an array of strings, each of which is a substring of s
-- formed by splitting on boundaries formed by `pattern`.

View File

@ -31,11 +31,13 @@
-- The tree to contain the new node.
-- @param p
-- The path of the new node.
-- @param extraFields
-- A table containing key-value pairs to be added to any new nodes.
-- @returns
-- The new tree node.
--
function tree.add(tr, p)
function tree.add(tr, p, extraFields)
-- Special case "." refers to the current node
if p == "." then
return tr
@ -43,7 +45,7 @@
-- Look for the immediate parent for this new node, creating it if necessary.
-- Recurses to create as much of the tree as necessary.
local parentnode = tree.add(tr, path.getdirectory(p), onaddfunc)
local parentnode = tree.add(tr, path.getdirectory(p), extraFields)
-- Create the child if necessary
local childname = path.getname(p)
@ -51,6 +53,11 @@
if not childnode or childnode.path ~= p then
childnode = tree.insert(parentnode, tree.new(childname))
childnode.path = p
if extraFields then
for k,v in pairs(extraFields) do
childnode[k] = v
end
end
end
return childnode
@ -275,7 +282,7 @@
local node = tr.children[1]
-- if this node has no children (it is the last node in the tree) I'm done
if #node.children == 0 then
if #node.children == 0 or node.trim == false then
break
end

View File

@ -279,7 +279,7 @@ int process_option(lua_State* L, const char* arg)
}
/* Make keys lowercase to avoid case issues */
for (ptr = key; *ptr; ++ptr) { *ptr = tolower(*ptr); }
for (ptr = key; *ptr; ++ptr) { *ptr = (char)tolower(*ptr); }
/* Store it in the Options table, which is already on the stack */
lua_pushstring(L, value);

View File

@ -1,14 +1,13 @@
--
-- src/project/config.lua
-- Premake configuration object API
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
premake5.config = {}
local project = premake5.project
local config = premake5.config
premake.config = {}
local project = premake.project
local config = premake.config
local context = premake.context
local oven = premake5.oven
--
@ -146,6 +145,21 @@
end
--
-- Determines if this configuration can be linked incrementally.
--
function config.canLinkIncremental(cfg)
if cfg.kind == "StaticLib"
or config.isOptimizedBuild(cfg)
or cfg.flags.NoIncrementalLink then
return false
end
return true
end
--
-- Given a raw link target filename, properly format it for the given
-- configuration. Adds file decorations, and handles relative path
@ -386,7 +400,7 @@
function config.getruntime(cfg)
local linkage = iif(cfg.flags.StaticRuntime, "Static", "Shared")
local mode = iif(premake.config.isdebugbuild(cfg) and not cfg.flags.ReleaseRuntime, "Debug", "Release")
local mode = iif(config.isDebugBuild(cfg) and not cfg.flags.ReleaseRuntime, "Debug", "Release")
return linkage .. mode
end
@ -443,3 +457,34 @@
return default
end
--
-- Determine if a configuration represents a "debug" or "release" build.
-- This controls the runtime library selected for Visual Studio builds
-- (and might also be useful elsewhere).
--
function config.isDebugBuild(cfg)
-- If any of the optimize flags are set, it's a release build
if cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed then
return false
end
-- If symbols are not defined, it's a release build
if not cfg.flags.Symbols then
return false
end
return true
end
--
-- Determine if this configuration uses one of the optimize flags.
-- Optimized builds get different treatment, such as full linking
-- instead of incremental.
--
function config.isOptimizedBuild(cfg)
return cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed
end

View File

@ -4,11 +4,11 @@
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
premake5.fileconfig = {}
premake.fileconfig = {}
local fileconfig = premake5.fileconfig
local fileconfig = premake.fileconfig
local context = premake.context
local project = premake5.project
local project = premake.project
--

View File

@ -4,8 +4,8 @@
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
premake5.project = {}
local project = premake5.project
premake.project = {}
local project = premake.project
local configset = premake.configset
local context = premake.context
local tree = premake.tree
@ -204,12 +204,12 @@
-- and indexed for ordered iteration.
if not files[fname] then
local fcfg = premake5.fileconfig.new(fname, prj)
local fcfg = premake.fileconfig.new(fname, prj)
files[fname] = fcfg
table.insert(files, fcfg)
end
premake5.fileconfig.addconfig(files[fname], cfg)
premake.fileconfig.addconfig(files[fname], cfg)
end)
end
@ -256,7 +256,7 @@
local sequences = bases[file.basename]
for cfg in project.eachconfig(prj) do
local fcfg = premake5.fileconfig.getconfig(file, cfg)
local fcfg = premake.fileconfig.getconfig(file, cfg)
if fcfg ~= nil and not fcfg.flags.ExcludeFromBuild then
fcfg.sequence = sequences[cfg] or 0
sequences[cfg] = fcfg.sequence + 1
@ -425,7 +425,7 @@
-- and short names and the build and link target.
-- TODO: Merge these two functions
premake5.config.bake(ctx)
premake.config.bake(ctx)
return ctx
end
@ -722,13 +722,22 @@
-- in the IDE, not the physical organization of the file system. So
-- virtual paths are used when adding nodes.
-- If the project script specifies a virtual path for a file, disable
-- the logic that could trim out empty root nodes from that path. If
-- the script writer wants an empty root node they should get it.
local flags
if fcfg.vpath ~= fcfg.relpath then
flags = { trim = false }
end
-- Virtual paths can overlap, potentially putting files with the same
-- name in the same folder, even though they have different paths on
-- the underlying filesystem. The tree.add() call won't overwrite
-- existing nodes, so provide the extra logic here. Start by getting
-- the parent folder node, creating it if necessary.
local parent = tree.add(tr, path.getdirectory(fcfg.vpath))
local parent = tree.add(tr, path.getdirectory(fcfg.vpath), flags)
local node = tree.insert(parent, tree.new(path.getname(fcfg.vpath)))
-- Pass through value fetches to the file configuration

View File

@ -7,7 +7,7 @@
premake.tools.dotnet = {}
local dotnet = premake.tools.dotnet
local project = premake5.project
local project = premake.project
dotnet.namestyle = "windows"

View File

@ -6,8 +6,8 @@
premake.tools.gcc = {}
local gcc = premake.tools.gcc
local project = premake5.project
local config = premake5.config
local project = premake.project
local config = premake.config
--
@ -97,6 +97,7 @@
EnableSSE2 = "-msse2",
ExtraWarnings = "-Wall -Wextra",
FatalWarnings = "-Werror",
NoWarnings = "-w",
FloatFast = "-ffast-math",
FloatStrict = "-ffloat-store",
NoFramePointer = "-fomit-frame-pointer",
@ -158,15 +159,15 @@
-- @return
-- An array of force include files with the appropriate flags.
--
function gcc.getforceincludes(cfg)
local result = {}
table.foreachi(cfg.forceincludes, function(value)
local fn = project.getrelative(cfg.project, value)
table.insert(result, string.format('-include "%s"', fn))
table.insert(result, string.format('-include %s', premake.quoted(fn)))
end)
return result
end
@ -178,7 +179,8 @@
function gcc.getincludedirs(cfg, dirs)
local result = {}
for _, dir in ipairs(dirs) do
table.insert(result, '-I"' .. project.getrelative(cfg.project, dir) .. '"')
dir = project.getrelative(cfg.project, dir)
table.insert(result, '-I' .. premake.quoted(dir))
end
return result
end

View File

@ -1,14 +1,14 @@
--
-- msc.lua
-- Interface for the MS C/C++ compiler.
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
--
premake.tools.msc = {}
local msc = premake.tools.msc
local project = premake5.project
local config = premake5.config
local project = premake.project
local config = premake.config
--
@ -17,7 +17,7 @@
function msc.getcppflags(cfg)
local flags = {}
return flags
return flags
end
@ -29,20 +29,20 @@
SEH = "/EHa",
OptimizeSpeed = "/O2",
}
function msc.getcflags(cfg)
local flags = table.translate(cfg.flags, msc.cflags)
local runtime = iif(cfg.flags.StaticRuntime, "/MT", "/MD")
if premake.config.isdebugbuild(cfg) then
if config.isDebugBuild(cfg) then
runtime = runtime .. "d"
end
table.insert(flags, runtime)
if not premake.config.isoptimizedbuild(cfg) then
if not config.isOptimizedBuild(cfg) then
table.insert(flags, "/Od")
end
if cfg.flags.Symbols then
table.insert(flags, "/Z7")
end
@ -50,7 +50,7 @@
if not cfg.flags.SEH then
table.insert(flags, "/EHsc")
end
return flags
end
@ -61,7 +61,7 @@
msc.cxxflags = {
}
function msc.getcxxflags(cfg)
return table.translate(cfg.flags, msc.cxxflags)
end
@ -69,7 +69,7 @@
msc.ldflags = {
Symbols = "/DEBUG",
}
--
-- Decorate defines for the MSVC command line.
@ -99,7 +99,7 @@
table.foreachi(cfg.forceincludes, function(value)
local fn = project.getrelative(cfg.project, value)
table.insert(result, string.format('/FI"%s"', fn))
table.insert(result, "/FI" .. premake.quoted(fn))
end)
return result
@ -114,7 +114,8 @@
function msc.getincludedirs(cfg, dirs)
local result = {}
for _, dir in ipairs(dirs) do
table.insert(result, '-I"' .. project.getrelative(cfg.project, dir) .. '"')
dir = project.getrelative(cfg.project, dir)
table.insert(result, '-I' .. premake.quoted(dir))
end
return result
end
@ -133,15 +134,15 @@
if not cfg.flags.NoManifest and cfg.kind ~= premake.STATICLIB then
table.insert(flags, "/MANIFEST")
end
if premake.config.isoptimizedbuild(cfg) then
if config.isOptimizedBuild(cfg) then
table.insert(flags, "/OPT:REF /OPT:ICF")
end
for _, libdir in ipairs(project.getrelative(cfg.project, cfg.libdirs)) do
table.insert(flags, '/LIBPATH:"' .. libdir .. '"')
end
return flags
end

View File

@ -7,8 +7,8 @@
premake.tools.snc = {}
local snc = premake.tools.snc
local gcc = premake.tools.gcc
local config = premake5.config
local config = premake.config
--
-- SNC flags for specific systems and architectures.
@ -43,7 +43,7 @@
function snc.getcxxflags(cfg)
local flags = table.translate(cfg.flags, snc.cxxflags)
-- turn on exceptions and RTTI by default, to match other toolsets
if not cfg.flags.NoExceptions then
table.insert(flags, "-Xc+=exceptions")
@ -51,7 +51,7 @@
if not cfg.flags.NoRTTI then
table.insert(flags, "-Xc+=rtti")
end
return flags
end
@ -81,11 +81,11 @@
function snc.getldflags(cfg)
local flags = { }
if not cfg.flags.Symbols then
table.insert(flags, "-s")
end
return flags
end

View File

@ -7,7 +7,7 @@
local suite = test.declare("make_clang")
local make = premake.make
local cpp = premake.make.cpp
local project = premake5.project
local project = premake.project
--
@ -19,7 +19,7 @@
function suite.setup()
sln = test.createsolution()
toolset "clang"
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_cpp_file_rules")
local make = premake.make
local project = premake5.project
local project = premake.project
--
@ -20,7 +20,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
make.cppFileRules(prj)
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_flags")
local make = premake.make
local project = premake5.project
local project = premake.project
--
@ -34,6 +34,6 @@
includedirs { "src/include", "../include" }
prepare { "includes" }
test.capture [[
INCLUDES += -I"src/include" -I"../include"
INCLUDES += -Isrc/include -I../include
]]
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_linking")
local make = premake.make
local project = premake5.project
local project = premake.project
--

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_pch")
local make = premake.make
local project = premake5.project
local project = premake.project

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_cpp_objects")
local make = premake.make
local project = premake5.project
local project = premake.project
--
@ -20,7 +20,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
make.cppObjects(prj)
end

View File

@ -7,7 +7,7 @@
local suite = test.declare("make_ps3")
local make = premake.make
local cpp = premake.make.cpp
local project = premake5.project
local project = premake.project
--
@ -19,7 +19,7 @@
function suite.setup()
sln = test.createsolution()
system "ps3"
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cfg = project.getconfig(prj, "Debug")
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_cpp_target_rules")
local make = premake.make
local project = premake5.project
local project = premake.project
--

View File

@ -6,7 +6,7 @@
local suite = test.declare("make_wiidev")
local make = premake.make
local project = premake5.project
local project = premake.project
--

View File

@ -7,7 +7,7 @@
local suite = test.declare("make_cs_embed_files")
local make = premake.make
local cs = premake.make.cs
local project = premake5.project
local project = premake.project
--
@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
make.csEmbedFiles(prj, premake.tools.dotnet)
end

View File

@ -7,7 +7,7 @@
local suite = test.declare("make_cs_flags")
local make = premake.make
local cs = premake.make.cs
local project = premake5.project
local project = premake.project
--
@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cfg = project.getconfig(prj, "Debug")
make.csFlags(cfg, premake.tools.dotnet)
end

View File

@ -7,7 +7,7 @@
local suite = test.declare("make_cs_sources")
local make = premake.make
local cs = premake.make.cs
local project = premake5.project
local project = premake.project
--
@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
make.csSources(prj, premake.tools.dotnet)
end

View File

@ -20,7 +20,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
make.defaultconfig(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.commonProperties(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.projectProperties(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.targets(prj)
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("vs2012_vcxproj_config_props")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
---
@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cfg = project.getconfig(prj, "Debug")
vc2010.configurationProperties(cfg)
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("vs2013_vcxproj_config_props")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
---
@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cfg = project.getconfig(prj, "Debug")
vc2010.configurationProperties(cfg)
end

View File

@ -23,7 +23,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.projectProperties(prj)
end

View File

@ -22,7 +22,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.assemblyReferences(prj)
end

View File

@ -20,7 +20,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.buildEvents(prj)
end

View File

@ -7,7 +7,7 @@
T.vstudio_cs2005_compiler_props = {}
local suite = T.vstudio_cs2005_compiler_props
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
local project = premake.project
--
@ -15,12 +15,12 @@
--
local sln, prj
function suite.setup()
_ACTION = "vs2005"
sln, prj = test.createsolution()
end
local function prepare()
local cfg = project.getconfig(prj, "Debug")
cs2005.compilerProps(cfg)

View File

@ -7,7 +7,7 @@
T.vstudio_cs2005_debug_props = {}
local suite = T.vstudio_cs2005_debug_props
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
local project = premake.project
--
@ -15,12 +15,12 @@
--
local sln, prj
function suite.setup()
_ACTION = "vs2005"
sln, prj = test.createsolution()
end
local function prepare()
local cfg = project.getconfig(prj, "Debug")
cs2005.debugProps(cfg)

View File

@ -20,7 +20,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.files(prj)
end

View File

@ -19,7 +19,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cs2005.applicationIcon(prj)
end

View File

@ -7,7 +7,7 @@
T.vstudio_cs2005_output_props = {}
local suite = T.vstudio_cs2005_output_props
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
local project = premake.project
--
@ -15,15 +15,15 @@
--
local sln
function suite.setup()
_ACTION = "vs2005"
sln = test.createsolution()
language "C#"
end
local function prepare()
local prj = premake.solution.getproject_ng(sln, 1)
local prj = premake.solution.getproject(sln, 1)
local cfg = project.getconfig(prj, "Debug")
cs2005.outputProps(cfg)
end
@ -42,7 +42,7 @@
end
--
--
-- Check handling of the intermediates directory.
--
@ -52,7 +52,7 @@
test.capture [[
<OutputPath>.\</OutputPath>
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath>
]]
]]
end
function suite.intermediateDirectory_onVs2010()
@ -62,6 +62,6 @@
<OutputPath>.\</OutputPath>
<BaseIntermediateOutputPath>obj\Debug\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
]]
]]
end

View File

@ -24,7 +24,7 @@
platforms (platform)
prj = project ("MyProject")
language "C#"
cfg = premake5.project.getconfig(prj, "Debug", platform)
cfg = premake.project.getconfig(prj, "Debug", platform)
cs2005.propertyGroup(cfg)
end

View File

@ -23,7 +23,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 2)
prj = premake.solution.getproject(sln, 2)
cs2005.projectReferences(prj)
end

View File

@ -30,11 +30,11 @@
local function prepare(language)
prj1.language = language
prj2.language = language
prj2 = premake.solution.getproject_ng(sln, 2)
sln2005.projectdependencies_ng(prj2)
prj2 = premake.solution.getproject(sln, 2)
sln2005.projectdependencies(prj2)
prj3.language = language
prj3 = premake.solution.getproject_ng(sln, 3)
sln2005.projectdependencies_ng(prj3)
prj3 = premake.solution.getproject(sln, 3)
sln2005.projectdependencies(prj3)
end

View File

@ -20,7 +20,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc200x.assemblyReferences(prj)
end

View File

@ -20,7 +20,7 @@
end
local function prepare()
cfg = premake5.project.getconfig(prj, "Debug")
cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCPreBuildEventTool(cfg)
end

View File

@ -20,7 +20,7 @@
end
local function prepare()
cfg = premake5.project.getconfig(prj, "Debug")
cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCCLCompilerTool(cfg)
end

View File

@ -7,7 +7,7 @@
T.vstudio_vc200x_configuration = { }
local suite = T.vstudio_vc200x_configuration
local vc200x = premake.vstudio.vc200x
local project = premake5.project
local project = premake.project
--
@ -22,7 +22,7 @@
end
local function prepare()
local prj = premake.solution.getproject_ng(sln, 1)
local prj = premake.solution.getproject(sln, 1)
local cfg = project.getconfig(prj, "Debug", (prj.platforms or {})[1])
vc200x.configuration(cfg)
end

View File

@ -7,7 +7,7 @@
T.vstudio_vs200x_debugdir = { }
local suite = T.vstudio_vs200x_debugdir
local vc200x = premake.vstudio.vc200x
local project = premake5.project
local project = premake.project
--
@ -23,7 +23,7 @@
local function prepare()
cfg = project.getconfig(prj, "Debug")
vc200x.debugdir_ng(cfg)
vc200x.debugdir(cfg)
end

View File

@ -36,7 +36,7 @@
end
local function prepare(platform)
local cfg = premake5.project.getconfig(prj, "Debug", platform)
local cfg = premake.project.getconfig(prj, "Debug", platform)
vc200x.VCLinkerTool(cfg)
end

View File

@ -22,7 +22,7 @@
end
local function prepare()
cfg = premake5.project.getconfig(prj, "Debug")
cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCCLCompilerTool(cfg)
end

View File

@ -22,7 +22,7 @@
end
local function prepare()
local cfg = premake5.project.getconfig(prj, "Debug")
local cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCLinkerTool(cfg)
end

View File

@ -20,7 +20,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc200x.files(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
local cfg = premake5.project.getconfig(prj, "Debug")
local cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCLinkerTool(cfg)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
local cfg = premake5.project.getconfig(prj, "Debug")
local cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCManifestTool(cfg)
end

View File

@ -21,8 +21,8 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
cfg = premake5.project.getconfig(prj, "Debug")
prj = premake.solution.getproject(sln, 1)
cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCNMakeTool(cfg)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc200x.platforms(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc200x.visualStudioProject(prj)
end

View File

@ -23,7 +23,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 2)
prj = premake.solution.getproject(sln, 2)
vc200x.projectReferences(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
cfg = premake5.project.getconfig(prj, "Debug")
cfg = premake.project.getconfig(prj, "Debug")
vc200x.VCResourceCompilerTool(cfg)
end

View File

@ -20,7 +20,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc2010.assemblyReferences(prj)
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("vstudio_vs2010_compile_settings")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--

View File

@ -7,7 +7,7 @@
T.vstudio_vs2010_config_props = { }
local suite = T.vstudio_vs2010_config_props
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--
@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cfg = project.getconfig(prj, "Debug")
vc2010.configurationProperties(cfg)
end

View File

@ -7,19 +7,19 @@
T.vstudio_vs2010_debug_settings = { }
local suite = T.vstudio_vs2010_debug_settings
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--
-- Setup
-- Setup
--
local sln, prj, cfg
function suite.setup()
sln, prj = test.createsolution()
end
local function prepare()
cfg = project.getconfig(prj, "Debug")
vc2010.debugsettings(cfg)
@ -84,7 +84,7 @@
prepare()
test.capture [[
<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>
]]
]]
end
--
@ -97,6 +97,6 @@
test.capture [[
<LocalDebuggerEnvironment>key=value
foo=bar</LocalDebuggerEnvironment>
]]
]]
end

View File

@ -36,7 +36,7 @@
end
local function prepare(platform)
local cfg = premake5.project.getconfig(prj, "Debug", platform)
local cfg = premake.project.getconfig(prj, "Debug", platform)
vc2010.link(cfg)
end

View File

@ -19,7 +19,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc2010.files(prj)
end

View File

@ -5,7 +5,7 @@
--
local suite = test.declare("vs2010_filter_ids")
local vc2010 = premake.vstudio.vc2010
local vc2010 = premake.vstudio.vc2010
--
@ -13,14 +13,14 @@
--
local sln, prj
function suite.setup()
_ACTION = "vs2010"
sln = test.createsolution()
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc2010.filters_uniqueidentifiers(prj)
end

View File

@ -21,7 +21,7 @@
end
local function prepare(group)
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc2010.filters_filegroup(prj, group)
end

View File

@ -20,7 +20,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc2010.globals(prj)
end

View File

@ -6,7 +6,7 @@
local suite = test.declare("vs2010_item_def_group")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--

View File

@ -6,7 +6,7 @@
local suite = test.declare("vs2010_link")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--

View File

@ -6,7 +6,7 @@
local suite = test.declare("vs2010_nmake_props")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--
@ -22,7 +22,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
cfg = project.getconfig(prj, "Debug")
vc2010.nmakeProperties(cfg)
end

View File

@ -7,7 +7,7 @@
T.vstudio_vs2010_output_props = { }
local suite = T.vstudio_vs2010_output_props
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--
@ -22,7 +22,7 @@
end
local function prepare()
local prj = premake.solution.getproject_ng(sln, 1)
local prj = premake.solution.getproject(sln, 1)
local cfg = project.getconfig(prj, "Debug")
vc2010.outputProperties(cfg)
end

View File

@ -21,7 +21,7 @@
end
local function prepare()
prj = premake.solution.getproject_ng(sln, 1)
prj = premake.solution.getproject(sln, 1)
vc2010.projectConfigurations(prj)
end

View File

@ -23,7 +23,7 @@
end
local function prepare(platform)
prj = premake.solution.getproject_ng(sln, 2)
prj = premake.solution.getproject(sln, 2)
vc2010.projectReferences(prj)
end

View File

@ -7,7 +7,7 @@
T.vstudio_vs2010_prop_sheet = { }
local suite = T.vstudio_vs2010_prop_sheet
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--

View File

@ -6,7 +6,7 @@
local suite = test.declare("vs2010_resource_compiler")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
local project = premake.project
--

View File

@ -29,7 +29,7 @@
function suite.project_createsOnFirstUse()
project("MyProject")
test.isnotnil(premake.solution.getproject_ng(sln, "MyProject"))
test.isnotnil(premake.solution.getproject(sln, "MyProject"))
end

View File

@ -267,3 +267,20 @@
tree.trimroot(tr)
test.isequal("tests", tr.children[1].path)
end
--
-- Nodes with the key "trim" set to false should be removed.
--
function suite.trimroot_respectsTrimFlag()
local n = tree.add(tr, "A")
tree.add(tr, "A/1")
n.trim = false
tree.trimroot(tr)
prepare()
test.capture [[
A
1
]]
end

Some files were not shown because too many files have changed in this diff Show More