Merge remote-tracking branch 'premake-src/master'

This commit is contained in:
leeonix 2015-08-01 09:21:57 +08:00
commit dd8c5f1818
56 changed files with 1931 additions and 1143 deletions

View File

@ -1,16 +1,37 @@
PREMAKE
<a href="https://travis-ci.org/premake/premake-core"><img src="https://travis-ci.org/premake/premake-core.svg?branch=master" /></a>
# PREMAKE 5 (core) <a href="https://travis-ci.org/premake/premake-core"><img src="https://travis-ci.org/premake/premake-core.svg?branch=master" title="Build Status" alt="Build Status"/></a>
<img src="http://premake.github.io/premake-logo.png" width="200" height="200" />
A build configuration tool
Core module
Premake is a command line utility which reads a scripted definition of a software project and, most commonly, uses it to generate project files for toolsets like Visual Studio, Xcode, or GNU Make. Built-in and Third-Party [Modules](https://github.com/premake/premake-core/wiki/Modules) add support for even more toolsets.
Copyright (C) 2002-2015 by Jason Perkins
Distributed under the terms of the BSD License, see LICENSE.txt
The Lua language and runtime library is (C) TeCGraf, PUC-Rio.
See their website at http://www.lua.org/
Find out in detail [what Premake is](https://github.com/premake/premake-core/wiki/What_Is_Premake) and how to use it in the [wiki](https://github.com/premake/premake-core/wiki).
See the file BUILD.txt for instructions on building Premake.
For questions, comments, or more information, visit the project
website at https://github.com/premake/premake-core
### Get started
* [Download Premake](http://premake.github.io/download.html)
* [Read the wiki](https://github.com/premake/premake-core/wiki) to find out how to get your project up and running with Premake.
### News and Community
* Check the official [Github project](https://github.com/premake/premake-core) for the latest developments
* For questions about using Premake and authoring project scripts, please ask on [StackOverflow, adding the #premake tag to your question](http://stackoverflow.com/questions/tagged/premake).
* For discussions about developing, customizing, or extending Premake and add-on modules, please use the [Premake Developers Google Groups forum](https://groups.google.com/forum/m/#!forum/premake-development).
### Report isssues
Something not working quite as expected? Do you need a feature that has not been implemented yet? Check the [issue tracker](https://github.com/premake/premake-core/issues) and add a new one if your problem is not already listed. Please try to provide a detailed description of your problem, including the steps to reproduce it.
### Contribute
Awesome! If you would like to contribute with a new feature or submit a bugfix, fork this repo and send a pull request. Please, make sure all the [unit tests](https://github.com/premake/premake-core/wiki/Unit-Tests) are passing before submitting and add new ones in case you introduced new features.
### Copyright & License
Copyright &copy; 2002-2015 by Jason Perkins
Distributed under the terms of the BSD License, see LICENSE.txt
The Lua language and runtime library is &copy; TeCGraf, PUC-Rio.
See their website at http://www.lua.org/

@ -1 +1 @@
Subproject commit d6bd3883aa32769eda24f98f5ad6631e7679a67d
Subproject commit 287ffc60d66ec36f9120061ddcc9ff44a6950c6f

@ -1 +1 @@
Subproject commit d037ed35a215d32222e3dfac443534330df49f52
Subproject commit cf4733d42b1d821b19aeb0441937274df96e4c16

@ -1 +1 @@
Subproject commit 1606eac28158c41c0dd828b8c278cd31c82899b2
Subproject commit b883ba45c05f7065456029591e742096fbf53526

View File

@ -62,7 +62,7 @@
linkoptions { "-rdynamic" }
configuration "linux or hurd"
links { "dl" }
links { "dl", "rt" }
configuration "macosx"
defines { "LUA_USE_MACOSX" }

View File

@ -17,13 +17,6 @@
premake.api.deprecations "off"
--
-- Enable contrib support for 3rd party libraries
-- Curl includes support for http / https downloads
-- Compression will eventually include support for ZLib / Zip
local ENABLE_CURL = false
local ENABLE_COMPRESSION = true
--
-- Register supporting actions and options.
@ -69,6 +62,18 @@
}
newoption {
trigger = "no-curl",
description = "Disable Curl 3rd party lib"
}
newoption {
trigger = "no-zlib",
description = "Disable Zlib/Zip 3rd party lib"
}
--
-- Define the project. Put the release configuration first so it will be the
@ -88,12 +93,14 @@
kind "ConsoleApp"
flags { "No64BitChecks", "ExtraWarnings", "StaticRuntime" }
includedirs { "src/host/lua-5.1.4/src" }
if ENABLE_COMPRESSION then
-- optional 3rd party libraries
if not _OPTIONS["no-zlib"] then
includedirs { "contrib/zlib", "contrib/libzip" }
defines { "PREMAKE_COMPRESSION" }
links { "zip-lib", "zlib-lib" }
end
if ENABLE_CURL then
if not _OPTIONS["no-curl"] then
includedirs { "contrib/curl/include" }
defines { "CURL_STATICLIB", "PREMAKE_CURL" }
links { "curl-lib" }
@ -143,7 +150,7 @@
linkoptions { "-rdynamic" }
configuration "linux or hurd"
links { "dl" }
links { "dl", "rt" }
configuration "macosx"
defines { "LUA_USE_MACOSX" }
@ -161,15 +168,17 @@
defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
links { "m" }
-- optional 3rd party libraries
group "contrib"
if not _OPTIONS["no-zlib"] then
include "contrib/zlib"
include "contrib/libzip"
end
if not _OPTIONS["no-curl"] then
include "contrib/curl"
end
group 'contrib'
if ENABLE_COMPRESSION then
include 'contrib/zlib'
include 'contrib/libzip'
end
if ENABLE_CURL then
include 'contrib/curl'
end
--
-- A more thorough cleanup.
--

View File

@ -37,7 +37,7 @@
-- project objects
"base/global.lua",
"base/solution.lua",
"base/workspace.lua",
"base/group.lua",
"base/project.lua",
"base/config.lua",

View File

@ -250,6 +250,17 @@
}
}
api.register {
name = "debuggertype",
scope = "config",
kind = "string",
allowed = {
"Mixed",
"NativeOnly",
"ManagedOnly",
}
}
api.register {
name = "debugpathmap",
scope = "config",
@ -381,6 +392,12 @@
},
}
api.register {
name = "entrypoint",
scope = "config",
kind = "string",
}
api.register {
name = "fatalwarnings",
scope = "config",
@ -1011,6 +1028,9 @@
"AVX2",
"SSE",
"SSE2",
"SSE3",
"SSSE3",
"SSE4.1",
}
}

View File

@ -108,10 +108,9 @@
preloader = os.locate("modules/" .. preloader) or os.locate(preloader)
if preloader then
m._preloaded[name] = include(preloader)
-- leave off until existing core modules can catch up
-- if not m._preloaded[name] then
-- p.warn("module '%s' should return function from _preload.lua", name)
-- end
if not m._preloaded[name] then
p.warn("module '%s' should return function from _preload.lua", name)
end
else
require(name)
end

View File

@ -1,7 +1,7 @@
--
-- _make.lua
-- Define the makefile action(s).
-- Copyright (c) 2002-2013 Jason Perkins and the Premake project
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
--
premake.make = {}
@ -28,9 +28,9 @@
dotnet = { "mono", "msnet", "pnet" }
},
onSolution = function(sln)
onWorkspace = function(wks)
premake.escaper(make.esc)
premake.generate(sln, make.getmakefilename(sln, false), make.generate_solution)
premake.generate(wks, make.getmakefilename(wks, false), make.generate_solution)
end,
onProject = function(prj)
@ -43,8 +43,8 @@
end
end,
onCleanSolution = function(sln)
premake.clean.file(sln, make.getmakefilename(sln, false))
onCleanWorkspace = function(wks)
premake.clean.file(wks, make.getmakefilename(wks, false))
end,
onCleanProject = function(prj)

View File

@ -26,26 +26,28 @@
-- Generate a GNU make C++ project makefile, with support for the new platforms API.
--
cpp.elements.makefile = {
"header",
"phonyRules",
"cppConfigs",
"cppObjects",
"shellType",
"cppTargetRules",
"targetDirRules",
"objDirRules",
"cppCleanRules",
"preBuildRules",
"preLinkRules",
"pchRules",
"cppFileRules",
"cppDependencies",
}
cpp.elements.makefile = function(prj)
return {
make.header,
make.phonyRules,
make.cppConfigs,
make.cppObjects,
make.shellType,
make.cppTargetRules,
make.targetDirRules,
make.objDirRules,
make.cppCleanRules,
make.preBuildRules,
make.preLinkRules,
make.pchRules,
make.cppFileRules,
make.cppDependencies,
}
end
function make.cpp.generate(prj)
premake.eol("\n")
premake.callarray(make, cpp.elements.makefile, prj)
premake.callArray(cpp.elements.makefile, prj)
end
@ -53,28 +55,30 @@
-- Write out the settings for a particular configuration.
--
cpp.elements.configuration = {
"cppTools",
"target",
"objdir",
"pch",
"defines",
"includes",
"forceInclude",
"cppFlags",
"cFlags",
"cxxFlags",
"resFlags",
"libs",
"ldDeps",
"ldFlags",
"linkCmd",
"preBuildCmds",
"preLinkCmds",
"postBuildCmds",
"cppAllRules",
"settings",
}
cpp.elements.configuration = function(cfg)
return {
make.cppTools,
make.target,
make.objdir,
make.pch,
make.defines,
make.includes,
make.forceInclude,
make.cppFlags,
make.cFlags,
make.cxxFlags,
make.resFlags,
make.libs,
make.ldDeps,
make.ldFlags,
make.linkCmd,
make.preBuildCmds,
make.preLinkCmds,
make.postBuildCmds,
make.cppAllRules,
make.settings,
}
end
function make.cppConfigs(prj)
for cfg in project.eachconfig(prj) do
@ -87,7 +91,7 @@
end
_x('ifeq ($(config),%s)', cfg.shortname)
premake.callarray(make, cpp.elements.configuration, cfg, toolset)
premake.callArray(cpp.elements.configuration, cfg, toolset)
_p('endif')
_p('')
end

View File

@ -23,26 +23,28 @@
-- Generate a GNU make C++ project makefile, with support for the new platforms API.
--
cs.elements.makefile = {
"header",
"phonyRules",
"csConfigs",
"csProjectConfig",
"csSources",
"csEmbedFiles",
"csCopyFiles",
"csResponseFile",
"shellType",
"csAllRules",
"csTargetRules",
"targetDirRules",
"csResponseRules",
"objDirRules",
"csCleanRules",
"preBuildRules",
"preLinkRules",
"csFileRules",
}
cs.elements.makefile = function(prj)
return {
make.header,
make.phonyRules,
make.csConfigs,
make.csProjectConfig,
make.csSources,
make.csEmbedFiles,
make.csCopyFiles,
make.csResponseFile,
make.shellType,
make.csAllRules,
make.csTargetRules,
make.targetDirRules,
make.csResponseRules,
make.objDirRules,
make.csCleanRules,
make.preBuildRules,
make.preLinkRules,
make.csFileRules,
}
end
--
@ -52,7 +54,7 @@
function make.cs.generate(prj)
premake.eol("\n")
local toolset = premake.tools.dotnet
premake.callarray(make, cs.elements.makefile, prj, toolset)
premake.callArray(cs.elements.makefile, prj, toolset)
end
@ -60,22 +62,24 @@
-- Write out the settings for a particular configuration.
--
cs.elements.configuration = {
"csTools",
"target",
"objdir",
"csFlags",
"csLinkCmd",
"preBuildCmds",
"preLinkCmds",
"postBuildCmds",
"settings",
}
cs.elements.configuration = function(cfg)
return {
make.csTools,
make.target,
make.objdir,
make.csFlags,
make.csLinkCmd,
make.preBuildCmds,
make.preLinkCmds,
make.postBuildCmds,
make.settings,
}
end
function make.csConfigs(prj, toolset)
for cfg in project.eachconfig(prj) do
_x('ifeq ($(config),%s)', cfg.shortname)
premake.callarray(make, cs.elements.configuration, cfg, toolset)
premake.callArray(cs.elements.configuration, cfg, toolset)
_p('endif')
_p('')
end

View File

@ -96,12 +96,12 @@
-- Solution and project generation logic
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2005.generateProject,
onWorkspace = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2005.generateProject,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
onCleanWorkspace = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -33,7 +33,7 @@
}
function cs2005.generate(prj)
io.utf8()
p.utf8()
premake.callarray(cs2005, cs2005.elements.project, prj)

View File

@ -35,12 +35,12 @@
-- Solution and project generation logic
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2005.generateProject,
onWorkspace = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2005.generateProject,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
onCleanWorkspace = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -112,7 +112,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
@ -121,8 +121,8 @@
-- Solution and project generation logic
onSolution = function(sln)
vstudio.vs2005.generateSolution(sln)
onWorkspace = function(wks)
vstudio.vs2005.generateSolution(wks)
end,
onProject = function(prj)
vstudio.vs2010.generateProject(prj)
@ -131,8 +131,8 @@
vstudio.vs2010.generateRule(rule)
end,
onCleanSolution = function(sln)
vstudio.cleanSolution(sln)
onCleanWorkspace = function(wks)
vstudio.cleanSolution(wks)
end,
onCleanProject = function(prj)
vstudio.cleanProject(prj)

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,7 @@
m.localDebuggerWorkingDirectory,
m.debuggerFlavor,
m.localDebuggerCommandArguments,
m.localDebuggerDebuggerType,
m.localDebuggerEnvironment,
m.localDebuggerMergeEnvironment,
}
@ -93,6 +94,12 @@
end
function m.localDebuggerDebuggerType(cfg)
if cfg.debuggertype then
p.w('<LocalDebuggerDebuggerType>%s</LocalDebuggerDebuggerType>', cfg.debuggertype)
end
end
function m.localDebuggerCommandArguments(cfg)
if #cfg.debugargs > 0 then

View File

@ -28,7 +28,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
@ -37,15 +37,18 @@
-- Solution and project generation logic
onSolution = function(sln)
vstudio.vs2005.generateSolution(sln)
onWorkspace = function(wks)
vstudio.vs2005.generateSolution(wks)
end,
onProject = function(prj)
vstudio.vs2010.generateProject(prj)
end,
onRule = function(rule)
vstudio.vs2010.generateRule(rule)
end,
onCleanSolution = function(sln)
vstudio.cleanSolution(sln)
onCleanWorkspace = function(wks)
vstudio.cleanSolution(wks)
end,
onCleanProject = function(prj)
vstudio.cleanProject(prj)

View File

@ -30,7 +30,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
@ -39,15 +39,18 @@
-- Solution and project generation logic
onSolution = function(sln)
vstudio.vs2005.generateSolution(sln)
onWorkspace = function(wks)
vstudio.vs2005.generateSolution(wks)
end,
onProject = function(prj)
vstudio.vs2010.generateProject(prj)
end,
onRule = function(rule)
vstudio.vs2010.generateRule(rule)
end,
onCleanSolution = function(sln)
vstudio.cleanSolution(sln)
onCleanWorkspace = function(wks)
vstudio.cleanSolution(wks)
end,
onCleanProject = function(prj)
vstudio.cleanProject(prj)

View File

@ -30,7 +30,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },
@ -39,15 +39,18 @@
-- Solution and project generation logic
onSolution = function(sln)
vstudio.vs2005.generateSolution(sln)
onWorkspace = function(wks)
vstudio.vs2005.generateSolution(wks)
end,
onProject = function(prj)
vstudio.vs2010.generateProject(prj)
end,
onRule = function(rule)
vstudio.vs2010.generateRule(rule)
end,
onCleanSolution = function(sln)
vstudio.cleanSolution(sln)
onCleanWorkspace = function(wks)
vstudio.cleanSolution(wks)
end,
onCleanProject = function(prj)
vstudio.cleanProject(prj)

View File

@ -17,6 +17,9 @@
local _warnings = {}
-- Keep track of aliased functions, so I can resolve to canonical names
local _aliases = {}
--
-- Define some commonly used symbols, for future-proofing.
@ -51,6 +54,36 @@
---
-- Provide an alias for a function in a namespace. Calls to the alias will
-- invoke the canonical function, and attempts to override the alias will
-- instead override the canonical call.
--
-- @param scope
-- The table containing the function to be overridden. Use _G for
-- global functions.
-- @param canonical
-- The name of the function to be aliased (a string value)
-- @param alias
-- The new alias for the function (another string value).
---
function p.alias(scope, canonical, alias)
scope, canonical = p.resolveAlias(scope, canonical)
if not scope[canonical] then
error("unable to alias '" .. canonical .. "'; no such function", 2)
end
_aliases[scope] = _aliases[scope] or {}
_aliases[scope][alias] = canonical
scope[alias] = function(...)
return scope[canonical](...)
end
end
---
-- Call a list of functions.
--
@ -230,10 +263,13 @@
---
function premake.override(scope, name, repl)
scope, name = p.resolveAlias(scope, name)
local original = scope[name]
if not original then
error("unable to override '" .. name .. "'; no such function", 2)
end
scope[name] = function(...)
return repl(original, ...)
end
@ -253,6 +289,30 @@
---
-- Find the canonical name and scope of a function, resolving any aliases.
--
-- @param scope
-- The table containing the function to be overridden. Use _G for
-- global functions.
-- @param name
-- The name of the function to resolve.
-- @return
-- The canonical scope and function name (a string value).
---
function p.resolveAlias(scope, name)
local aliases = _aliases[scope]
if aliases then
while aliases[name] do
name = aliases[name]
end
end
return scope, name
end
--
-- Display a warning, with a formatted message built from the provided
-- arguments.

View File

@ -73,20 +73,20 @@
---
function action.call(name)
local act = action._list[name]
local a = action._list[name]
if act.onStart then
act.onStart()
if a.onStart then
a.onStart()
end
for sln in p.global.eachSolution() do
local onSolution = act.onSolution or act.onsolution
if onSolution then
local onSolution = a.onWorkspace or a.onSolution or a.onsolution
if onSolution and not sln.external then
onSolution(sln)
end
for prj in p.solution.eachproject(sln) do
local onProject = act.onProject or act.onproject
local onProject = a.onProject or a.onproject
if onProject and not prj.external then
onProject(prj)
end
@ -94,18 +94,18 @@
end
for rule in p.global.eachRule() do
local onRule = act.onRule or act.onrule
if onRule then
local onRule = a.onRule or a.onrule
if onRule and not rule.external then
onRule(rule)
end
end
if act.execute then
act.execute()
if a.execute then
a.execute()
end
if act.onEnd then
act.onEnd()
if a.onEnd then
a.onEnd()
end
end
@ -214,7 +214,11 @@
-- True if the feature is supported, false otherwise.
---
function action.supports(self, feature)
function action.supports(feature)
if not feature then
return true
end
local self = action.current()
if not self then
return false
end
@ -232,11 +236,11 @@
end
--
--
-- Determines if an action supports a particular configuration.
-- @return
-- True if the configuration is supported, false otherwise.
--
--
function premake.action.supportsconfig(action, cfg)
if not action then
return false

View File

@ -743,23 +743,20 @@
premake.field.kind("directory", {
paths = true,
store = function(field, current, value, processor)
if string.sub(value, 1, 2) == "%{" then
return value
elseif value:find("*") then
value = os.matchdirs(value)
for i, file in ipairs(value) do
value[i] = path.getabsolute(value[i])
end
return value
else
return path.getabsolute(value)
end
return path.getabsolute(value)
end,
remove = function(field, current, value, processor)
return path.getabsolute(value)
end,
compare = function(field, a, b, processor)
return (a == b)
end,
translate = function(field, current, _, processor)
if current:find("*") then
return os.matchdirs(current)
end
return { current }
end
})
@ -773,23 +770,20 @@
premake.field.kind("file", {
paths = true,
store = function(field, current, value, processor)
if string.sub(value, 1, 2) == "%{" then
return value
elseif value:find("*") then
value = os.matchfiles(value)
for i, file in ipairs(value) do
value[i] = path.getabsolute(value[i])
end
return value
else
return path.getabsolute(value)
end
return path.getabsolute(value)
end,
remove = function(field, current, value, processor)
return path.getabsolute(value)
end,
compare = function(field, a, b, processor)
return (a == b)
end,
translate = function(field, current, _, processor)
if current:find("*") then
return os.matchfiles(current)
end
return { current }
end
})
@ -877,6 +871,16 @@
end
end
return true
end,
translate = function(field, current, _, processor)
if not processor then
return { current }
end
for k, v in pairs(current) do
current[k] = processor(field, v, nil)[1]
end
return { current }
end
})
@ -957,6 +961,19 @@
end
end
return true
end,
translate = function(field, current, _, processor)
if not processor then
return { current }
end
local ret = {}
for _, value in ipairs(current) do
for _, processed in ipairs(processor(field, value, nil)) do
table.insert(ret, processed)
end
end
return { ret }
end
})

View File

@ -56,27 +56,30 @@
-- The configuration set to query.
-- @param field
-- The definition of field to be queried.
-- @param context
-- @param filter
-- A list of lowercase context terms to use during the fetch. Only those
-- blocks with terms fully contained by this list will be considered in
-- determining the returned value. Terms should be lower case to make
-- the context filtering case-insensitive.
-- @param ctx
-- The context that will be used for detoken.expand
-- @return
-- The requested value.
---
function configset.fetch(cset, field, context)
context = context or {}
function configset.fetch(cset, field, filter, ctx)
filter = filter or {}
ctx = ctx or {}
if p.field.merges(field) then
return configset._fetchMerged(cset, field, context)
return configset._fetchMerged(cset, field, filter, ctx)
else
return configset._fetchDirect(cset, field, context)
return configset._fetchDirect(cset, field, filter, ctx)
end
end
function configset._fetchDirect(cset, field, filter)
function configset._fetchDirect(cset, field, filter, ctx)
local abspath = filter.files
local basedir
@ -101,6 +104,11 @@
if type(value) == "table" then
value = table.deepcopy(value)
end
-- Detoken
if field.tokens and ctx.environ then
value = p.detoken.expand(value, ctx.environ, field, ctx._basedir)
end
return value
end
end
@ -108,17 +116,21 @@
filter.files = abspath
if cset.parent then
return configset._fetchDirect(cset.parent, field, filter)
return configset._fetchDirect(cset.parent, field, filter, ctx)
end
end
function configset._fetchMerged(cset, field, filter)
function configset._fetchMerged(cset, field, filter, ctx)
local result = {}
local function remove(patterns)
for i = 1, #patterns do
local pattern = patterns[i]
for _, pattern in ipairs(patterns) do
-- Detoken
if field.tokens and ctx.environ then
pattern = p.detoken.expand(pattern, ctx.environ, field, ctx._basedir)
end
pattern = path.wildcards(pattern):lower()
local j = 1
while j <= #result do
@ -134,7 +146,7 @@
end
if cset.parent then
result = configset._fetchMerged(cset.parent, field, filter)
result = configset._fetchMerged(cset.parent, field, filter, ctx)
end
local abspath = filter.files
@ -159,7 +171,23 @@
end
local value = block[key]
-- If value is an object, return a copy of it so that any
-- changes later made to it by the caller won't alter the
-- original value (that was a tough bug to find)
if type(value) == "table" then
value = table.deepcopy(value)
end
if value then
-- Detoken
if field.tokens and ctx.environ then
value = p.detoken.expand(value, ctx.environ, field, ctx._basedir)
end
-- Translate
if field and p.field.translates(field) then
value = p.field.translate(field, value)
end
result = p.field.merge(field, result, value)
end
end
@ -328,6 +356,7 @@
table.insert(cset.blocks, block)
cset.current = block
-- TODO This comment is not completely valid anymore
-- This needs work; right now it is hardcoded to only work for lists.
-- To support removing from keyed collections, I first need to figure
-- out how to move the wildcard():lower() bit into the value
@ -338,11 +367,6 @@
-- api.remove() needs to get pushed down to here (or field).
values = p.field.remove(field, {}, values)
for i, value in ipairs(values) do
if type(value) == "string" then
values[i] = path.wildcards(value):lower()
end
end
-- add a list of removed values to the block
current = cset.current

View File

@ -172,13 +172,8 @@
-- If there is a matching field, then go fetch the aggregated value
-- from my configuration set, and then cache it future lookups.
local value = configset.fetch(ctx._cfgset, field, ctx.terms)
local value = configset.fetch(ctx._cfgset, field, ctx.terms, ctx)
if value then
-- do I need to expand tokens?
if field and field.tokens then
value = p.detoken.expand(value, ctx.environ, field, ctx._basedir)
end
-- store the result for later lookups
ctx[key] = value
end

View File

@ -78,6 +78,7 @@
if type(result) == "function" then
result = result(environ)
end
isAbs = path.isabsolute(result)
end
-- If the result is an absolute path, and it is being inserted into
@ -104,7 +105,7 @@
function expandvalue(value)
if type(value) ~= "string" then
return
return value
end
local count
@ -134,10 +135,18 @@
function recurse(value)
if type(value) == "table" then
local res_table = {}
for k, v in pairs(value) do
value[k] = recurse(v)
if tonumber(k) ~= nil then
res_table[k] = recurse(v, e)
else
local nk = recurse(k, e);
res_table[nk] = recurse(v, e)
end
end
return value
return res_table
else
return expandvalue(value)
end

View File

@ -371,3 +371,20 @@
return value
end
end
function field.translate(f, value)
local processor = field.accessor(f, "translate")
if processor then
return processor(f, value, nil)[1]
else
return value
end
end
function field.translates(f)
return (field.accessor(f, "translate") ~= nil)
end

View File

@ -20,12 +20,3 @@
end
return base(fname, mode)
end)
--
-- Output a UTF-8 signature.
--
function io.utf8()
io.write('\239\187\191')
end

View File

@ -84,6 +84,7 @@
self.environ = {
sln = self,
wks = self,
}
context.compile(self)
@ -142,6 +143,7 @@
self.environ = {
sln = sln,
wks = sln,
prj = self,
}
@ -316,7 +318,8 @@
-- fill in any calculated values
for _, cfg in ipairs(configs) do
cfg.solution = sln
cfg.solution = sln -- confused: doesn't happen automatically already?
cfg.workspace = sln
oven.finishConfig(cfg)
end
@ -364,13 +367,8 @@
if not field then
ctx[key] = rawget(ctx, key)
else
local value = p.configset.fetch(cset, field, terms)
local value = p.configset.fetch(cset, field, terms, ctx)
if value then
-- do I need to expand tokens?
if field and field.tokens then
value = p.detoken.expand(value, ctx.environ, field, ctx._basedir)
end
ctx[key] = value
end
end
@ -456,6 +454,7 @@
local environ = {
sln = prj.solution,
wks = prj.solution,
prj = prj,
}

View File

@ -304,6 +304,18 @@ end
--
-- Output a UTF-8 BOM to the exported file.
--
function premake.utf8()
if not _captured then
premake.out('\239\187\191')
end
end
---
-- Write a formatted string to the exported file, at the current
-- level of indentation, and appends an end of line sequence.

View File

@ -74,6 +74,21 @@
end
--
-- Enumerates an array of objects and returns a new table containing
-- only the values satisfying the given predicate.
--
function table.filter(arr, fn)
local result = { }
table.foreachi(arr, function(val)
if fn(val) then
table.insert(result, val)
end
end)
return result
end
--
-- Flattens a hierarchy of tables into a single array containing all
@ -201,7 +216,7 @@
--
-- Inserts a value of array of values into a table. If the value is
-- Inserts a value or array of values into a table. If the value is
-- itself a table, its contents are enumerated and added instead. So
-- these inputs give these outputs:
--
@ -224,6 +239,55 @@
end
--
-- Inserts a value into a table as both a list item and a key-value pair.
-- Useful for set operations.
--
function table.insertkeyed(tbl, pos, value)
if value == nil then
value = pos
pos = #tbl + 1
end
table.insert(tbl, pos, value)
tbl[value] = value
end
--
-- Inserts a value into a table in sorted order. Assumes that the
-- table is already sorted according to the sort function. If fn is
-- nil, the table is sorted according to the < operator.
--
function table.insertsorted(tbl, value, fn)
if value == nil then
return
else
fn = fn or function(a, b) return a < b end
local minindex = 1
local maxindex = #tbl + 1
while minindex < maxindex do
local index = minindex + bit32.arshift(maxindex - minindex, 1)
local test = tbl[index]
if fn(value, test) then
maxindex = index
else
minindex = index + 1
if not fn(test, value) then
break
end
end
end
table.insert(tbl, minindex, value)
end
return tbl
end
--
-- Returns true if the table is empty, and contains no indexed or keyed values.
--
@ -398,6 +462,23 @@
return res
end
--
-- Returns a copy of a list with all duplicate elements removed.
--
function table.unique(tab)
local elems = { }
local result = { }
table.foreachi(tab, function(elem)
if not elems[elem] then
table.insert(result, elem)
elems[elem] = true
end
end)
return result
end
--
-- Filters a table for empty entries. primarly useful for lists of string.
--

View File

@ -55,6 +55,14 @@
p.error("project '%s' does not have a language", self.name)
end
if not p.action.supports(self.language) then
p.warn("unsupported language '%s' used for project '%s'", self.language, self.name)
end
if not p.action.supports(self.kind) then
p.warn("unsupported kind '%s' used for project '%s'", self.kind, self.name)
end
-- all rules must exist
for i = 1, #self.rules do
local rule = self.rules[i]

View File

@ -1,67 +1,71 @@
---
-- solution.lua
-- Work with the list of solutions loaded from the script.
-- workspace.lua
-- Work with the list of workspaces loaded from the script.
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
---
local p = premake
p.solution = p.api.container("solution", p.global)
local solution = p.solution
local tree = p.tree
---
-- Begin the switch from solution() to workspace()
---
p.workspace = p.solution
local workspace = p.solution
p.alias(_G, "solution", "workspace")
p.alias(_G, "externalsolution", "externalworkspace")
---
-- Create a new solution container instance.
-- Create a new workspace container instance.
---
function solution.new(name)
local sln = p.container.new(solution, name)
return sln
function workspace.new(name)
local wks = p.container.new(workspace, name)
return wks
end
--
-- Iterate over the configurations of a solution.
-- Iterate over the configurations of a workspace.
--
-- @param sln
-- The solution to query.
-- @return
-- A configuration iteration function.
--
function solution.eachconfig(sln)
sln = premake.oven.bakeSolution(sln)
function workspace.eachconfig(self)
self = premake.oven.bakeSolution(self)
local i = 0
return function()
i = i + 1
if i > #sln.configs then
if i > #self.configs then
return nil
else
return sln.configs[i]
return self.configs[i]
end
end
end
--
-- Iterate over the projects of a solution (next-gen).
-- Iterate over the projects of a workspace.
--
-- @param sln
-- The solution.
-- @return
-- An iterator function, returning project configurations.
--
function solution.eachproject(sln)
function workspace.eachproject(self)
local i = 0
return function ()
i = i + 1
if i <= #sln.projects then
return premake.solution.getproject(sln, i)
if i <= #self.projects then
return p.workspace.getproject(self, i)
end
end
end
@ -70,17 +74,15 @@
--
-- Locate a project by name, case insensitive.
--
-- @param sln
-- The solution to query.
-- @param name
-- The name of the projec to find.
-- @return
-- The project object, or nil if a matching project could not be found.
--
function solution.findproject(sln, name)
function workspace.findproject(self, name)
name = name:lower()
for _, prj in ipairs(sln.projects) do
for _, prj in ipairs(self.projects) do
if name == prj.name:lower() then
return prj
end
@ -92,35 +94,33 @@
--
-- Retrieve the tree of project groups.
--
-- @param sln
-- The solution to query.
-- @return
-- The tree of project groups defined for the solution.
-- The tree of project groups defined for the workspace.
--
function solution.grouptree(sln)
function workspace.grouptree(self)
-- check for a previously cached tree
if sln.grouptree then
return sln.grouptree
if self.grouptree then
return self.grouptree
end
-- build the tree of groups
local tr = tree.new()
for prj in solution.eachproject(sln) do
local tr = p.tree.new()
for prj in workspace.eachproject(self) do
local prjpath = path.join(prj.group, prj.name)
local node = tree.add(tr, prjpath)
local node = p.tree.add(tr, prjpath)
node.project = prj
end
-- assign UUIDs to each node in the tree
tree.traverse(tr, {
p.tree.traverse(tr, {
onnode = function(node)
node.uuid = os.uuid(node.path)
end
})
sln.grouptree = tr
self.grouptree = tr
return tr
end
@ -128,26 +128,22 @@
--
-- Retrieve the project configuration at a particular index.
--
-- @param sln
-- The solution.
-- @param idx
-- An index into the array of projects.
-- @return
-- The project configuration at the given index.
--
function solution.getproject(sln, idx)
sln = premake.oven.bakeSolution(sln)
return sln.projects[idx]
function workspace.getproject(self, idx)
self = p.oven.bakeSolution(self)
return self.projects[idx]
end
---
-- Determines if the solution contains a project that meets certain criteria.
-- Determines if the workspace contains a project that meets certain criteria.
--
-- @param self
-- The solution.
-- @param func
-- A test function. Receives a project as its only argument and returns a
-- boolean indicating whether it meets to matching criteria.
@ -155,6 +151,6 @@
-- True if the test function returned true.
---
function solution.hasProject(self, func)
function workspace.hasProject(self, func)
return p.container.hasChild(self, p.project, func)
end

View File

@ -5,7 +5,7 @@
*/
#include "premake.h"
#include "stdlib.h"
#include <stdlib.h>
#ifdef PREMAKE_CURL
@ -47,8 +47,8 @@ static int curl_progress_cb(void* userdata, double dltotal, double dlnow,
/* retrieve the lua progress callback we saved before */
lua_rawgeti(L, LUA_REGISTRYINDEX, state->RefIndex);
lua_pushnumber(L, dltotal);
lua_pushnumber(L, dlnow);
lua_pushnumber(L, (lua_Number)dltotal);
lua_pushnumber(L, (lua_Number)dlnow);
lua_pcall(L, 2, LUA_MULTRET, 0);
return 0;
@ -75,6 +75,13 @@ static size_t curl_write_cb(char *ptr, size_t size, size_t nmemb, void *userdata
return size * nmemb;
}
static size_t curl_file_cb(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
return fwrite(ptr, size, nmemb, stream);
}
static void curl_init()
{
static int initializedHTTP = 0;
@ -87,9 +94,35 @@ static void curl_init()
initializedHTTP = 1;
}
CURL * curl_request(lua_State* L, CurlCallbackState* state, FILE* fp, int progressFnIndex)
static void get_headers(lua_State* L, struct curl_slist** headers)
{
int i;
int argc = lua_gettop(L);
// Headers are optional so loop through them if they exist(also indexed 1 -> N instead of 0 -> N-1 in lua)
for (i = 3; i <= argc; ++i)
{
if (lua_istable(L, -1))
{
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
const char *item = luaL_checkstring(L, -1);
lua_pop(L, 1);
*headers = curl_slist_append(*headers, item);
}
// Only expect a single table as a parameter so break after reading it
break;
}
}
}
static CURL* curl_request(lua_State* L, CurlCallbackState* state, FILE* fp, int progressFnIndex)
{
CURL* curl;
struct curl_slist* headers = NULL;
const char* url = luaL_checkstring(L, 1);
/* if the second argument is a lua function, then we save it
@ -110,6 +143,10 @@ CURL * curl_request(lua_State* L, CurlCallbackState* state, FILE* fp, int progre
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
get_headers(L, &headers);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, state);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write_cb);
@ -117,7 +154,7 @@ CURL * curl_request(lua_State* L, CurlCallbackState* state, FILE* fp, int progre
if (fp)
{
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_file_cb);
}
if (state->L != 0)
@ -130,6 +167,7 @@ CURL * curl_request(lua_State* L, CurlCallbackState* state, FILE* fp, int progre
return curl;
}
int http_get(lua_State* L)
{
CurlCallbackState state = { 0, 0 };
@ -163,14 +201,13 @@ int http_get(lua_State* L)
return 1;
}
int http_download(lua_State* L)
{
CurlCallbackState state = { 0, 0 };
CURL* curl;
CURLcode code;
const char* err;
CURLcode code = CURLE_FAILED_INIT;
FILE* fp;
const char* file = luaL_checkstring(L, 2);
@ -178,32 +215,23 @@ int http_download(lua_State* L)
fp = fopen(file, "wb");
if (!fp)
{
lua_pushnil(L);
lua_pushfstring(L, "could not open file");
lua_pushstring(L, "Unable to open file.");
lua_pushnumber(L, -1);
return 2;
}
curl = curl_request(L, &state, fp, /*progressFnIndex=*/3);
if (!curl)
if (curl)
{
lua_pushnil(L);
return 1;
code = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
code = curl_easy_perform(curl);
if (code != CURLE_OK)
{
err = curl_easy_strerror(code);
fclose(fp);
lua_pushnil(L);
lua_pushfstring(L, err);
return 2;
}
curl_easy_cleanup(curl);
return 0;
lua_pushstring(L, curl_easy_strerror(code));
lua_pushnumber(L, code);
return 2;
}
#endif

View File

@ -5,29 +5,74 @@
*/
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include "premake.h"
#if PLATFORM_WINDOWS
#include <direct.h>
#include <errno.h>
#endif
int do_mkdir(const char* path)
{
struct stat sb;
char sub_path[1024];
int i, length;
// if it already exists, return.
if (stat(path, &sb) == 0)
return 1;
// find the parent folder name.
length = strlen(path);
for (i = length - 1; i >= 0; --i)
{
if (path[i] == '/' || path[i] == '\\')
break;
}
// if we found one, create it.
if (i > 0)
{
memcpy(sub_path, path, i);
sub_path[i] = '\0';
#if PLATFORM_WINDOWS
if (sub_path[i - 1] == ':')
{
sub_path[i + 0] = '/';
sub_path[i + 1] = '\0';
}
#endif
if (!do_mkdir(sub_path))
return 0;
}
// now finally create the actual folder we want.
#if PLATFORM_WINDOWS
return _mkdir(path) == 0;
#else
return mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0;
#endif
}
int os_mkdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = CreateDirectory(path, NULL);
#else
z = (mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0);
#endif
int z = do_mkdir(path);
if (!z)
{
lua_pushnil(L);
lua_pushfstring(L, "unable to create directory '%s'", path);
return 2;
}
else
{
lua_pushboolean(L, 1);
return 1;
}
lua_pushboolean(L, 1);
return 1;
}

View File

@ -94,6 +94,13 @@ static const luaL_Reg http_functions[] = {
};
#endif
#ifdef PREMAKE_COMPRESSION
static const luaL_Reg zip_functions[] = {
{ "extract", zip_extract },
{ NULL, NULL }
};
#endif
/**
* Initialize the Premake Lua environment.
*/
@ -111,6 +118,10 @@ int premake_init(lua_State* L)
luaL_register(L, "http", http_functions);
#endif
#ifdef PREMAKE_COMPRESSION
luaL_register(L, "zip", zip_functions);
#endif
/* push the application metadata */
lua_pushstring(L, LUA_COPYRIGHT);
lua_setglobal(L, "_COPYRIGHT");

View File

@ -127,6 +127,10 @@ int http_get(lua_State* L);
int http_download(lua_State* L);
#endif
#ifdef PREMAKE_COMPRESSION
int zip_extract(lua_State* L);
#endif
/* Engine interface */
int premake_init(lua_State* L);
int premake_execute(lua_State* L, int argc, const char** argv, const char* script);

231
src/host/zip_extract.c Normal file
View File

@ -0,0 +1,231 @@
/**
* \file os_unzip.c
* \brief Unzip file using libzip library.
* \author battle.net -- abrunasso.int@blizzard.com
*/
#include "premake.h"
#ifdef PREMAKE_COMPRESSION
#include <zip.h>
#ifdef WIN32
#include <direct.h>
#include <io.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
// File Attribute for Unix
#define FA_IFIFO 0010000 /* named pipe (fifo) */
#define FA_IFCHR 0020000 /* character special */
#define FA_IFDIR 0040000 /* directory */
#define FA_IFBLK 0060000 /* block special */
#define FA_IFREG 0100000 /* regular */
#define FA_IFLNK 0120000 /* symbolic link */
#define FA_IFSOCK 0140000 /* socket */
#define FA_ISUID 0004000 /* set user id on execution */
#define FA_ISGID 0002000 /* set group id on execution */
#define FA_ISTXT 0001000 /* sticky bit */
#define FA_IRWXU 0000700 /* RWX mask for owner */
#define FA_IRUSR 0000400 /* R for owner */
#define FA_IWUSR 0000200 /* W for owner */
#define FA_IXUSR 0000100 /* X for owner */
#define FA_IRWXG 0000070 /* RWX mask for group */
#define FA_IRGRP 0000040 /* R for group */
#define FA_IWGRP 0000020 /* W for group */
#define FA_IXGRP 0000010 /* X for group */
#define FA_IRWXO 0000007 /* RWX mask for other */
#define FA_IROTH 0000004 /* R for other */
#define FA_IWOTH 0000002 /* W for other */
#define FA_IXOTH 0000001 /* X for other */
#define FA_ISVTX 0001000 /* save swapped text even after use */
// ----------------------------------------------------------------------------
static int is_symlink(zip_uint8_t opsys, zip_uint32_t attrib)
{
if (opsys == ZIP_OPSYS_DOS)
return (attrib & 0x400) == 0x400; // FILE_ATTRIBUTE_REPARSE_POINT
if (opsys == ZIP_OPSYS_UNIX)
return ((attrib >> 16) & FA_IFLNK) == FA_IFLNK;
return 0;
}
static int is_directory(zip_uint8_t opsys, zip_uint32_t attrib)
{
if (opsys == ZIP_OPSYS_DOS)
return (attrib & 0x10) == 0x10; // FILE_ATTRIBUTE_DIRECTORY
if (opsys == ZIP_OPSYS_UNIX)
return ((attrib >> 16) & FA_IFDIR) == FA_IFDIR;
return 0;
}
static int write_link(const char* filename, const char* bytes, size_t count)
{
#if PLATFORM_POSIX
return symlink(bytes, filename);
#else
FILE* fp = fopen(filename, "wb");
if (fp == NULL)
{
printf("Error creating file:\n %s\n", filename);
return -1;
}
fwrite(bytes, sizeof(char), count, fp);
fclose(fp);
return 0;
#endif
}
extern int do_mkdir(const char* path);
static void parse_path(const char* full_name, char* filename, char* directory)
{
const char *ssc;
size_t orig_length = strlen(full_name);
size_t l = 0;
size_t dir_size;
ssc = strstr(full_name, "/");
do
{
l = strlen(ssc) + 1;
full_name = &full_name[strlen(full_name) - l + 2];
ssc = strstr(full_name, "/");
} while (ssc);
// full_name currently pointing to beginning of filename
memcpy(filename, full_name, strlen(full_name));
filename[strlen(full_name)] = 0; // Null terminate it
dir_size = orig_length - strlen(filename);
// full_name points to beginning of original string(with directory)
full_name = &full_name[strlen(full_name) - orig_length];
// Extract directory from full name by removing filename
memcpy(directory, full_name, dir_size);
directory[dir_size] = 0;
}
static int extract(const char* src, const char* destination)
{
int err = 0;
FILE *fp = NULL;
struct zip *z_archive = zip_open(src, 0, &err);
int i;
zip_int64_t entries;
char buffer[4096];
char appended_full_name[512];
char directory[512];
char filename[512];
size_t result;
zip_int64_t bytes_read;
if (!z_archive)
{
printf("%s does not exist\n", src);
return -1;
}
for (i = 0, entries = zip_get_num_entries(z_archive, 0); i < entries; ++i)
{
zip_uint8_t opsys;
zip_uint32_t attrib;
const char* full_name;
struct zip_file* zf = zip_fopen_index(z_archive, i, 0);
if (!zf)
continue;
zip_file_get_external_attributes(z_archive, i, 0, &opsys, &attrib);
full_name = zip_get_name(z_archive, i, 0);
sprintf(appended_full_name, "%s/%s", destination, full_name);
parse_path(appended_full_name, filename, directory);
do_mkdir(directory);
// is this a symbolic link?
if (is_symlink(opsys, attrib))
{
bytes_read = zip_fread(zf, buffer, sizeof(buffer));
buffer[bytes_read] = '\0';
if (write_link(appended_full_name, buffer, (size_t)bytes_read) != 0)
{
printf(" Failed to create symbolic link [%s->%s]\n", appended_full_name, buffer);
return -1;
}
} else
{
// If blank filename it's just a directory so create it and move on
if (!is_directory(opsys, attrib) && strlen(filename) > 0)
{
// mark as read-write, so we can overwrite the file if it already exists.
chmod(appended_full_name, 0666);
fp = fopen(appended_full_name, "wb");
if (fp == NULL)
{
printf("Error reading file:\n %s\n", appended_full_name);
return -1;
}
for(;;)
{
// Read content from zipped file
bytes_read = zip_fread(zf, buffer, sizeof(buffer));
if (bytes_read == 0) break;
// Write that content to file
result = fwrite(buffer, sizeof(char), (size_t)bytes_read, fp);
// If all bytes read weren't written, report error
if (result != (size_t)bytes_read)
{
printf(" Writing data to %s failed\n %d bytes were written\n %d bytes were attempted to be written\n File may be corrupt\n",
appended_full_name, (int)result, (int)bytes_read);
return -1;
}
}
fclose(fp);
// mark read-only, but maintain the other properties.
if (opsys == ZIP_OPSYS_UNIX)
chmod(appended_full_name, (attrib >> 16) & ~0222);
else
chmod(appended_full_name, 0444);
}
}
// Cleanup
zip_fclose(zf);
}
zip_close(z_archive);
return 0;
}
int zip_extract(lua_State* L)
{
const char* src = luaL_checkstring(L, 1);
const char* dst = luaL_checkstring(L, 2);
int res = extract(src, dst);
lua_pushnumber(L, (lua_Number)res);
return 1;
}
#endif

View File

@ -74,6 +74,9 @@
AVX2 = "-mavx2",
SSE = "-msse",
SSE2 = "-msse2",
SSE3 = "-msse3",
SSSE3 = "-mssse3",
["SSE4.1"] = "-msse4.1",
},
warnings = {
Extra = "-Wall -Wextra",
@ -352,13 +355,9 @@
}
function gcc.gettoolname(cfg, tool)
local names = gcc.tools[cfg.architecture] or gcc.tools[cfg.system] or {}
local name = names[tool]
if not name and (tool == "rc" or cfg.gccprefix) and gcc.tools[tool] then
name = (cfg.gccprefix or "") .. gcc.tools[tool]
if (cfg.gccprefix and gcc.tools[tool]) or tool == "rc" then
return (cfg.gccprefix or "") .. gcc.tools[tool]
end
return name
return nil
end

View File

@ -66,6 +66,9 @@
AVX2 = "/arch:AVX2",
SSE = "/arch:SSE",
SSE2 = "/arch:SSE2",
SSE3 = "/arch:SSE2",
SSSE3 = "/arch:SSE2",
["SSE4.1"] = "/arch:SSE2",
},
warnings = {
Extra = "/W4",

View File

@ -1,6 +1,7 @@
return {
-- Base API tests
"test_string.lua",
"base/test_aliasing.lua",
"base/test_configset.lua",
"base/test_context.lua",
"base/test_criteria.lua",
@ -27,6 +28,7 @@ return {
"project/test_eachconfig.lua",
"project/test_getconfig.lua",
"project/test_location.lua",
"project/test_sources.lua",
"project/test_vpaths.lua",
-- Configuration object tests

View File

@ -44,10 +44,10 @@
links { "System.dll", "System.Data.dll" }
prepare()
test.capture [[
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
</ItemGroup>
]]
end
@ -60,9 +60,9 @@
links { "m", "System.dll" }
prepare()
test.capture [[
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
]]
end
@ -75,10 +75,10 @@
links { "../nunit.framework.dll" }
prepare()
test.capture [[
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
]]
end

View File

@ -43,9 +43,9 @@
prebuildcommands { "command1" }
prepare()
test.capture [[
<PreBuildEvent>
<Command>command1</Command>
</PreBuildEvent>
<PreBuildEvent>
<Command>command1</Command>
</PreBuildEvent>
]]
end
@ -53,9 +53,9 @@
postbuildcommands { "command1" }
prepare()
test.capture [[
<PostBuildEvent>
<Command>command1</Command>
</PostBuildEvent>
<PostBuildEvent>
<Command>command1</Command>
</PostBuildEvent>
]]
end
@ -64,12 +64,12 @@
postbuildcommands { "command2" }
prepare()
test.capture [[
<PreBuildEvent>
<Command>command1</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>command2</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>command1</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>command2</Command>
</PostBuildEvent>
]]
end
@ -81,7 +81,7 @@
function suite.splits_onMultipleCommands()
postbuildcommands { "command1", "command2" }
prepare()
test.capture ("\t\t<PostBuildEvent>\n\t\t\t<Command>command1\r\ncommand2</Command>\n\t\t</PostBuildEvent>\n")
test.capture ("<PostBuildEvent>\n\t<Command>command1\r\ncommand2</Command>\n</PostBuildEvent>\n")
end
@ -94,9 +94,9 @@
postbuildcommands { '\' " < > &' }
prepare()
test.capture [[
<PostBuildEvent>
<Command>' " &lt; &gt; &amp;</Command>
</PostBuildEvent>
<PostBuildEvent>
<Command>' " &lt; &gt; &amp;</Command>
</PostBuildEvent>
]]
end
@ -110,9 +110,9 @@
postbuildmessage "Post-building..."
prepare()
test.capture [[
<PostBuildEvent>
<Command>command1</Command>
<Message>Post-building...</Message>
</PostBuildEvent>
<PostBuildEvent>
<Command>command1</Command>
<Message>Post-building...</Message>
</PostBuildEvent>
]]
end

View File

@ -33,11 +33,11 @@
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
]]
end
@ -50,8 +50,8 @@
kind "ConsoleApp"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
]]
end
@ -59,8 +59,8 @@
kind "WindowedApp"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
]]
end
@ -68,8 +68,8 @@
kind "SharedLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
]]
end
@ -77,8 +77,8 @@
kind "StaticLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
]]
end
@ -90,9 +90,9 @@
flags "Symbols"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
]]
end
@ -104,10 +104,10 @@
flags "Unicode"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
]]
end
@ -120,10 +120,10 @@
clr "On"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
]]
end
@ -131,9 +131,9 @@
clr "Off"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
]]
end
@ -141,10 +141,10 @@
clr "Unsafe"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
]]
end
@ -152,10 +152,10 @@
clr "Safe"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>Safe</CLRSupport>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>Safe</CLRSupport>
]]
end
@ -163,10 +163,10 @@
clr "Pure"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>Pure</CLRSupport>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>Pure</CLRSupport>
]]
end
@ -179,10 +179,10 @@
flags "MFC"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfMfc>Dynamic</UseOfMfc>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfMfc>Dynamic</UseOfMfc>
]]
end
@ -190,10 +190,10 @@
flags { "MFC", "StaticRuntime" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfMfc>Static</UseOfMfc>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfMfc>Static</UseOfMfc>
]]
end
@ -205,10 +205,10 @@
atl "Dynamic"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfATL>Dynamic</UseOfATL>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfATL>Dynamic</UseOfATL>
]]
end
@ -216,10 +216,10 @@
atl "Static"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfATL>Static</UseOfATL>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfATL>Static</UseOfATL>
]]
end
@ -233,9 +233,9 @@
flags { "Symbols", "ReleaseRuntime" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
]]
end
@ -251,12 +251,12 @@
kind "Makefile"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
</PropertyGroup>
]]
end
@ -264,12 +264,12 @@
kind "None"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
</PropertyGroup>
]]
end
@ -281,9 +281,9 @@
kind "Utility"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
</PropertyGroup>
]]
end
@ -295,10 +295,10 @@
flags { "LinkTimeOptimization" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
]]
end

View File

@ -49,11 +49,11 @@
function suite.normalLink_onIncludedConfig()
prepare("Zeus")
test.capture [[
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
]]
end
@ -68,14 +68,14 @@
function suite.explicitLink_onExcludedConfig()
prepare("Ares")
test.capture [[
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>bin\Ares\Debug\MyProject2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>bin\Ares\Debug\MyProject2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
]]
end

View File

@ -32,11 +32,11 @@
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
@ -49,12 +49,12 @@
clr "On"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
@ -68,12 +68,12 @@
framework "4.5"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
@ -82,13 +82,13 @@
clr "On"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
@ -100,9 +100,9 @@
system "Linux"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
</PropertyGroup>
]]
end
@ -118,11 +118,11 @@
system "Linux"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
@ -135,10 +135,10 @@
kind "Makefile"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
]]
end
@ -146,10 +146,10 @@
kind "None"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
]]
end
@ -163,12 +163,12 @@
filename "MyProject_2012"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
<ProjectName>MyProject</ProjectName>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
<ProjectName>MyProject</ProjectName>
</PropertyGroup>
]]
end
@ -183,11 +183,11 @@
_ACTION = "vs2013"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end

View File

@ -31,12 +31,12 @@
function suite.defaultSettings()
prepare()
test.capture [[
<ImageXex>
<ConfigurationFile>
</ConfigurationFile>
<AdditionalSections>
</AdditionalSections>
</ImageXex>
<ImageXex>
<ConfigurationFile>
</ConfigurationFile>
<AdditionalSections>
</AdditionalSections>
</ImageXex>
]]
end
@ -47,10 +47,10 @@
configfile "testconfig.xml"
prepare()
test.capture [[
<ImageXex>
<ConfigurationFile>testconfig.xml</ConfigurationFile>
<AdditionalSections>
</AdditionalSections>
</ImageXex>
<ImageXex>
<ConfigurationFile>testconfig.xml</ConfigurationFile>
<AdditionalSections>
</AdditionalSections>
</ImageXex>
]]
end

View File

@ -35,11 +35,11 @@
kind "SharedLib"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
]]
end
@ -52,13 +52,13 @@
optimize "On"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
]]
end
@ -71,10 +71,10 @@
kind "ConsoleApp"
prepare()
test.capture [[
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
]]
end
@ -82,10 +82,10 @@
kind "WindowedApp"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
]]
end
@ -93,11 +93,11 @@
kind "SharedLib"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
]]
end
@ -105,10 +105,10 @@
kind "StaticLib"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
]]
end
@ -121,14 +121,14 @@
flags "NoImplicitLink"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
]]
end
@ -140,9 +140,9 @@
flags "Symbols"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
]]
end
@ -156,10 +156,10 @@
links { "lua", "zlib" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>lua.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>lua.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
]]
end
@ -172,10 +172,10 @@
libdirs { "../lib", "../lib64" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\lib;..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\lib;..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
]]
end
@ -191,11 +191,11 @@
kind "SharedLib"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
]]
end
@ -211,15 +211,15 @@
kind "SharedLib"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>bin\Debug\MyProject2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>bin\Debug\MyProject2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
]]
end
@ -235,10 +235,10 @@
libdirs { "../lib", "../lib64" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
]]
end
@ -251,11 +251,11 @@
implibdir "../lib"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>..\lib\MyProject.lib</ImportLibrary>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>..\lib\MyProject.lib</ImportLibrary>
</Link>
]]
end
@ -270,11 +270,11 @@
linkoptions { "/kupo" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
]]
end
@ -283,13 +283,13 @@
linkoptions { "/kupo" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
</Lib>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
</Lib>
]]
end
@ -302,11 +302,11 @@
optimize "On"
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
]]
end
@ -319,12 +319,12 @@
files { "hello.cpp", "hello.def" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
<ModuleDefinitionFile>hello.def</ModuleDefinitionFile>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
<ModuleDefinitionFile>hello.def</ModuleDefinitionFile>
</Link>
]]
end
@ -337,10 +337,10 @@
links { "kernel32", "System.dll", "System.Data.dll" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
]]
end
@ -354,9 +354,9 @@
system "Xbox360"
prepare()
test.capture [[
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
]]
end
@ -369,10 +369,10 @@
links { "user32" }
prepare()
test.capture [[
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
]]
end
@ -386,11 +386,11 @@
flags { "FatalLinkWarnings" }
prepare()
test.capture [[
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
]]
end
@ -399,13 +399,13 @@
flags { "FatalLinkWarnings" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Lib>
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
</Lib>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Lib>
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
</Lib>
]]
end
@ -418,11 +418,11 @@
flags { "Maps" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
<GenerateMapFile>true</GenerateMapFile>
</Link>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
<GenerateMapFile>true</GenerateMapFile>
</Link>
]]
end

View File

@ -33,9 +33,9 @@
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
</PropertyGroup>
]]
end
@ -59,9 +59,9 @@
targetextension ".exe"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject.exe</NMakeOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject.exe</NMakeOutput>
</PropertyGroup>
]]
end
@ -74,10 +74,10 @@
buildcommands { "command 1" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeBuildCommandLine>command 1</NMakeBuildCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeBuildCommandLine>command 1</NMakeBuildCommandLine>
</PropertyGroup>
]]
end
@ -85,11 +85,11 @@
buildcommands { "command 1", "command 2" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeBuildCommandLine>command 1
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeBuildCommandLine>command 1
command 2</NMakeBuildCommandLine>
</PropertyGroup>
</PropertyGroup>
]]
end
@ -97,10 +97,10 @@ command 2</NMakeBuildCommandLine>
rebuildcommands { "command 1" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeReBuildCommandLine>command 1</NMakeReBuildCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeReBuildCommandLine>command 1</NMakeReBuildCommandLine>
</PropertyGroup>
]]
end
@ -108,9 +108,9 @@ command 2</NMakeBuildCommandLine>
cleancommands { "command 1" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeCleanCommandLine>command 1</NMakeCleanCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakeCleanCommandLine>command 1</NMakeCleanCommandLine>
</PropertyGroup>
]]
end

View File

@ -32,13 +32,13 @@
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
</PropertyGroup>
]]
end
@ -68,15 +68,15 @@
system "Xbox360"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<OutputFile>$(OutDir)MyProject.exe</OutputFile>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<OutputFile>$(OutDir)MyProject.exe</OutputFile>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
</PropertyGroup>
]]
end
@ -85,14 +85,14 @@
kind "StaticLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
<OutDir>bin\Debug\</OutDir>
<OutputFile>$(OutDir)MyProject.lib</OutputFile>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.lib</TargetExt>
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
<OutDir>bin\Debug\</OutDir>
<OutputFile>$(OutDir)MyProject.lib</OutputFile>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.lib</TargetExt>
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
</PropertyGroup>
]]
end
@ -105,8 +105,8 @@
kind "StaticLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\Debug\</OutDir>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\Debug\</OutDir>
]]
end
@ -118,8 +118,8 @@
optimize "On"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
]]
end
@ -131,9 +131,9 @@
targetdir "../bin"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\bin\</OutDir>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\bin\</OutDir>
]]
end
@ -145,10 +145,10 @@
objdir "../tmp"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>..\tmp\Debug\</IntDir>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>..\tmp\Debug\</IntDir>
]]
end
@ -160,11 +160,11 @@
targetname "MyTarget"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyTarget</TargetName>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyTarget</TargetName>
]]
end
@ -177,9 +177,9 @@
flags "NoImportLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
]]
end
@ -188,9 +188,9 @@
flags "NoImportLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
]]
end
@ -203,13 +203,13 @@
flags "NoManifest"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<GenerateManifest>false</GenerateManifest>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<GenerateManifest>false</GenerateManifest>
]]
end
@ -222,14 +222,14 @@
targetextension ""
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>
</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>
</TargetExt>
</PropertyGroup>
]]
end
@ -243,14 +243,14 @@
cleanextensions { ".temp1", ".temp2" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<ExtensionsToDeleteOnClean>*.temp1;*.temp2;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<ExtensionsToDeleteOnClean>*.temp1;*.temp2;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
</PropertyGroup>
]]
end
@ -263,14 +263,14 @@
sysincludedirs { "$(DXSDK_DIR)/Include" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<IncludePath>$(DXSDK_DIR)\Include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<IncludePath>$(DXSDK_DIR)\Include;$(IncludePath)</IncludePath>
</PropertyGroup>
]]
end
@ -278,13 +278,13 @@
syslibdirs { "$(DXSDK_DIR)/lib/x86" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<LibraryPath>$(DXSDK_DIR)\lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug\</OutDir>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<LibraryPath>$(DXSDK_DIR)\lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
]]
end

View File

@ -32,16 +32,16 @@
function suite.win32Listed_onNoPlatforms()
prepare()
test.capture [[
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
]]
end
@ -60,24 +60,24 @@
architecture "x86_64"
prepare()
test.capture [[
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug 32b|Win32">
<Configuration>Debug 32b</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 32b|x64">
<Configuration>Debug 32b</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 64b|Win32">
<Configuration>Debug 64b</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 64b|x64">
<Configuration>Debug 64b</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release 32b|Win32">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug 32b|Win32">
<Configuration>Debug 32b</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 32b|x64">
<Configuration>Debug 32b</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 64b|Win32">
<Configuration>Debug 64b</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 64b|x64">
<Configuration>Debug 64b</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release 32b|Win32">
]]
end
@ -91,15 +91,15 @@
platforms { "x86", "x86_64" }
prepare()
test.capture [[
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
]]
end

View File

@ -32,8 +32,8 @@
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
]]
end

View File

@ -0,0 +1,64 @@
--
-- tests/base/test_aliasing.lua
-- Verify handling of function aliases.
-- Copyright (c) 2015 Jason Perkins and the Premake project
--
local suite = test.declare("premake_alias")
local p = premake
function suite.setup()
suite.testfunc = function()
return 48
end
suite.aliased = nil
suite.aliased2 = nil
end
function suite.returnsOriginalFunction_onNoAlias()
local scope, f = p.resolveAlias(suite, "testfunc")
test.isequal("testfunc", f)
end
function suite.pointsAliasToOriginalFunction()
p.alias(suite, "testfunc", "aliased")
test.isequal(48, suite.aliased())
end
function suite.returnsOriginalFunction_onAlias()
p.alias(suite, "testfunc", "aliased")
local scope, f = p.resolveAlias(suite, "aliased")
test.isequal("testfunc", f)
end
function suite.returnsOriginalFunction_onChainedAliases()
p.alias(suite, "testfunc", "aliased")
p.alias(suite, "aliased", "aliased2")
local scope, f = p.resolveAlias(suite, "aliased2")
test.isequal("testfunc", f)
end
function suite.overrideResolvesAliases()
p.alias(suite, "testfunc", "aliased")
p.override(suite, "aliased", function(base)
return base() + 1
end)
test.isequal(49, suite.testfunc())
end
function suite.aliasTracksOverrides()
p.alias(suite, "testfunc", "aliased")
p.override(suite, "testfunc", function(base)
return base() + 1
end)
test.isequal(49, suite.aliased())
end

View File

@ -0,0 +1,93 @@
--
-- tests/project/test_sources.lua
-- Automated test suite for the source tree, including tokens and wildcards.
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
local suite = test.declare("project_sources")
local project = premake.project
--
-- Setup and teardown
--
local sln, prj
local cwd = os.getcwd()
local oldcwd
function suite.setup()
sln, prj = test.createsolution()
-- We change the directory to get nice relative paths
oldcwd = os.getcwd()
os.chdir(cwd)
-- Create a token to be used in search paths
premake.api.register { name = "mytoken", kind = "string", scope = "config" }
mytoken "test"
end
function suite.teardown()
mytoken = nil
os.chdir(oldcwd)
end
local function run()
local cfg = test.getconfig(prj, "Debug")
local files = {}
for _, file in ipairs(cfg.files) do
table.insert(files, path.getrelative(cwd, file))
end
return files
end
--
-- Test single file
--
function suite.SingleFile()
files { "test_sources.lua" }
test.isequal({"test_sources.lua"}, run())
end
--
-- Test tokens
--
function suite.SingleFileWithToken()
files { "%{cfg.mytoken}_sources.lua" }
test.isequal({"test_sources.lua"}, run())
end
--
-- Test wildcards
--
function suite.FilesWithWildcard()
files { "test_*.lua" }
test.contains("test_sources.lua", run())
end
function suite.FilesWithRecursiveWildcard()
files { "../**_sources.lua" }
test.contains("test_sources.lua", run())
end
--
-- Test wildcards and tokens combined
--
function suite.FilesWithWildcardAndToken()
files { "%{cfg.mytoken}_*.lua" }
test.contains("test_sources.lua", run())
end
function suite.FilesWithRecursiveWildcardAndToken()
files { "../**/%{cfg.mytoken}_sources.lua" }
test.contains("test_sources.lua", run())
end

View File

@ -1,9 +1,11 @@
--
-- tests/testfx.lua
-- Automated test framework for Premake.
-- Copyright (c) 2008-2014 Jason Perkins and the Premake project
-- Copyright (c) 2008-2015 Jason Perkins and the Premake project
--
local p = premake
--
-- Define a namespace for the testing functions
@ -244,17 +246,19 @@
-- Some helper functions
--
function test.createsolution()
local sln = solution "MySolution"
function test.createWorkspace()
local wks = workspace("MySolution")
configurations { "Debug", "Release" }
local prj = project "MyProject"
language "C++"
kind "ConsoleApp"
local prj = project("MyProject")
language("C++")
kind("ConsoleApp")
return sln, prj
return wks, prj
end
p.alias(test, "createWorkspace", "createsolution")
function test.createproject(sln)
local n = #sln.projects + 1