Merge branch 'release-5.0-alpha2' into release
This commit is contained in:
commit
9566bb3de8
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,7 @@ syntax: glob
|
||||
|
||||
build
|
||||
bin
|
||||
modules
|
||||
obj
|
||||
release
|
||||
ipch
|
||||
@ -29,6 +30,7 @@ Makefile
|
||||
*.workspace
|
||||
*.project
|
||||
*.tags
|
||||
*.sublime-*
|
||||
|
||||
*.bbprojectsettings
|
||||
Scratchpad.txt
|
||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "modules/xcode"]
|
||||
path = modules/xcode
|
||||
url = https://github.com/premake/premake-xcode.git
|
38
.hgignore
38
.hgignore
@ -1,38 +0,0 @@
|
||||
syntax: glob
|
||||
|
||||
.DS_Store
|
||||
|
||||
*.bak
|
||||
*.orig
|
||||
*~
|
||||
|
||||
build
|
||||
bin
|
||||
obj
|
||||
release
|
||||
ipch
|
||||
src/host/scripts.c
|
||||
**.lnt
|
||||
**.vlstatus
|
||||
|
||||
Makefile
|
||||
*.make
|
||||
*.xcodeproj
|
||||
*.swp
|
||||
*.sdf
|
||||
*.sln
|
||||
*.suo
|
||||
*.ncb
|
||||
*.vcproj*
|
||||
*.vcxproj*
|
||||
*.opensdf
|
||||
*.workspace
|
||||
*.project
|
||||
*.tags
|
||||
*.sublime-*
|
||||
|
||||
*.bbprojectsettings
|
||||
Scratchpad.txt
|
||||
Unix Worksheet.worksheet
|
||||
project.bbprojectdata
|
||||
Premake4.tmproj
|
@ -1 +0,0 @@
|
||||
3935627f6ef6f848afd1ac3b22cc1eaa7b34a582 modules/xcode
|
10
.hgtags
10
.hgtags
@ -1,10 +0,0 @@
|
||||
effc29c89976fad8598fc00d8d764391d7a5564d dev-0.1
|
||||
effc29c89976fad8598fc00d8d764391d7a5564d dev-0.1
|
||||
0000000000000000000000000000000000000000 dev-0.1
|
||||
b356c6f751e085dad8d264143e9ae0dabe78423d 4.3-beta1
|
||||
1dd035de5b6dba46c32decd97269ceb70dc61f4b 4.3-rc2
|
||||
582630d7b7d40abb096131e822e2ea0376296a73 4.3
|
||||
79873394f6f666b593816d4f513c8f646737e265 4.4-beta1
|
||||
8f58c46b28369862039dbc3e57cd7a46baf7afdd 4.4-beta2
|
||||
84f69f787603f2dede4123965933e02de11724fb 4.4-beta3
|
||||
cd2871a74fb44561d168b38af881c23a7caf16ac 5.0-alpha1
|
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
before_install:
|
||||
- sudo add-apt-repository -y ppa:codegear/release
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install premake4
|
||||
|
||||
script:
|
||||
- premake4 embed
|
||||
- premake4 gmake
|
||||
- make -j8
|
||||
- bin/release/premake5 test
|
||||
|
35
CHANGES.txt
35
CHANGES.txt
@ -2,5 +2,38 @@
|
||||
5.0 (in progress)
|
||||
--------------------
|
||||
|
||||
See https://bitbucket.org/premake/premake-dev/wiki/What's_New_in_5.0
|
||||
See https://github.com/premake/premake-core/wiki/What's-New-in-5.0
|
||||
for the complete list of changes from the Premake 4.x series.
|
||||
|
||||
Since 5.0-alpha1:
|
||||
|
||||
* Many new debugger APIs
|
||||
* New API: endian()
|
||||
* New API: fpu()
|
||||
* New API: gccprefix()
|
||||
* New API: pic()
|
||||
* New API: runtime() (Tom van Dijck)
|
||||
* New API: undefines()
|
||||
* New API: disablewarnings(), enablewarnings(), fatalwarnings()
|
||||
* Added Visual Studio 2015 support (Tom van Dijck)
|
||||
* filter() now accepts field value aliases in the conditions
|
||||
* Fixed _ACTION and _OPTIONS filter prefixes
|
||||
* Main application logic can now be extended by modules
|
||||
* Action arguments (_ARGS) are now keyed by both index and value
|
||||
* Configuration baking and validation now skipped for execute only actions
|
||||
* os.findlib() now accepts paths to search as argument
|
||||
* Visual Studio .user files are now only generated if not empty
|
||||
* Xcode4 exporter is now available
|
||||
* Modules may now be loaded on demand where feasible
|
||||
* os.outputof() now returns command exit code as second value
|
||||
* Added AVX2 to vectorextensions()
|
||||
* Checks to prevent self-linking (Mark Chandler)
|
||||
* Added path.replaceextension() (M Skibbe)
|
||||
* Made clean functions overridable
|
||||
* Migrated x32/x64 to x86/x86_64
|
||||
* Added new debugger selection APIs
|
||||
* Fixed handling of ../ sequences in path.normalize() (Tom van Dijck)
|
||||
* Added table.tostring() (Tom van Dijck)
|
||||
* Added .editorconfig file
|
||||
* Added string.sha1() (Tom van Dijck)
|
||||
* Added verbosef() and --verbose flag (Tom van Dijck)
|
||||
|
33
CONTRIBUTORS.txt
Normal file
33
CONTRIBUTORS.txt
Normal file
@ -0,0 +1,33 @@
|
||||
This file contains a list of people who've made non-trivial contributions
|
||||
to Premake 5. People who commit code to the project are encouraged to
|
||||
add their names here. And many thanks to those who contributed fixes and
|
||||
improvements to earlier versions of Premake (feel free to add your name
|
||||
in here too)!
|
||||
|
||||
Original design and implementation:
|
||||
Jason Perkins <starkos@industriousone.com>
|
||||
|
||||
Main Contributors
|
||||
Manu Evans <https://github.com/TurkeyMan>
|
||||
|
||||
Builds and Infrastructure:
|
||||
Mihai Sebea <http://twitter.com/mihai_sebea>
|
||||
* Nightly binary packages
|
||||
* Nightly Jenkins builds and error reports
|
||||
|
||||
Patch contributors:
|
||||
Mark Chandler <https://bitbucket.org/mchandler_blizzard>
|
||||
* Prevent self-linking
|
||||
Mihai Sebea <http://twitter.com/mihai_sebea>
|
||||
* Xcode exporter fixes and improvements
|
||||
M Skibbe
|
||||
* path.replaceextension()
|
||||
Renaud Guillard <https://bitbucket.org/noresources>
|
||||
* add library search paths argument to os.findlib()
|
||||
* return command exit code from os.outputof()
|
||||
Tom van Dijck <tvandijck@blizzard.com>
|
||||
* additional string and table functions
|
||||
* path.normalize() improvements
|
||||
* Visual Studio 2015 support
|
||||
* runtime()
|
||||
* verbosef()
|
@ -11,4 +11,4 @@ Core module
|
||||
See the file BUILD.txt for instructions on building Premake.
|
||||
|
||||
For questions, comments, or more information, visit the project
|
||||
website at https://bitbucket.org/premake/premake-main
|
||||
website at https://github.com/premake/premake-core
|
||||
|
1
modules/xcode
Submodule
1
modules/xcode
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit b0f33f4c9fd5ad54adceb23e0caa7362cd6d5ac3
|
17
premake4.lua
17
premake4.lua
@ -103,3 +103,20 @@
|
||||
value = "path",
|
||||
description = "Set the output location for the generated files"
|
||||
}
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- This new embed action is slightly hardcoded for the 4.x executable, and is
|
||||
-- really only intended to get folks bootstrapped on to 5.x
|
||||
--
|
||||
|
||||
newaction {
|
||||
trigger = "embed",
|
||||
description = "Embed scripts in scripts.c; required before release builds",
|
||||
execute = function ()
|
||||
_MAIN_SCRIPT_DIR = os.getcwd()
|
||||
_SCRIPT_DIR = path.join(_MAIN_SCRIPT_DIR, "scripts")
|
||||
dofile("scripts/embed.lua")
|
||||
end
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ PREMAKE RELEASE CHECKLIST
|
||||
|
||||
PREP
|
||||
|
||||
* Make sure CHANGES.txt and CONTRIBUTORS.txt is up to date
|
||||
|
||||
* Create working branch for release prep
|
||||
|
||||
* Make sure branch passes all tests on all platforms
|
||||
|
||||
* Update CHANGELOG.txt as needed
|
||||
|
||||
* Prep release announcement for forums
|
||||
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
-- issues in Mac OS X Universal builds.
|
||||
--
|
||||
|
||||
|
||||
local function loadScript(fname)
|
||||
fname = path.getabsolute(fname)
|
||||
local f = io.open(fname)
|
||||
local s = assert(f:read("*a"))
|
||||
f:close()
|
||||
@ -40,7 +40,7 @@
|
||||
-- escape double quote marks
|
||||
s = s:gsub("\"", "\\\"")
|
||||
|
||||
return s
|
||||
return s
|
||||
end
|
||||
|
||||
|
||||
@ -109,6 +109,7 @@
|
||||
|
||||
table.insert(result, '\t"src/_premake_main.lua",')
|
||||
table.insert(result, '\t"src/_manifest.lua",')
|
||||
table.insert(result, '\t"src/_modules.lua",')
|
||||
table.insert(result, "\tNULL")
|
||||
table.insert(result, "};")
|
||||
table.insert(result, "")
|
||||
@ -133,6 +134,7 @@
|
||||
|
||||
appendScript(result, loadScript(path.join(_SCRIPT_DIR, "../src/_premake_main.lua")))
|
||||
appendScript(result, loadScript(path.join(_SCRIPT_DIR, "../src/_manifest.lua")))
|
||||
appendScript(result, loadScript(path.join(_SCRIPT_DIR, "../src/_modules.lua")))
|
||||
|
||||
table.insert(result, "\tNULL")
|
||||
table.insert(result, "};")
|
||||
|
@ -53,9 +53,8 @@
|
||||
-- Figure out what I'm making.
|
||||
--
|
||||
|
||||
local f = io.open("../src/host/premake.c", "r")
|
||||
local text = f:read("*a")
|
||||
f:close()
|
||||
os.chdir("..")
|
||||
local text = os.outputof(string.format('hg cat -r %s src/host/premake.c', branch))
|
||||
local _, _, version = text:find('VERSION%s*"([%w%p]+)"')
|
||||
|
||||
local pkgName = "premake-" .. version
|
||||
@ -84,13 +83,12 @@
|
||||
--
|
||||
|
||||
print("Preparing release folder")
|
||||
os.chdir("..")
|
||||
os.mkdir("release")
|
||||
os.chdir("release")
|
||||
os.rmdir(pkgName)
|
||||
|
||||
print("Cloning source code")
|
||||
local z = os.executef("hg clone .. -r %s %s", branch, pkgName)
|
||||
z = os.executef("hg clone .. -r %s %s", branch, pkgName)
|
||||
if z ~= 0 then
|
||||
error("clone failed", 0)
|
||||
end
|
||||
@ -109,24 +107,29 @@
|
||||
|
||||
|
||||
--
|
||||
-- Generate a source package.
|
||||
-- Clear out files I don't want included in any packages.
|
||||
--
|
||||
|
||||
if kind == "source" then
|
||||
|
||||
print("Cleaning up the source tree...")
|
||||
os.rmdir("packages")
|
||||
|
||||
local modules = table.join(".", os.matchdirs("modules/*"))
|
||||
for _, module in ipairs(modules) do
|
||||
for _, name in ipairs { ".hg", ".hgcheck" } do
|
||||
for _, name in ipairs { ".git" } do
|
||||
os.rmdir(path.join(module, name))
|
||||
end
|
||||
for _, name in ipairs { ".DS_Store", ".gitignore", ".hgignore", ".hgsub*", ".hgtags" } do
|
||||
for _, name in ipairs { ".DS_Store", ".git", ".gitignore", ".gitmodules", ".travis.yml", ".editorconfig" } do
|
||||
os.remove(path.join(module, name))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Generate a source package.
|
||||
--
|
||||
|
||||
if kind == "source" then
|
||||
|
||||
print("Generating project files...")
|
||||
execQuiet("premake5 /to=build/vs2005 vs2005")
|
||||
execQuiet("premake5 /to=build/vs2008 vs2008")
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- _manifest.lua
|
||||
-- Manage the list of built-in Premake scripts.
|
||||
-- Copyright (c) 2002-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
-- The master list of built-in scripts. Order is important! If you want to
|
||||
@ -80,6 +80,7 @@
|
||||
"actions/vstudio/vs2010_rules_xml.lua",
|
||||
"actions/vstudio/vs2012.lua",
|
||||
"actions/vstudio/vs2013.lua",
|
||||
"actions/vstudio/vs2015.lua",
|
||||
|
||||
-- Clean action
|
||||
"actions/clean/_clean.lua",
|
||||
|
9
src/_modules.lua
Normal file
9
src/_modules.lua
Normal file
@ -0,0 +1,9 @@
|
||||
--
|
||||
-- _modules.lua
|
||||
-- The list of core modules to preload on startup
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
return {
|
||||
"xcode",
|
||||
}
|
@ -3,12 +3,12 @@
|
||||
--
|
||||
-- Prepares the runtime environment for the add-ons and user project scripts.
|
||||
--
|
||||
-- Copyright (c) 2012-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local api = premake.api
|
||||
|
||||
local DOC_URL = "See https://bitbucket.org/premake/premake-dev/wiki/"
|
||||
local DOC_URL = "See https://github.com/premake/premake-core/wiki/"
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
@ -23,8 +23,14 @@
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"universal",
|
||||
"x32",
|
||||
"x64",
|
||||
"x86",
|
||||
"x86_64",
|
||||
},
|
||||
aliases = {
|
||||
i386 = "x86",
|
||||
amd64 = "x86_64",
|
||||
x32 = "x86", -- these should be DEPRECATED
|
||||
x64 = "x86_64",
|
||||
},
|
||||
}
|
||||
|
||||
@ -202,6 +208,13 @@
|
||||
pathVars = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugconnectcommands",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugdir",
|
||||
scope = "config",
|
||||
@ -218,6 +231,12 @@
|
||||
pathVars = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugextendedprotocol",
|
||||
scope = "config",
|
||||
kind = "boolean",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugformat",
|
||||
scope = "config",
|
||||
@ -227,6 +246,67 @@
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugger",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"GDB",
|
||||
"LLDB",
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugpathmap",
|
||||
scope = "config",
|
||||
kind = "list:keyed:path",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugport",
|
||||
scope = "config",
|
||||
kind = "integer",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugremotehost",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugsearchpaths",
|
||||
scope = "config",
|
||||
kind = "list:path",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugstartupcommands",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugtoolargs",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
pathVars = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "debugtoolcommand",
|
||||
scope = "config",
|
||||
kind = "path",
|
||||
tokens = true,
|
||||
pathVars = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "defaultplatform",
|
||||
scope = "project",
|
||||
@ -255,6 +335,14 @@
|
||||
}
|
||||
|
||||
|
||||
api.register {
|
||||
name = "disablewarnings",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
|
||||
api.register {
|
||||
name = "display",
|
||||
scope = "rule",
|
||||
@ -269,12 +357,38 @@
|
||||
}
|
||||
|
||||
|
||||
api.register {
|
||||
name = "enablewarnings",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "endian",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"Little",
|
||||
"Big",
|
||||
},
|
||||
}
|
||||
|
||||
-- For backward compatibility, excludes() is now an alias for removefiles()
|
||||
function excludes(value)
|
||||
removefiles(value)
|
||||
end
|
||||
|
||||
|
||||
api.register {
|
||||
name = "fatalwarnings",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
|
||||
api.register {
|
||||
name = "fileExtension",
|
||||
scope = "rule",
|
||||
@ -338,7 +452,8 @@
|
||||
"Optimize", -- DEPRECATED
|
||||
"OptimizeSize", -- DEPRECATED
|
||||
"OptimizeSpeed", -- DEPRECATED
|
||||
"ReleaseRuntime",
|
||||
"RelativeLinks",
|
||||
"ReleaseRuntime", -- DEPRECATED
|
||||
"SEH",
|
||||
"ShadowedVariables",
|
||||
"StaticRuntime",
|
||||
@ -348,6 +463,8 @@
|
||||
"Unsafe", -- DEPRECATED
|
||||
"WinMain",
|
||||
"WPF",
|
||||
"C++11",
|
||||
"C++14",
|
||||
},
|
||||
aliases = {
|
||||
FatalWarnings = { "FatalWarnings", "FatalCompileWarnings", "FatalLinkWarnings" },
|
||||
@ -382,12 +499,30 @@
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "fpu",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Software",
|
||||
"Hardware",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
api.register {
|
||||
name = "framework",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "gccprefix",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "icon",
|
||||
scope = "project",
|
||||
@ -558,6 +693,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "runtime",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Debug",
|
||||
"Release",
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "pchheader",
|
||||
scope = "config",
|
||||
@ -572,6 +717,16 @@
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "pic",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Off",
|
||||
"On",
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "platforms",
|
||||
scope = "project",
|
||||
@ -750,6 +905,13 @@
|
||||
end,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "undefines",
|
||||
scope = "config",
|
||||
kind = "list:string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "usingdirs",
|
||||
scope = "config",
|
||||
@ -786,6 +948,7 @@
|
||||
allowed = {
|
||||
"Default",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"SSE",
|
||||
"SSE2",
|
||||
}
|
||||
@ -809,7 +972,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Handlers for deprecated fields and values.
|
||||
@ -875,6 +1037,12 @@
|
||||
optimize "Off"
|
||||
end)
|
||||
|
||||
api.deprecateValue("flags", { "ReleaseRuntime" }, nil,
|
||||
function(value)
|
||||
runtime 'Release'
|
||||
end,
|
||||
function(value)
|
||||
end)
|
||||
|
||||
api.deprecateValue("flags", { "Optimise", "OptimiseSize", "OptimiseSpeed" }, nil,
|
||||
function(value)
|
||||
@ -974,6 +1142,12 @@
|
||||
description = "Display this information"
|
||||
}
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "verbose",
|
||||
description = "Generate extra debug text output"
|
||||
}
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "interactive",
|
||||
@ -1068,3 +1242,8 @@
|
||||
targetprefix ""
|
||||
targetextension ".dll"
|
||||
implibextension ".dll"
|
||||
|
||||
filter { "kind:SharedLib", "system:not Windows" }
|
||||
pic "On"
|
||||
|
||||
filter {}
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
-- Load the collection of core scripts, required for everything else to work
|
||||
|
||||
local modules = dofile("_modules.lua")
|
||||
local manifest = dofile("_manifest.lua")
|
||||
for i = 1, #manifest do
|
||||
dofile(manifest[i])
|
||||
@ -21,137 +22,94 @@
|
||||
local p = premake
|
||||
p.main = {}
|
||||
|
||||
local m = p.main
|
||||
|
||||
--
|
||||
-- Script-side program entry point.
|
||||
--
|
||||
|
||||
p.main.elements = function()
|
||||
return {
|
||||
p.main.locateUserScript,
|
||||
p.main.installModuleLoader,
|
||||
}
|
||||
|
||||
---
|
||||
-- Add a new module loader that knows how to use the Premake paths like
|
||||
-- PREMAKE_PATH and the --scripts option, and follows the module/module.lua
|
||||
-- naming convention.
|
||||
---
|
||||
|
||||
function m.installModuleLoader()
|
||||
table.insert(package.loaders, 2, m.moduleLoader)
|
||||
end
|
||||
|
||||
function _premake_main()
|
||||
function m.moduleLoader(name)
|
||||
local dir = path.getdirectory(name)
|
||||
local base = path.getname(name)
|
||||
|
||||
-- Clear out any configuration scoping left over from initialization
|
||||
if dir ~= "." then
|
||||
dir = dir .. "/" .. base
|
||||
else
|
||||
dir = base
|
||||
end
|
||||
|
||||
filter {}
|
||||
local full = dir .. "/" .. base .. ".lua"
|
||||
local p = os.locate("modules/" .. full) or
|
||||
os.locate(full) or
|
||||
os.locate(name .. ".lua")
|
||||
|
||||
-- Seed the random number generator so actions don't have to do it themselves
|
||||
if not p then
|
||||
-- try to load from the embedded script
|
||||
p = "$/" .. full
|
||||
end
|
||||
|
||||
local chunk, err = loadfile(p)
|
||||
return chunk
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Prepare the script environment; anything that should be done
|
||||
-- before the system script gets a chance to run.
|
||||
---
|
||||
|
||||
function m.prepareEnvironment()
|
||||
math.randomseed(os.time())
|
||||
|
||||
-- Set some global to describe the runtime environment, building on
|
||||
-- what was already set by the native code host
|
||||
|
||||
_PREMAKE_DIR = path.getdirectory(_PREMAKE_COMMAND)
|
||||
premake.path = premake.path .. ";" .. _PREMAKE_DIR
|
||||
premake.path = premake.path .. ";" .. _PREMAKE_DIR .. ";" .. _MAIN_SCRIPT_DIR
|
||||
end
|
||||
|
||||
p.callArray(p.main.elements)
|
||||
|
||||
-- Look for and run the system-wide configuration script; make sure any
|
||||
-- configuration scoping gets cleared before continuing
|
||||
---
|
||||
-- Load the required core modules that are shipped as part of Premake
|
||||
-- and expected to be present at startup.
|
||||
---
|
||||
|
||||
function m.preloadModules()
|
||||
for i = 1, #modules do
|
||||
local name = modules[i]
|
||||
local preload = name .. "/_preload.lua"
|
||||
local fn = os.locate("modules/" .. preload) or os.locate(preload)
|
||||
|
||||
if fn then
|
||||
include(fn)
|
||||
else
|
||||
require(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Look for and run the system-wide configuration script; make sure any
|
||||
-- configuration scoping gets cleared before continuing.
|
||||
---
|
||||
|
||||
function m.runSystemScript()
|
||||
dofileopt(_OPTIONS["systemscript"] or { "premake5-system.lua", "premake-system.lua" })
|
||||
filter {}
|
||||
|
||||
-- The "next-gen" actions have now replaced their deprecated counterparts.
|
||||
-- Provide a warning for a little while before I remove them entirely.
|
||||
|
||||
if _ACTION and _ACTION:endswith("ng") then
|
||||
premake.warnOnce(_ACTION, "'%s' has been deprecated; use '%s' instead", _ACTION, _ACTION:sub(1, -3))
|
||||
end
|
||||
|
||||
-- Set up the environment for the chosen action early, so side-effects
|
||||
-- can be picked up by the scripts.
|
||||
|
||||
premake.action.set(_ACTION)
|
||||
|
||||
-- If there is a project script available, run it to get the
|
||||
-- project information, available options and actions, etc.
|
||||
|
||||
if os.isfile(_MAIN_SCRIPT) then
|
||||
dofile(_MAIN_SCRIPT)
|
||||
end
|
||||
|
||||
-- Process special options
|
||||
|
||||
local action = premake.action.current()
|
||||
|
||||
if (_OPTIONS["version"]) then
|
||||
printf(versionhelp, _PREMAKE_VERSION)
|
||||
return 0
|
||||
end
|
||||
|
||||
if (_OPTIONS["help"]) then
|
||||
premake.showhelp()
|
||||
return 1
|
||||
end
|
||||
|
||||
-- Validate the command-line arguments. This has to happen after the
|
||||
-- script has run to allow for project-specific options
|
||||
|
||||
ok, err = premake.option.validate(_OPTIONS)
|
||||
if not ok then
|
||||
print("Error: " .. err)
|
||||
return 1
|
||||
end
|
||||
|
||||
-- If no further action is possible, show a short help message
|
||||
|
||||
if not _OPTIONS.interactive then
|
||||
if not _ACTION then
|
||||
print(shorthelp)
|
||||
return 1
|
||||
end
|
||||
|
||||
if not action then
|
||||
print("Error: no such action '" .. _ACTION .. "'")
|
||||
return 1
|
||||
end
|
||||
|
||||
if not os.isfile(_MAIN_SCRIPT) then
|
||||
print(string.format("No Premake script (%s) found!", path.getname(_MAIN_SCRIPT)))
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
-- "Bake" the project information, preparing it for use by the action
|
||||
|
||||
if action then
|
||||
print("Building configurations...")
|
||||
premake.oven.bake()
|
||||
end
|
||||
|
||||
-- Run the interactive prompt, if requested
|
||||
|
||||
if _OPTIONS.interactive then
|
||||
debug.prompt()
|
||||
end
|
||||
|
||||
-- Sanity check the current project setup
|
||||
|
||||
p.container.validate(p.api.rootContainer())
|
||||
|
||||
-- Hand over control to the action
|
||||
|
||||
printf("Running action '%s'...", action.trigger)
|
||||
premake.action.call(action.trigger)
|
||||
|
||||
print("Done.")
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Look for a user project script, and set up the related global
|
||||
-- variables if I can find one.
|
||||
---
|
||||
|
||||
function p.main.locateUserScript()
|
||||
function m.locateUserScript()
|
||||
local defaults = { "premake5.lua", "premake4.lua" }
|
||||
for i = 1, #defaults do
|
||||
if os.isfile(defaults[i]) then
|
||||
@ -173,41 +131,188 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Add a new module loader that knows how to use the Premake paths like
|
||||
-- PREMAKE_PATH and the --scripts option, and follows the module/module.lua
|
||||
-- naming convention.
|
||||
-- Set the action to be performed from the command line arguments.
|
||||
---
|
||||
|
||||
function p.main.moduleLoader(name)
|
||||
local dir = path.getdirectory(name)
|
||||
local base = path.getname(name)
|
||||
|
||||
if dir ~= "." then
|
||||
dir = dir .. "/" .. base
|
||||
else
|
||||
dir = base
|
||||
function m.prepareAction()
|
||||
-- The "next-gen" actions have now replaced their deprecated counterparts.
|
||||
-- Provide a warning for a little while before I remove them entirely.
|
||||
if _ACTION and _ACTION:endswith("ng") then
|
||||
premake.warnOnce(_ACTION, "'%s' has been deprecated; use '%s' instead", _ACTION, _ACTION:sub(1, -3))
|
||||
end
|
||||
|
||||
-- Premake standard is moduleName/moduleName.lua
|
||||
local relPath = dir .. "/" .. base .. ".lua"
|
||||
|
||||
local chunk = loadfile("modules/" .. relPath)
|
||||
if not chunk then
|
||||
chunk = loadfile(relPath)
|
||||
end
|
||||
if not chunk then
|
||||
chunk = loadfile(name .. ".lua")
|
||||
end
|
||||
|
||||
if not chunk then
|
||||
return "\n\tno file " .. name .. " on module paths"
|
||||
end
|
||||
|
||||
return chunk
|
||||
premake.action.set(_ACTION)
|
||||
end
|
||||
|
||||
function p.main.installModuleLoader()
|
||||
table.insert(package.loaders, 2, p.main.moduleLoader)
|
||||
|
||||
---
|
||||
-- If there is a project script available, run it to get the
|
||||
-- project information, available options and actions, etc.
|
||||
---
|
||||
|
||||
function m.runUserScript()
|
||||
if os.isfile(_MAIN_SCRIPT) then
|
||||
dofile(_MAIN_SCRIPT)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Run the interactive prompt, if requested.
|
||||
---
|
||||
|
||||
function m.checkInteractive()
|
||||
if _OPTIONS.interactive then
|
||||
debug.prompt()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Validate and process the command line options and arguments.
|
||||
---
|
||||
|
||||
function m.processCommandLine()
|
||||
-- Process special options
|
||||
if (_OPTIONS["version"]) then
|
||||
printf(versionhelp, _PREMAKE_VERSION)
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
if (_OPTIONS["help"]) then
|
||||
premake.showhelp()
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
-- Validate the command-line arguments. This has to happen after the
|
||||
-- script has run to allow for project-specific options
|
||||
ok, err = premake.option.validate(_OPTIONS)
|
||||
if not ok then
|
||||
print("Error: " .. err)
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
-- If no further action is possible, show a short help message
|
||||
if not _OPTIONS.interactive then
|
||||
if not _ACTION then
|
||||
print(shorthelp)
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
local action = premake.action.current()
|
||||
if not action then
|
||||
print("Error: no such action '" .. _ACTION .. "'")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
if p.action.isConfigurable() and not os.isfile(_MAIN_SCRIPT) then
|
||||
print(string.format("No Premake script (%s) found!", path.getname(_MAIN_SCRIPT)))
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Override point, for logic that should run before baking.
|
||||
---
|
||||
|
||||
function m.preBake()
|
||||
if p.action.isConfigurable() then
|
||||
print("Building configurations...")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- "Bake" the project information, preparing it for use by the action.
|
||||
---
|
||||
|
||||
function m.bake()
|
||||
if p.action.isConfigurable() then
|
||||
premake.oven.bake()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Override point, for logic that should run after baking but before
|
||||
-- the configurations are validated.
|
||||
---
|
||||
|
||||
function m.postBake()
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Sanity check the current project setup.
|
||||
---
|
||||
|
||||
function m.validate()
|
||||
if p.action.isConfigurable() then
|
||||
p.container.validate(p.api.rootContainer())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Override point, for logic that should run after validation and
|
||||
-- before the action takes control.
|
||||
---
|
||||
|
||||
function m.preAction()
|
||||
local action = premake.action.current()
|
||||
printf("Running action '%s'...", action.trigger)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Hand over control to the action.
|
||||
---
|
||||
|
||||
function m.callAction()
|
||||
local action = premake.action.current()
|
||||
premake.action.call(action.trigger)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Processing is complete.
|
||||
---
|
||||
|
||||
function m.postAction()
|
||||
if p.action.isConfigurable() then
|
||||
print("Done.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Script-side program entry point.
|
||||
--
|
||||
|
||||
m.elements = {
|
||||
m.installModuleLoader,
|
||||
m.locateUserScript,
|
||||
m.prepareEnvironment,
|
||||
m.preloadModules,
|
||||
m.runSystemScript,
|
||||
m.prepareAction,
|
||||
m.runUserScript,
|
||||
m.checkInteractive,
|
||||
m.processCommandLine,
|
||||
m.preBake,
|
||||
m.bake,
|
||||
m.postBake,
|
||||
m.validate,
|
||||
m.preAction,
|
||||
m.callAction,
|
||||
m.postAction,
|
||||
}
|
||||
|
||||
function _premake_main()
|
||||
p.callArray(m.elements)
|
||||
return 0
|
||||
end
|
||||
|
@ -380,7 +380,7 @@
|
||||
|
||||
|
||||
function make.defines(cfg, toolset)
|
||||
_p(' DEFINES +=%s', make.list(toolset.getdefines(cfg.defines)))
|
||||
_p(' DEFINES +=%s', make.list(table.join(toolset.getdefines(cfg.defines), toolset.getundefines(cfg.undefines))))
|
||||
end
|
||||
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
vstudio.vs200x_architectures =
|
||||
{
|
||||
x32 = "x86",
|
||||
x64 = "x64",
|
||||
x86 = "x86",
|
||||
x86_64 = "x64",
|
||||
xbox360 = "Xbox 360",
|
||||
}
|
||||
|
||||
@ -329,16 +329,17 @@
|
||||
---
|
||||
|
||||
function vstudio.getLinks(cfg, explicit)
|
||||
-- System libraries are undecorated, add the required extension
|
||||
local links = config.getlinks(cfg, "system", "fullpath")
|
||||
for i = 1, #links do
|
||||
links[i] = path.appendextension(links[i], ".lib")
|
||||
local links = {}
|
||||
|
||||
-- If we need sibling projects to be listed explicitly, grab them first
|
||||
if explicit then
|
||||
links = config.getlinks(cfg, "siblings", "fullpath")
|
||||
end
|
||||
|
||||
-- If we need sibling projects to be listed explicitly, add them on
|
||||
if explicit then
|
||||
local siblings = config.getlinks(cfg, "siblings", "fullpath")
|
||||
links = table.join(links, siblings)
|
||||
-- Then the system libraries, which come undecorated
|
||||
local system = config.getlinks(cfg, "system", "fullpath")
|
||||
for i = 1, #system do
|
||||
table.insert(links, path.appendextension(system[i], ".lib"))
|
||||
end
|
||||
|
||||
return links
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- actions/vstudio/vs2005.lua
|
||||
-- Add support for the Visual Studio 2005 project formats.
|
||||
-- Copyright (c) 2008-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2008-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake.vstudio.vs2005 = {}
|
||||
@ -31,10 +31,22 @@
|
||||
|
||||
if premake.project.isdotnet(prj) then
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
|
||||
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user)
|
||||
|
||||
-- Skip generation of empty user files
|
||||
local user = p.capture(function() vstudio.cs2005.generateUser(prj) end)
|
||||
if #user > 0 then
|
||||
p.generate(prj, ".csproj.user", function() p.outln(user) end)
|
||||
end
|
||||
|
||||
elseif premake.project.iscpp(prj) then
|
||||
premake.generate(prj, ".vcproj", vstudio.vc200x.generate)
|
||||
premake.generate(prj, ".vcproj.user", vstudio.vc200x.generate_user)
|
||||
|
||||
-- Skip generation of empty user files
|
||||
local user = p.capture(function() vstudio.vc200x.generateUser(prj) end)
|
||||
if #user > 0 then
|
||||
p.generate(prj, ".vcproj.user", function() p.outln(user) end)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,52 +1,90 @@
|
||||
--
|
||||
-- vs2005_csproj_user.lua
|
||||
-- Generate a Visual Studio 2005/2008 C# .user file.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local project = p.project
|
||||
local m = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 200x C# user file, with support for the new platforms API.
|
||||
-- Generate a Visual Studio 200x C# user file.
|
||||
--
|
||||
|
||||
function cs2005.generate_user(prj)
|
||||
p.vstudio.projectElement()
|
||||
_p(1,'<PropertyGroup>')
|
||||
m.elements.userProjectPropertyGroup = function()
|
||||
return {
|
||||
m.referencePath,
|
||||
}
|
||||
end
|
||||
|
||||
m.elements.userConfigPropertyGroup = function()
|
||||
return {
|
||||
m.localDebuggerCommandArguments,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
-- Only want output if there is something to configure
|
||||
local prjGroup = p.capture(function()
|
||||
p.push(2)
|
||||
p.callArray(m.elements.userProjectPropertyGroup, prj)
|
||||
p.pop(2)
|
||||
end)
|
||||
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(2)
|
||||
p.callArray(m.elements.userConfigPropertyGroup, cfg)
|
||||
p.pop(2)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if #prjGroup > 0 or size > 0 then
|
||||
p.vstudio.projectElement()
|
||||
|
||||
if #prjGroup > 0 then
|
||||
p.push('<PropertyGroup>')
|
||||
p.outln(prjGroup)
|
||||
p.pop('</PropertyGroup>')
|
||||
end
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
if #contents[cfg] > 0 then
|
||||
p.push('<PropertyGroup %s>', m.condition(cfg))
|
||||
p.outln(contents[cfg])
|
||||
p.pop('</PropertyGroup>')
|
||||
end
|
||||
end
|
||||
|
||||
p.pop('</Project>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Output any reference paths required by the project.
|
||||
---
|
||||
|
||||
function m.referencePath(prj)
|
||||
-- Per-configuration reference paths aren't supported (are they?) so just
|
||||
-- use the first configuration in the project
|
||||
local cfg = project.getfirstconfig(prj)
|
||||
|
||||
local refpaths = path.translate(project.getrelative(prj, cfg.libdirs))
|
||||
_p(2,'<ReferencePath>%s</ReferencePath>', table.concat(refpaths, ";"))
|
||||
|
||||
_p(' </PropertyGroup>')
|
||||
|
||||
for cfg in project.eachconfig(prj) do
|
||||
local contents = p.capture(function()
|
||||
cs2005.debugsettings(cfg)
|
||||
end)
|
||||
|
||||
if #contents > 0 then
|
||||
_p(1,'<PropertyGroup %s>', cs2005.condition(cfg))
|
||||
p.outln(contents)
|
||||
_p(1,'</PropertyGroup>')
|
||||
end
|
||||
local cfg = p.project.getfirstconfig(prj)
|
||||
local paths = path.translate(p.project.getrelative(prj, cfg.libdirs))
|
||||
if #paths > 0 then
|
||||
p.w('<ReferencePath>%s</ReferencePath>', table.concat(paths, ";"))
|
||||
end
|
||||
|
||||
_p('</Project>')
|
||||
end
|
||||
|
||||
function cs2005.debugsettings(cfg)
|
||||
cs2005.localDebuggerCommandArguments(cfg)
|
||||
end
|
||||
|
||||
function cs2005.localDebuggerCommandArguments(cfg)
|
||||
|
||||
function m.localDebuggerCommandArguments(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
_x(2,'<StartArguments>%s</StartArguments>', table.concat(cfg.debugargs, " "))
|
||||
p.x('<StartArguments>%s</StartArguments>', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
@ -460,6 +460,7 @@
|
||||
m.additionalIncludeDirectories,
|
||||
m.wholeProgramOptimization,
|
||||
m.preprocessorDefinitions,
|
||||
m.undefinePreprocessorDefinitions,
|
||||
m.minimalRebuild,
|
||||
m.basicRuntimeChecks,
|
||||
m.bufferSecurityCheck,
|
||||
@ -478,6 +479,7 @@
|
||||
m.detect64BitPortabilityProblems,
|
||||
m.debugInformationFormat,
|
||||
m.compileAs,
|
||||
m.disableSpecificWarnings,
|
||||
m.forcedIncludeFiles,
|
||||
m.omitDefaultLib,
|
||||
}
|
||||
@ -487,6 +489,7 @@
|
||||
m.additionalExternalCompilerOptions,
|
||||
m.additionalIncludeDirectories,
|
||||
m.preprocessorDefinitions,
|
||||
m.undefinePreprocessorDefinitions,
|
||||
m.usePrecompiledHeader,
|
||||
m.programDataBaseFileName,
|
||||
m.debugInformationFormat,
|
||||
@ -623,6 +626,7 @@
|
||||
m.cleanCommandLine,
|
||||
m.output,
|
||||
m.preprocessorDefinitions,
|
||||
m.undefinePreprocessorDefinitions,
|
||||
m.includeSearchPath,
|
||||
m.forcedIncludes,
|
||||
m.assemblySearchPath,
|
||||
@ -752,7 +756,7 @@
|
||||
if not cfg.editAndContinue or
|
||||
config.isOptimizedBuild(cfg) or
|
||||
cfg.clr ~= p.OFF or
|
||||
cfg.system == "x64"
|
||||
cfg.architecture == p.X86_64
|
||||
then
|
||||
return 3
|
||||
else
|
||||
@ -1001,6 +1005,14 @@
|
||||
|
||||
|
||||
|
||||
function m.disableSpecificWarnings(cfg)
|
||||
if #cfg.disablewarnings > 0 then
|
||||
p.x('DisableSpecificWarnings="%s"', table.concat(cfg.disablewarnings, ";"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.compileAsManaged(cfg)
|
||||
p.w('CompileAsManaged=""')
|
||||
end
|
||||
@ -1082,7 +1094,7 @@
|
||||
function m.enableEnhancedInstructionSet(cfg)
|
||||
local map = { SSE = "1", SSE2 = "2" }
|
||||
local value = map[cfg.vectorextensions]
|
||||
if value and cfg.system ~= "Xbox360" and cfg.architecture ~= "x64" then
|
||||
if value and cfg.system ~= "Xbox360" and cfg.architecture ~= "x86_64" then
|
||||
p.w('EnableEnhancedInstructionSet="%d"', value)
|
||||
end
|
||||
end
|
||||
@ -1393,6 +1405,12 @@
|
||||
end
|
||||
|
||||
|
||||
function m.undefinePreprocessorDefinitions(cfg)
|
||||
if #cfg.undefines > 0 then
|
||||
p.x('UndefinePreprocessorDefinitions="%s"', table.concat(cfg.undefines, ";"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.programDatabaseFile(cfg, toolset)
|
||||
if toolset then
|
||||
@ -1523,7 +1541,7 @@
|
||||
|
||||
|
||||
function m.targetEnvironment(cfg)
|
||||
if cfg.architecture == "x64" then
|
||||
if cfg.architecture == "x86_64" then
|
||||
p.w('TargetEnvironment="3"')
|
||||
end
|
||||
end
|
||||
@ -1546,7 +1564,7 @@
|
||||
|
||||
function m.targetMachine(cfg, toolset)
|
||||
if not toolset then
|
||||
p.w('TargetMachine="%d"', iif(cfg.architecture == "x64", 17, 1))
|
||||
p.w('TargetMachine="%d"', iif(cfg.architecture == "x86_64", 17, 1))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,79 +1,133 @@
|
||||
--
|
||||
-- vs200x_vcproj_user.lua
|
||||
-- Generate a Visual Studio 2002-2008 C/C++ project .user file
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local vstudio = premake.vstudio
|
||||
local project = p.project
|
||||
|
||||
local m = p.vstudio.vc200x
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 200x C++ user file, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function m.generate_user(prj)
|
||||
m.elements.user = function(cfg)
|
||||
return {
|
||||
m.debugSettings,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
p.indent("\t")
|
||||
m.xmlElement()
|
||||
|
||||
-- Only want output if there is something to configure
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(4)
|
||||
p.callArray(m.elements.user, cfg)
|
||||
p.pop(4)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if size > 0 then
|
||||
m.xmlElement()
|
||||
m.visualStudioUserFile()
|
||||
p.push('<Configurations>')
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
m.userConfiguration(cfg)
|
||||
p.push('<DebugSettings')
|
||||
if #contents[cfg] > 0 then
|
||||
p.outln(contents[cfg])
|
||||
end
|
||||
p.pop('/>')
|
||||
p.pop('</Configuration>')
|
||||
end
|
||||
p.pop('</Configurations>')
|
||||
p.pop('</VisualStudioUserFile>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Output the opening project tag.
|
||||
---
|
||||
|
||||
function m.visualStudioUserFile()
|
||||
p.push('<VisualStudioUserFile')
|
||||
p.w('ProjectType="Visual C++"')
|
||||
m.version()
|
||||
p.w('ShowAllFiles="false"')
|
||||
p.w('>')
|
||||
|
||||
p.push('<Configurations>')
|
||||
for cfg in project.eachconfig(prj) do
|
||||
m.userconfiguration(cfg)
|
||||
m.debugdir(cfg)
|
||||
p.pop('</Configuration>')
|
||||
end
|
||||
p.pop('</Configurations>')
|
||||
p.pop('</VisualStudioUserFile>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the <Configuration> element, describing a specific Premake
|
||||
-- build configuration/platform pairing.
|
||||
--
|
||||
|
||||
function m.userconfiguration(cfg)
|
||||
function m.userConfiguration(cfg)
|
||||
p.push('<Configuration')
|
||||
p.x('Name="%s"', vstudio.projectConfig(cfg))
|
||||
p.x('Name="%s"', p.vstudio.projectConfig(cfg))
|
||||
p.w('>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the debug settings for this project.
|
||||
--
|
||||
|
||||
function m.debugdir(cfg)
|
||||
p.push('<DebugSettings')
|
||||
m.elements.debugSettings = function(cfg)
|
||||
return {
|
||||
m.debugCommand,
|
||||
m.debugDir,
|
||||
m.debugArgs,
|
||||
m.debugEnvironment,
|
||||
}
|
||||
end
|
||||
|
||||
if cfg.debugcommand then
|
||||
local command = project.getrelative(cfg.project, cfg.debugcommand)
|
||||
p.x('Command="%s"', path.translate(command))
|
||||
end
|
||||
function m.debugSettings(cfg)
|
||||
p.callArray(m.elements.debugSettings, cfg)
|
||||
end
|
||||
|
||||
if cfg.debugdir then
|
||||
local debugdir = project.getrelative(cfg.project, cfg.debugdir)
|
||||
p.x('WorkingDirectory="%s"', path.translate(debugdir))
|
||||
end
|
||||
|
||||
function m.debugArgs(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
p.x('CommandArguments="%s"', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
local command = p.project.getrelative(cfg.project, cfg.debugcommand)
|
||||
p.x('Command="%s"', path.translate(command))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugDir(cfg)
|
||||
if cfg.debugdir then
|
||||
local debugdir = p.project.getrelative(cfg.project, cfg.debugdir)
|
||||
p.x('WorkingDirectory="%s"', path.translate(debugdir))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
p.x('Environment="%s"', table.concat(cfg.debugenvs, "\n"))
|
||||
if cfg.flags.DebugEnvsDontMerge then
|
||||
p.x('EnvironmentMerge="false"')
|
||||
end
|
||||
end
|
||||
|
||||
p.pop('/>')
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- actions/vstudio/vs2010.lua
|
||||
-- Add support for the Visual Studio 2010 project formats.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake.vstudio.vs2010 = {}
|
||||
@ -40,15 +40,27 @@
|
||||
|
||||
if premake.project.isdotnet(prj) then
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
|
||||
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user)
|
||||
|
||||
-- Skip generation of empty user files
|
||||
local user = p.capture(function() vstudio.cs2005.generateUser(prj) end)
|
||||
if #user > 0 then
|
||||
p.generate(prj, ".csproj.user", function() p.outln(user) end)
|
||||
end
|
||||
|
||||
elseif premake.project.iscpp(prj) then
|
||||
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate)
|
||||
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generateUser)
|
||||
|
||||
-- Skip generation of empty user files
|
||||
local user = p.capture(function() vstudio.vc2010.generateUser(prj) end)
|
||||
if #user > 0 then
|
||||
p.generate(prj, ".vcxproj.user", function() p.outln(user) end)
|
||||
end
|
||||
|
||||
-- Only generate a filters file if the source tree actually has subfolders
|
||||
if tree.hasbranches(project.getsourcetree(prj)) then
|
||||
premake.generate(prj, ".vcxproj.filters", vstudio.vc2010.generateFilters)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -109,13 +121,25 @@
|
||||
|
||||
-- Solution and project generation logic
|
||||
|
||||
onSolution = vstudio.vs2005.generateSolution,
|
||||
onProject = vstudio.vs2010.generateProject,
|
||||
onRule = vstudio.vs2010.generateRule,
|
||||
onSolution = function(sln)
|
||||
vstudio.vs2005.generateSolution(sln)
|
||||
end,
|
||||
onProject = function(prj)
|
||||
vstudio.vs2010.generateProject(prj)
|
||||
end,
|
||||
onRule = function(rule)
|
||||
vstudio.vs2010.generateRule(rule)
|
||||
end,
|
||||
|
||||
onCleanSolution = vstudio.cleanSolution,
|
||||
onCleanProject = vstudio.cleanProject,
|
||||
onCleanTarget = vstudio.cleanTarget,
|
||||
onCleanSolution = function(sln)
|
||||
vstudio.cleanSolution(sln)
|
||||
end,
|
||||
onCleanProject = function(prj)
|
||||
vstudio.cleanProject(prj)
|
||||
end,
|
||||
onCleanTarget = function(prj)
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
m.elements.project = function(r)
|
||||
return {
|
||||
p.xmlUtf8,
|
||||
p.vstudio.projectElement,
|
||||
m.targetsGroup,
|
||||
m.dependsOnGroup,
|
||||
@ -30,6 +29,7 @@
|
||||
end
|
||||
|
||||
function m.generate(r)
|
||||
p.xmlUtf8()
|
||||
p.callArray(m.elements.project, r)
|
||||
p.pop()
|
||||
p.out('</Project>')
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
m.elements.project = function(r)
|
||||
return {
|
||||
p.xmlUtf8,
|
||||
p.vstudio.projectElement,
|
||||
m.availableItemGroup,
|
||||
m.computeInputsGroup,
|
||||
@ -29,6 +28,7 @@
|
||||
end
|
||||
|
||||
function m.generate(r)
|
||||
p.xmlUtf8()
|
||||
p.callArray(m.elements.project, r)
|
||||
p.pop()
|
||||
p.out('</Project>')
|
||||
|
@ -291,8 +291,11 @@
|
||||
m.precompiledHeader,
|
||||
m.warningLevel,
|
||||
m.treatWarningAsError,
|
||||
m.disableSpecificWarnings,
|
||||
m.treatSpecificWarningsAsErrors,
|
||||
m.basicRuntimeChecks,
|
||||
m.clCompilePreprocessorDefinitions,
|
||||
m.clCompileUndefinePreprocessorDefinitions,
|
||||
m.clCompileAdditionalIncludeDirectories,
|
||||
m.clCompileAdditionalUsingDirectories,
|
||||
m.forceIncludes,
|
||||
@ -605,11 +608,14 @@
|
||||
local condition = m.condition(cfg)
|
||||
m.objectFileName(fcfg)
|
||||
m.clCompilePreprocessorDefinitions(fcfg, condition)
|
||||
m.clCompileUndefinePreprocessorDefinitions(fcfg, condition)
|
||||
m.optimization(fcfg, condition)
|
||||
m.forceIncludes(fcfg, condition)
|
||||
m.precompiledHeader(cfg, fcfg, condition)
|
||||
m.enableEnhancedInstructionSet(fcfg, condition)
|
||||
m.additionalCompileOptions(fcfg, condition)
|
||||
m.disableSpecificWarnings(fcfg, condition)
|
||||
m.treatSpecificWarningsAsErrors(fcfg, condition)
|
||||
end
|
||||
end
|
||||
p.pop()
|
||||
@ -961,6 +967,11 @@
|
||||
end
|
||||
|
||||
|
||||
function m.clCompileUndefinePreprocessorDefinitions(cfg, condition)
|
||||
m.undefinePreprocessorDefinitions(cfg, cfg.undefines, false, condition)
|
||||
end
|
||||
|
||||
|
||||
function m.clrSupport(cfg)
|
||||
local value
|
||||
if cfg.clr == "On" or cfg.clr == "Unsafe" then
|
||||
@ -1008,7 +1019,7 @@
|
||||
if cfg.flags.Symbols then
|
||||
if cfg.debugformat == "c7" then
|
||||
value = "OldStyle"
|
||||
elseif cfg.architecture == "x64" or
|
||||
elseif cfg.architecture == "x86_64" or
|
||||
cfg.clr ~= p.OFF or
|
||||
config.isOptimizedBuild(cfg) or
|
||||
not cfg.editAndContinue
|
||||
@ -1036,19 +1047,19 @@
|
||||
|
||||
|
||||
function m.enableEnhancedInstructionSet(cfg, condition)
|
||||
local value
|
||||
|
||||
local v
|
||||
local x = cfg.vectorextensions
|
||||
if _ACTION > "vc2010" and x == "AVX" then
|
||||
value = "AdvancedVectorExtensions"
|
||||
if x == "AVX" and _ACTION > "vs2010" then
|
||||
v = "AdvancedVectorExtensions"
|
||||
elseif x == "AVX2" and _ACTION > "vs2012" then
|
||||
v = "AdvancedVectorExtensions2"
|
||||
elseif x == "SSE2" then
|
||||
value = "StreamingSIMDExtensions2"
|
||||
v = "StreamingSIMDExtensions2"
|
||||
elseif x == "SSE" then
|
||||
value = "StreamingSIMDExtensions"
|
||||
v = "StreamingSIMDExtensions"
|
||||
end
|
||||
|
||||
if value then
|
||||
m.element('EnableEnhancedInstructionSet', condition, value)
|
||||
if v then
|
||||
m.element('EnableEnhancedInstructionSet', condition, v)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1385,8 +1396,8 @@
|
||||
|
||||
|
||||
function m.platformToolset(cfg)
|
||||
local map = { vs2012 = "v110", vs2013 = "v120" }
|
||||
local value = map[_ACTION]
|
||||
local action = premake.action.current()
|
||||
local value = action.vstudio.platformToolset
|
||||
if value then
|
||||
-- should only be written if there is a C/C++ file in the config
|
||||
for i = 1, #cfg.files do
|
||||
@ -1429,6 +1440,18 @@
|
||||
end
|
||||
|
||||
|
||||
function m.undefinePreprocessorDefinitions(cfg, undefines, escapeQuotes, condition)
|
||||
if #undefines > 0 then
|
||||
undefines = table.concat(undefines, ";")
|
||||
if escapeQuotes then
|
||||
undefines = undefines:gsub('"', '\\"')
|
||||
end
|
||||
undefines = premake.esc(undefines) .. ";%%(UndefinePreprocessorDefinitions)"
|
||||
m.element('UndefinePreprocessorDefinitions', condition, undefines)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.programDataBaseFileName(cfg)
|
||||
-- just a placeholder for overriding; will use the default VS name
|
||||
end
|
||||
@ -1595,6 +1618,24 @@
|
||||
end
|
||||
|
||||
|
||||
function m.disableSpecificWarnings(cfg, condition)
|
||||
if #cfg.disablewarnings > 0 then
|
||||
local warnings = table.concat(cfg.disablewarnings, ";")
|
||||
warnings = premake.esc(warnings) .. ";%%(DisableSpecificWarnings)"
|
||||
m.element('DisableSpecificWarnings', condition, warnings)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.treatSpecificWarningsAsErrors(cfg, condition)
|
||||
if #cfg.fatalwarnings > 0 then
|
||||
local fatal = table.concat(cfg.fatalwarnings, ";")
|
||||
fatal = premake.esc(fatal) .. ";%%(TreatSpecificWarningsAsErrors)"
|
||||
m.element('TreatSpecificWarningsAsErrors', condition, fatal)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.useDebugLibraries(cfg)
|
||||
local runtime = config.getruntime(cfg)
|
||||
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', tostring(runtime:endswith("Debug")))
|
||||
|
@ -1,36 +1,55 @@
|
||||
--
|
||||
-- vs2010_vcxproj_user.lua
|
||||
-- Generate a Visual Studio 201x C/C++ project .user file
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local vstudio = p.vstudio
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
local m = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 201x C++ user file, with support for the new platforms API.
|
||||
-- Generate a Visual Studio 201x C++ user file.
|
||||
--
|
||||
|
||||
m.elements.user = function(cfg)
|
||||
return {
|
||||
m.debugSettings,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
m.xmlDeclaration()
|
||||
m.userProject()
|
||||
for cfg in project.eachconfig(prj) do
|
||||
p.push('<PropertyGroup %s>', m.condition(cfg))
|
||||
m.debugSettings(cfg)
|
||||
p.pop('</PropertyGroup>')
|
||||
-- Only want output if there is something to configure
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(2)
|
||||
p.callArray(m.elements.user, cfg)
|
||||
p.pop(2)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if size > 0 then
|
||||
m.xmlDeclaration()
|
||||
m.userProject()
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
p.push('<PropertyGroup %s>', m.condition(cfg))
|
||||
if #contents[cfg] > 0 then
|
||||
p.outln(contents[cfg])
|
||||
end
|
||||
p.pop('</PropertyGroup>')
|
||||
end
|
||||
p.pop('</Project>')
|
||||
end
|
||||
_p('</Project>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Output the XML declaration and opening <Project> tag.
|
||||
-- Output the opening <Project> tag.
|
||||
--
|
||||
|
||||
function m.userProject()
|
||||
@ -41,24 +60,24 @@
|
||||
|
||||
|
||||
|
||||
vc2010.elements.debugSettings = function(cfg)
|
||||
m.elements.debugSettings = function(cfg)
|
||||
return {
|
||||
vc2010.localDebuggerCommand,
|
||||
vc2010.localDebuggerWorkingDirectory,
|
||||
vc2010.debuggerFlavor,
|
||||
vc2010.localDebuggerCommandArguments,
|
||||
vc2010.localDebuggerEnvironment,
|
||||
vc2010.localDebuggerMergeEnvironment,
|
||||
m.localDebuggerCommand,
|
||||
m.localDebuggerWorkingDirectory,
|
||||
m.debuggerFlavor,
|
||||
m.localDebuggerCommandArguments,
|
||||
m.localDebuggerEnvironment,
|
||||
m.localDebuggerMergeEnvironment,
|
||||
}
|
||||
end
|
||||
|
||||
function vc2010.debugSettings(cfg)
|
||||
p.callArray(vc2010.elements.debugSettings, cfg)
|
||||
function m.debugSettings(cfg)
|
||||
p.callArray(m.elements.debugSettings, cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function vc2010.debuggerFlavor(cfg)
|
||||
function m.debuggerFlavor(cfg)
|
||||
if cfg.debugdir or cfg.debugcommand then
|
||||
p.w('<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
|
||||
end
|
||||
@ -66,16 +85,16 @@
|
||||
|
||||
|
||||
|
||||
function vc2010.localDebuggerCommand(cfg)
|
||||
function m.localDebuggerCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
local dir = project.getrelative(cfg.project, cfg.debugcommand)
|
||||
local dir = p.project.getrelative(cfg.project, cfg.debugcommand)
|
||||
p.w('<LocalDebuggerCommand>%s</LocalDebuggerCommand>', path.translate(dir))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function vc2010.localDebuggerCommandArguments(cfg)
|
||||
function m.localDebuggerCommandArguments(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
p.x('<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
@ -83,16 +102,16 @@
|
||||
|
||||
|
||||
|
||||
function vc2010.localDebuggerWorkingDirectory(cfg)
|
||||
function m.localDebuggerWorkingDirectory(cfg)
|
||||
if cfg.debugdir then
|
||||
local dir = project.getrelative(cfg.project, cfg.debugdir)
|
||||
local dir = p.project.getrelative(cfg.project, cfg.debugdir)
|
||||
p.x('<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>', path.translate(dir))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function vc2010.localDebuggerEnvironment(cfg)
|
||||
function m.localDebuggerEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
local envs = table.concat(cfg.debugenvs, "\n")
|
||||
if cfg.flags.DebugEnvsInherit then
|
||||
@ -108,7 +127,7 @@
|
||||
|
||||
|
||||
|
||||
function vc2010.localDebuggerMergeEnvironment(cfg)
|
||||
function m.localDebuggerMergeEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 and cfg.flags.DebugEnvsDontMerge then
|
||||
p.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
|
||||
end
|
||||
|
@ -37,12 +37,22 @@
|
||||
|
||||
-- Solution and project generation logic
|
||||
|
||||
onSolution = vstudio.vs2005.generateSolution,
|
||||
onProject = vstudio.vs2010.generateProject,
|
||||
onSolution = function(sln)
|
||||
vstudio.vs2005.generateSolution(sln)
|
||||
end,
|
||||
onProject = function(prj)
|
||||
vstudio.vs2010.generateProject(prj)
|
||||
end,
|
||||
|
||||
onCleanSolution = vstudio.cleanSolution,
|
||||
onCleanProject = vstudio.cleanProject,
|
||||
onCleanTarget = vstudio.cleanTarget,
|
||||
onCleanSolution = function(sln)
|
||||
vstudio.cleanSolution(sln)
|
||||
end,
|
||||
onCleanProject = function(prj)
|
||||
vstudio.cleanProject(prj)
|
||||
end,
|
||||
onCleanTarget = function(prj)
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
|
||||
@ -53,6 +63,7 @@
|
||||
versionName = "2012",
|
||||
targetFramework = "4.5",
|
||||
toolsVersion = "4.0",
|
||||
platformToolset = "v110"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,22 @@
|
||||
|
||||
-- Solution and project generation logic
|
||||
|
||||
onSolution = vstudio.vs2005.generateSolution,
|
||||
onProject = vstudio.vs2010.generateProject,
|
||||
onSolution = function(sln)
|
||||
vstudio.vs2005.generateSolution(sln)
|
||||
end,
|
||||
onProject = function(prj)
|
||||
vstudio.vs2010.generateProject(prj)
|
||||
end,
|
||||
|
||||
onCleanSolution = vstudio.cleanSolution,
|
||||
onCleanProject = vstudio.cleanProject,
|
||||
onCleanTarget = vstudio.cleanTarget,
|
||||
onCleanSolution = function(sln)
|
||||
vstudio.cleanSolution(sln)
|
||||
end,
|
||||
onCleanProject = function(prj)
|
||||
vstudio.cleanProject(prj)
|
||||
end,
|
||||
onCleanTarget = function(prj)
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
|
||||
@ -56,5 +66,6 @@
|
||||
targetFramework = "4.5",
|
||||
toolsVersion = "12.0",
|
||||
filterToolsVersion = "4.0",
|
||||
platformToolset = "v120"
|
||||
}
|
||||
}
|
||||
|
71
src/actions/vstudio/vs2015.lua
Normal file
71
src/actions/vstudio/vs2015.lua
Normal file
@ -0,0 +1,71 @@
|
||||
--
|
||||
-- actions/vstudio/vs2015.lua
|
||||
-- Extend the existing exporters with support for Visual Studio 2015.
|
||||
-- Copyright (c) 2015-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake.vstudio.vc2015 = {}
|
||||
|
||||
local p = premake
|
||||
local vstudio = p.vstudio
|
||||
local vc2010 = vstudio.vc2010
|
||||
|
||||
local m = vstudio.vc2015
|
||||
|
||||
|
||||
---
|
||||
-- Define the Visual Studio 2015 export action.
|
||||
---
|
||||
|
||||
newaction {
|
||||
-- Metadata for the command line and help system
|
||||
|
||||
trigger = "vs2015",
|
||||
shortname = "Visual Studio 2015",
|
||||
description = "Generate Visual Studio 2015 project files",
|
||||
|
||||
-- Visual Studio always uses Windows path and naming conventions
|
||||
|
||||
os = "windows",
|
||||
|
||||
-- The capabilities of this action
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
valid_tools = {
|
||||
cc = { "msc" },
|
||||
dotnet = { "msnet" },
|
||||
},
|
||||
|
||||
-- Solution and project generation logic
|
||||
|
||||
onSolution = function(sln)
|
||||
vstudio.vs2005.generateSolution(sln)
|
||||
end,
|
||||
onProject = function(prj)
|
||||
vstudio.vs2010.generateProject(prj)
|
||||
end,
|
||||
|
||||
onCleanSolution = function(sln)
|
||||
vstudio.cleanSolution(sln)
|
||||
end,
|
||||
onCleanProject = function(prj)
|
||||
vstudio.cleanProject(prj)
|
||||
end,
|
||||
onCleanTarget = function(prj)
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
|
||||
-- This stuff is specific to the Visual Studio exporters
|
||||
|
||||
vstudio = {
|
||||
solutionVersion = "12",
|
||||
versionName = "2015",
|
||||
targetFramework = "4.5",
|
||||
toolsVersion = "14.0",
|
||||
filterToolsVersion = "4.0",
|
||||
platformToolset = "v140"
|
||||
}
|
||||
}
|
@ -40,8 +40,8 @@
|
||||
premake.UTILITY = "Utility"
|
||||
premake.WINDOWEDAPP = "WindowedApp"
|
||||
premake.WINDOWS = "windows"
|
||||
premake.X32 = "x32"
|
||||
premake.X64 = "x64"
|
||||
premake.X86 = "x86"
|
||||
premake.X86_64 = "x86_64"
|
||||
premake.XBOX360 = "xbox360"
|
||||
|
||||
|
||||
@ -211,3 +211,12 @@
|
||||
function printf(msg, ...)
|
||||
print(string.format(msg, unpack(arg)))
|
||||
end
|
||||
|
||||
--
|
||||
-- A shortcut for printing formatted output in verbose mode.
|
||||
--
|
||||
function verbosef(msg, ...)
|
||||
if _OPTIONS.verbose then
|
||||
print(string.format(msg, ...))
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
-- action.lua
|
||||
-- Work with the list of registered actions.
|
||||
-- Copyright (c) 2002-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local p = premake
|
||||
@ -25,6 +25,7 @@
|
||||
_ACTION = arg
|
||||
else
|
||||
table.insert(_ARGS, arg)
|
||||
_ARGS[arg] = arg
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -39,12 +40,12 @@
|
||||
action._list = {}
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Register a new action.
|
||||
--
|
||||
-- @param act
|
||||
-- The new action object.
|
||||
--
|
||||
---
|
||||
|
||||
function action.add(act)
|
||||
-- validate the action object, at least a little bit
|
||||
@ -60,19 +61,16 @@
|
||||
error(string.format('action "%s" needs a %s', name, missing), 3)
|
||||
end
|
||||
|
||||
-- add it to the master list
|
||||
action._list[act.trigger] = act
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Trigger an action.
|
||||
--
|
||||
-- @param name
|
||||
-- The name of the action to be triggered.
|
||||
-- @returns
|
||||
-- None.
|
||||
--
|
||||
---
|
||||
|
||||
function action.call(name)
|
||||
local act = action._list[name]
|
||||
@ -112,26 +110,26 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Retrieve the current action, as determined by _ACTION.
|
||||
--
|
||||
-- @return
|
||||
-- The current action, or nil if _ACTION is nil or does not match any action.
|
||||
--
|
||||
---
|
||||
|
||||
function action.current()
|
||||
return action.get(_ACTION)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Retrieve an action by name.
|
||||
--
|
||||
-- @param name
|
||||
-- The name of the action to retrieve.
|
||||
-- @returns
|
||||
-- The requested action, or nil if the action does not exist.
|
||||
--
|
||||
---
|
||||
|
||||
function action.get(name)
|
||||
-- "Next-gen" actions are deprecated
|
||||
@ -142,9 +140,9 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Iterator for the list of actions.
|
||||
--
|
||||
---
|
||||
|
||||
function action.each()
|
||||
-- sort the list by trigger
|
||||
@ -162,12 +160,34 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Determines if an action makes use of the configuration information
|
||||
-- provided by the project scripts (i.e. it is an exporter) or if it
|
||||
-- simply performs an action irregardless of configuration, in which
|
||||
-- case the baking and validation phases can be skipped.
|
||||
---
|
||||
|
||||
function action.isConfigurable(self)
|
||||
if not self then
|
||||
self = action.current() or {}
|
||||
end
|
||||
if self.onSolution or self.onsolution then
|
||||
return true
|
||||
end
|
||||
if self.onProject or self.onproject then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Activates a particular action.
|
||||
--
|
||||
-- @param name
|
||||
-- The name of the action to activate.
|
||||
--
|
||||
---
|
||||
|
||||
function action.set(name)
|
||||
_ACTION = name
|
||||
@ -177,54 +197,36 @@
|
||||
if act then
|
||||
_OS = act.os or _OS
|
||||
end
|
||||
|
||||
-- Some are implemented in standalone modules
|
||||
if act and act.module then
|
||||
require(act.module)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
---
|
||||
-- Determines if an action supports a particular language or target type.
|
||||
--
|
||||
-- @param act
|
||||
-- The action to test.
|
||||
-- @param feature
|
||||
-- The feature to check, either a programming language or a target type.
|
||||
-- @returns
|
||||
-- True if the feature is supported, false otherwise.
|
||||
--
|
||||
---
|
||||
|
||||
function action.supports(act, feature)
|
||||
if not act then
|
||||
function action.supports(self, feature)
|
||||
if not self then
|
||||
return false
|
||||
end
|
||||
if act.valid_languages then
|
||||
if table.contains(act.valid_languages, feature) then
|
||||
if self.valid_languages then
|
||||
if table.contains(self.valid_languages, feature) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if act.valid_kinds then
|
||||
if table.contains(act.valid_kinds, feature) then
|
||||
if self.valid_kinds then
|
||||
if table.contains(self.valid_kinds, feature) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Determines if an action supports a particular configuration.
|
||||
-- @return
|
||||
-- True if the configuration is supported, false otherwise.
|
||||
--
|
||||
|
||||
function action.supportsconfig(act, cfg)
|
||||
if not act then
|
||||
return false
|
||||
end
|
||||
|
||||
if act.supportsconfig then
|
||||
return act.supportsconfig(cfg)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -280,8 +280,8 @@
|
||||
end
|
||||
|
||||
-- If this is something I can link against, pull out the requested part
|
||||
|
||||
if item then
|
||||
-- dont link against my self
|
||||
if item and item ~= cfg then
|
||||
if part == "directory" then
|
||||
item = path.getdirectory(item)
|
||||
if item == "." then
|
||||
@ -320,8 +320,11 @@
|
||||
|
||||
function config.getruntime(cfg)
|
||||
local linkage = iif(cfg.flags.StaticRuntime, "Static", "Shared")
|
||||
local mode = iif(config.isDebugBuild(cfg) and not cfg.flags.ReleaseRuntime, "Debug", "Release")
|
||||
return linkage .. mode
|
||||
if (cfg.runtime == nil) then
|
||||
return linkage .. iif(config.isDebugBuild(cfg), "Debug", "Release")
|
||||
else
|
||||
return linkage .. cfg.runtime
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -5,11 +5,13 @@
|
||||
-- and wildcard matches. Provides functions match match these criteria
|
||||
-- against various contexts.
|
||||
--
|
||||
-- Copyright (c) 2012-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake.criteria = criteria
|
||||
local criteria = premake.criteria
|
||||
local p = premake
|
||||
|
||||
p.criteria = criteria -- criteria namespace is defined in C host
|
||||
local criteria = p.criteria
|
||||
|
||||
|
||||
--
|
||||
@ -19,14 +21,14 @@
|
||||
--
|
||||
|
||||
criteria._validPrefixes = {
|
||||
_ACTION = true,
|
||||
_action = true,
|
||||
action = true,
|
||||
architecture = true,
|
||||
configurations = true,
|
||||
files = true,
|
||||
kind = true,
|
||||
language = true,
|
||||
_OPTIONS = true,
|
||||
_options = true,
|
||||
options = true,
|
||||
platforms = true,
|
||||
system = true,
|
||||
@ -69,6 +71,15 @@
|
||||
if prefix and not criteria._validPrefixes[prefix] then
|
||||
return nil, string.format("Invalid field prefix '%s'", prefix)
|
||||
end
|
||||
|
||||
-- check for field value aliases
|
||||
if prefix then
|
||||
local fld = p.field.get(prefix)
|
||||
if fld and fld.aliases then
|
||||
word[1] = fld.aliases[word[1]] or word[1]
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(pattern, word)
|
||||
end
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
-- Lists to hold all of the registered fields and data kinds
|
||||
|
||||
field._list = {}
|
||||
field._loweredList = {}
|
||||
field._kinds = {}
|
||||
|
||||
-- For historical reasons
|
||||
@ -94,6 +95,8 @@
|
||||
end
|
||||
|
||||
field._list[f.name] = f
|
||||
field._loweredList[f.name:lower()] = f
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
@ -105,6 +108,7 @@
|
||||
|
||||
function field.unregister(f)
|
||||
field._list[f.name] = nil
|
||||
field._loweredList[f.name:lower()] = nil
|
||||
end
|
||||
|
||||
|
||||
@ -253,7 +257,7 @@
|
||||
---
|
||||
|
||||
function field.get(name)
|
||||
return field._list[name]
|
||||
return field._list[name] or field._loweredList[name:lower()]
|
||||
end
|
||||
|
||||
|
||||
|
@ -63,20 +63,23 @@
|
||||
return dirs
|
||||
end
|
||||
|
||||
function os.findlib(libname)
|
||||
function os.findlib(libname, libdirs)
|
||||
-- libname: library name with or without prefix and suffix
|
||||
-- libdirs: (array or string): A set of additional search paths
|
||||
|
||||
local path, formats
|
||||
|
||||
-- assemble a search path, depending on the platform
|
||||
if os.is("windows") then
|
||||
formats = { "%s.dll", "%s" }
|
||||
path = os.getenv("PATH")
|
||||
path = os.getenv("PATH") or ""
|
||||
elseif os.is("haiku") then
|
||||
formats = { "lib%s.so", "%s.so" }
|
||||
path = os.getenv("LIBRARY_PATH")
|
||||
path = os.getenv("LIBRARY_PATH") or ""
|
||||
else
|
||||
if os.is("macosx") then
|
||||
formats = { "lib%s.dylib", "%s.dylib" }
|
||||
path = os.getenv("DYLD_LIBRARY_PATH")
|
||||
path = os.getenv("DYLD_LIBRARY_PATH") or ""
|
||||
else
|
||||
formats = { "lib%s.so", "%s.so" }
|
||||
path = os.getenv("LD_LIBRARY_PATH") or ""
|
||||
@ -85,7 +88,11 @@
|
||||
local conf_file = prefix .. "/etc/ld.so.conf"
|
||||
if os.isfile(conf_file) then
|
||||
for _, v in ipairs(parse_ld_so_conf(conf_file)) do
|
||||
path = path .. ":" .. v
|
||||
if (#path > 0) then
|
||||
path = path .. ":" .. v
|
||||
else
|
||||
path = v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -93,12 +100,33 @@
|
||||
|
||||
table.insert(formats, "%s")
|
||||
path = path or ""
|
||||
local archpath = "/lib:/usr/lib:/usr/local/lib"
|
||||
if os.is64bit() then
|
||||
path = path .. ":/lib64:/usr/lib64/:usr/local/lib64"
|
||||
archpath = "/lib64:/usr/lib64/:usr/local/lib64" .. ":" .. archpath
|
||||
end
|
||||
if (#path > 0) then
|
||||
path = path .. ":" .. archpath
|
||||
else
|
||||
path = archpath
|
||||
end
|
||||
path = path .. ":/lib:/usr/lib:/usr/local/lib"
|
||||
end
|
||||
|
||||
local userpath = ""
|
||||
|
||||
if type(libdirs) == "string" then
|
||||
userpath = libdirs
|
||||
elseif type(libdirs) == "table" then
|
||||
userpath = table.implode(libdirs, "", "", ":")
|
||||
end
|
||||
|
||||
if (#userpath > 0) then
|
||||
if (#path > 0) then
|
||||
path = userpath .. ":" .. path
|
||||
else
|
||||
path = userpath
|
||||
end
|
||||
end
|
||||
|
||||
for _, fmt in ipairs(formats) do
|
||||
local name = string.format(fmt, libname)
|
||||
local result = os.pathsearch(name, path)
|
||||
@ -359,9 +387,12 @@
|
||||
|
||||
local pipe = io.popen(cmd)
|
||||
local result = pipe:read('*a')
|
||||
pipe:close()
|
||||
local b, exitcode = pipe:close()
|
||||
if not b then
|
||||
exitcode = -1
|
||||
end
|
||||
|
||||
return result
|
||||
return result, exitcode
|
||||
end
|
||||
|
||||
|
||||
|
@ -177,14 +177,7 @@
|
||||
local buildcfg = pairing[1]
|
||||
local platform = pairing[2]
|
||||
local cfg = oven.bakeConfig(self, buildcfg, platform)
|
||||
|
||||
-- Check to make sure this configuration is supported by the current
|
||||
-- action; add it to the project's configuration cache if so.
|
||||
|
||||
if p.action.supportsconfig(cfg) then
|
||||
self.configs[(buildcfg or "*") .. (platform or "")] = cfg
|
||||
end
|
||||
|
||||
self.configs[(buildcfg or "*") .. (platform or "")] = cfg
|
||||
end
|
||||
|
||||
-- Process the sub-objects that are contained by this project. The
|
||||
|
@ -210,6 +210,27 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Replace the file extension.
|
||||
--
|
||||
|
||||
function path.replaceextension(p, newext)
|
||||
local ext = path.getextension(p)
|
||||
|
||||
if not ext then
|
||||
return p
|
||||
end
|
||||
|
||||
if not newext:findlast(".", true) then
|
||||
newext = "."..newext
|
||||
end
|
||||
|
||||
return p:match("^(.*)"..ext.."$")..newext
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Converts from a simple wildcard syntax, where * is "match any"
|
||||
-- and ** is "match recursive", to the corresponding Lua pattern.
|
||||
|
@ -164,6 +164,7 @@
|
||||
_indentLevel = 0
|
||||
callback(obj)
|
||||
f:close()
|
||||
_indentLevel = 0
|
||||
end
|
||||
|
||||
|
||||
@ -338,10 +339,14 @@ end
|
||||
-- Write a opening XML element for a UTF-8 encoded file. Used by
|
||||
-- several different files for different actions, so makes sense
|
||||
-- to have a common call for it.
|
||||
--
|
||||
-- @param upper
|
||||
-- If true, the encoding is written in uppercase.
|
||||
---
|
||||
|
||||
function premake.xmlUtf8()
|
||||
premake.outln('<?xml version="1.0" encoding="utf-8"?>')
|
||||
function premake.xmlUtf8(upper)
|
||||
local encoding = iif(upper, "UTF-8", "utf-8")
|
||||
premake.w('<?xml version="1.0" encoding="%s"?>', encoding)
|
||||
end
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
--
|
||||
-- Returns an iterator function for the configuration objects contained by
|
||||
-- the project. Each configuration corresponds to a build configuration/
|
||||
-- platform pair (i.e. "Debug|x32") as specified in the solution.
|
||||
-- platform pair (i.e. "Debug|x86") as specified in the solution.
|
||||
--
|
||||
-- @param prj
|
||||
-- The project object to query.
|
||||
@ -176,7 +176,9 @@
|
||||
|
||||
for cfg in project.eachconfig(prj) do
|
||||
for _, link in ipairs(cfg.links) do
|
||||
add_to_project_list(cfg, link, result)
|
||||
if link ~= prj.name then
|
||||
add_to_project_list(cfg, link, result)
|
||||
end
|
||||
end
|
||||
if not linkOnly then
|
||||
for _, depproj in ipairs(cfg.dependson) do
|
||||
|
@ -317,3 +317,62 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Dumps a table to a string
|
||||
--
|
||||
function table.tostring(tab, recurse, indent)
|
||||
local res = ''
|
||||
|
||||
if not indent then
|
||||
indent = 0
|
||||
end
|
||||
|
||||
local format_value = function(k, v, i)
|
||||
formatting = string.rep("\t", i)
|
||||
|
||||
if k then
|
||||
if type(k) == "table" then
|
||||
k = '[table]'
|
||||
end
|
||||
formatting = formatting .. k .. ": "
|
||||
end
|
||||
|
||||
if not v then
|
||||
return formatting .. '(nil)'
|
||||
elseif type(v) == "table" then
|
||||
if recurse then
|
||||
return formatting .. '\n' .. table.tostring(v, recurse, i+1)
|
||||
else
|
||||
return formatting .. "<table>"
|
||||
end
|
||||
elseif type(v) == "function" then
|
||||
return formatting .. tostring(v)
|
||||
elseif type(v) == "userdata" then
|
||||
return formatting .. "<userdata>"
|
||||
elseif type(v) == "boolean" then
|
||||
if v then
|
||||
return formatting .. 'true'
|
||||
else
|
||||
return formatting .. 'false'
|
||||
end
|
||||
else
|
||||
return formatting .. v
|
||||
end
|
||||
end
|
||||
|
||||
if type(tab) == "table" then
|
||||
local first = true
|
||||
for k, v in pairs(tab) do
|
||||
if not first then
|
||||
res = res .. '\n'
|
||||
end
|
||||
|
||||
res = res .. format_value(k, v, indent)
|
||||
first = false
|
||||
end
|
||||
else
|
||||
res = res .. format_value(nil, tab, indent)
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
@ -105,11 +105,27 @@ static int io_noclose (lua_State *L) {
|
||||
/*
|
||||
** function to close 'popen' files
|
||||
*/
|
||||
/*
|
||||
* PREMAKE change: return both output and exit code
|
||||
*/
|
||||
static int io_pclose (lua_State *L) {
|
||||
FILE **p = tofilep(L);
|
||||
int ok = lua_pclose(L, *p);
|
||||
int result = lua_pclose(L, *p);
|
||||
*p = NULL;
|
||||
return pushresult(L, ok, NULL);
|
||||
if (result == -1) {
|
||||
/*
|
||||
* pclose call failure
|
||||
*/
|
||||
return pushresult(L, 0, NULL);
|
||||
}
|
||||
lua_pushboolean(L, 1);
|
||||
/**
|
||||
* On success, pcluse returns a 2 byte length integer
|
||||
* where the higher byte contains the command exit code
|
||||
*/
|
||||
result /= 255;
|
||||
lua_pushinteger(L, result);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -668,12 +668,18 @@ union luai_Cast { double l_d; long l_l; };
|
||||
#if defined(LUA_USE_POPEN)
|
||||
|
||||
#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
|
||||
#define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
|
||||
/*
|
||||
* PREMAKE change: get pclose return value
|
||||
*/
|
||||
#define lua_pclose(L,file) ((void)L, (pclose(file)))
|
||||
|
||||
#elif defined(LUA_WIN)
|
||||
|
||||
#define lua_popen(L,c,m) ((void)L, _popen(c,m))
|
||||
#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
|
||||
/*
|
||||
* PREMAKE change: get pclose return value
|
||||
*/
|
||||
#define lua_pclose(L,file) ((void)L, (_pclose(file)))
|
||||
|
||||
#else
|
||||
|
||||
|
@ -13,6 +13,7 @@ int path_normalize(lua_State* L)
|
||||
char buffer[0x4000];
|
||||
char* src;
|
||||
char* dst;
|
||||
char* ptr;
|
||||
char last;
|
||||
|
||||
const char* path = luaL_checkstring(L, 1);
|
||||
@ -30,6 +31,22 @@ int path_normalize(lua_State* L)
|
||||
ch = '/';
|
||||
}
|
||||
|
||||
/* filter out .. */
|
||||
if (ch == '.' && last == '.') {
|
||||
ptr = dst - 3;
|
||||
while (ptr >= buffer) {
|
||||
if (ptr[0] == '/' && ptr[1] != '.' && ptr[2] != '.') {
|
||||
dst = ptr;
|
||||
break;
|
||||
}
|
||||
--ptr;
|
||||
}
|
||||
if (ptr >= buffer) {
|
||||
++src;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* add to the result, filtering out duplicate slashes */
|
||||
if (ch != '/' || last != '/') {
|
||||
*(dst++) = ch;
|
||||
|
@ -14,9 +14,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define VERSION "5.0-alpha1"
|
||||
#define COPYRIGHT "Copyright (C) 2002-2014 Jason Perkins and the Premake Project"
|
||||
#define PROJECT_URL "https://bitbucket.org/premake/premake-dev/wiki"
|
||||
#define VERSION "5.0-alpha2"
|
||||
#define COPYRIGHT "Copyright (C) 2002-2015 Jason Perkins and the Premake Project"
|
||||
#define PROJECT_URL "https://github.com/premake/premake-core/wiki"
|
||||
#define ERROR_MESSAGE "Error: %s\n"
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ static const luaL_Reg os_functions[] = {
|
||||
static const luaL_Reg string_functions[] = {
|
||||
{ "endswith", string_endswith },
|
||||
{ "hash", string_hash },
|
||||
{ "sha1", string_sha1 },
|
||||
{ "startswith", string_startswith },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@ -118,6 +118,7 @@ int os_stat(lua_State* L);
|
||||
int os_uuid(lua_State* L);
|
||||
int string_endswith(lua_State* L);
|
||||
int string_hash(lua_State* L);
|
||||
int string_sha1(lua_State* L);
|
||||
int string_startswith(lua_State* L);
|
||||
|
||||
/* Engine interface */
|
||||
|
185
src/host/string_sha1.c
Normal file
185
src/host/string_sha1.c
Normal file
@ -0,0 +1,185 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "premake.h"
|
||||
|
||||
#define HASH_LENGTH 20
|
||||
#define BLOCK_LENGTH 64
|
||||
|
||||
typedef struct sha1nfo {
|
||||
uint32_t buffer[BLOCK_LENGTH / 4];
|
||||
uint32_t state[HASH_LENGTH / 4];
|
||||
uint32_t byteCount;
|
||||
uint8_t bufferOffset;
|
||||
uint8_t keyBuffer[BLOCK_LENGTH];
|
||||
uint8_t innerHash[HASH_LENGTH];
|
||||
} sha1nfo;
|
||||
|
||||
/* public API - prototypes - TODO: doxygen*/
|
||||
void sha1_init(sha1nfo *s);
|
||||
void sha1_writebyte(sha1nfo *s, uint8_t data);
|
||||
void sha1_write(sha1nfo *s, const char *data, size_t len);
|
||||
uint8_t* sha1_result(sha1nfo *s);
|
||||
|
||||
/* code */
|
||||
#define SHA1_K0 0x5a827999
|
||||
#define SHA1_K20 0x6ed9eba1
|
||||
#define SHA1_K40 0x8f1bbcdc
|
||||
#define SHA1_K60 0xca62c1d6
|
||||
|
||||
void sha1_init(sha1nfo *s)
|
||||
{
|
||||
s->state[0] = 0x67452301;
|
||||
s->state[1] = 0xefcdab89;
|
||||
s->state[2] = 0x98badcfe;
|
||||
s->state[3] = 0x10325476;
|
||||
s->state[4] = 0xc3d2e1f0;
|
||||
s->byteCount = 0;
|
||||
s->bufferOffset = 0;
|
||||
}
|
||||
|
||||
uint32_t sha1_rol32(uint32_t number, uint8_t bits)
|
||||
{
|
||||
return ((number << bits) | (number >> (32 - bits)));
|
||||
}
|
||||
|
||||
void sha1_hashBlock(sha1nfo *s)
|
||||
{
|
||||
uint8_t i;
|
||||
uint32_t a, b, c, d, e, t;
|
||||
|
||||
a = s->state[0];
|
||||
b = s->state[1];
|
||||
c = s->state[2];
|
||||
d = s->state[3];
|
||||
e = s->state[4];
|
||||
for (i = 0; i < 80; i++)
|
||||
{
|
||||
if (i >= 16)
|
||||
{
|
||||
t = s->buffer[(i + 13) & 15] ^ s->buffer[(i + 8) & 15] ^ s->buffer[(i + 2) & 15] ^ s->buffer[i & 15];
|
||||
s->buffer[i & 15] = sha1_rol32(t, 1);
|
||||
}
|
||||
if (i < 20)
|
||||
{
|
||||
t = (d ^ (b & (c ^ d))) + SHA1_K0;
|
||||
}
|
||||
else if (i < 40)
|
||||
{
|
||||
t = (b ^ c ^ d) + SHA1_K20;
|
||||
}
|
||||
else if (i < 60)
|
||||
{
|
||||
t = ((b & c) | (d & (b | c))) + SHA1_K40;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (b ^ c ^ d) + SHA1_K60;
|
||||
}
|
||||
t += sha1_rol32(a, 5) + e + s->buffer[i & 15];
|
||||
e = d;
|
||||
d = c;
|
||||
c = sha1_rol32(b, 30);
|
||||
b = a;
|
||||
a = t;
|
||||
}
|
||||
s->state[0] += a;
|
||||
s->state[1] += b;
|
||||
s->state[2] += c;
|
||||
s->state[3] += d;
|
||||
s->state[4] += e;
|
||||
}
|
||||
|
||||
void sha1_addUncounted(sha1nfo *s, uint8_t data)
|
||||
{
|
||||
uint8_t * const b = (uint8_t*)s->buffer;
|
||||
b[s->bufferOffset ^ 3] = data;
|
||||
s->bufferOffset++;
|
||||
if (s->bufferOffset == BLOCK_LENGTH)
|
||||
{
|
||||
sha1_hashBlock(s);
|
||||
s->bufferOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sha1_writebyte(sha1nfo *s, uint8_t data)
|
||||
{
|
||||
++s->byteCount;
|
||||
sha1_addUncounted(s, data);
|
||||
}
|
||||
|
||||
void sha1_write(sha1nfo *s, const char *data, size_t len)
|
||||
{
|
||||
for (; len--;) sha1_writebyte(s, (uint8_t)*data++);
|
||||
}
|
||||
|
||||
void sha1_pad(sha1nfo *s)
|
||||
{
|
||||
// Implement SHA-1 padding (fips180-2 §5.1.1)
|
||||
|
||||
// Pad with 0x80 followed by 0x00 until the end of the block
|
||||
sha1_addUncounted(s, 0x80);
|
||||
while (s->bufferOffset != 56) sha1_addUncounted(s, 0x00);
|
||||
|
||||
// Append length in the last 8 bytes
|
||||
sha1_addUncounted(s, 0); // We're only using 32 bit lengths
|
||||
sha1_addUncounted(s, 0); // But SHA-1 supports 64 bit lengths
|
||||
sha1_addUncounted(s, 0); // So zero pad the top bits
|
||||
sha1_addUncounted(s, s->byteCount >> 29); // Shifting to multiply by 8
|
||||
sha1_addUncounted(s, (uint8_t)(s->byteCount >> 21)); // as SHA-1 supports bitstreams as well as
|
||||
sha1_addUncounted(s, (uint8_t)(s->byteCount >> 13)); // byte.
|
||||
sha1_addUncounted(s, (uint8_t)(s->byteCount >> 5));
|
||||
sha1_addUncounted(s, (uint8_t)(s->byteCount << 3));
|
||||
}
|
||||
|
||||
uint8_t* sha1_result(sha1nfo *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Pad to complete the last block
|
||||
sha1_pad(s);
|
||||
|
||||
// Swap byte order back
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
s->state[i] =
|
||||
(((s->state[i]) << 24) & 0xff000000)
|
||||
| (((s->state[i]) << 8) & 0x00ff0000)
|
||||
| (((s->state[i]) >> 8) & 0x0000ff00)
|
||||
| (((s->state[i]) >> 24) & 0x000000ff);
|
||||
}
|
||||
|
||||
// Return pointer to hash (20 characters)
|
||||
return (uint8_t*)s->state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int string_sha1(lua_State* L)
|
||||
{
|
||||
static const char* g_int2hex = "0123456789ABCDEF";
|
||||
uint8_t* result;
|
||||
size_t l;
|
||||
sha1nfo s;
|
||||
int i;
|
||||
char output[41];
|
||||
|
||||
const char *str = luaL_checklstring(L, 1, &l);
|
||||
if (str != NULL)
|
||||
{
|
||||
sha1_init(&s);
|
||||
sha1_write(&s, str, l);
|
||||
result = sha1_result(&s);
|
||||
|
||||
for (i = 0; i < 20; ++i)
|
||||
{
|
||||
output[i * 2 + 0] = g_int2hex[result[i] & 0x0f];
|
||||
output[i * 2 + 1] = g_int2hex[result[i] >> 4];
|
||||
}
|
||||
output[40] = 0;
|
||||
|
||||
lua_pushlstring(L, output, 40);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -89,6 +89,14 @@
|
||||
|
||||
end
|
||||
|
||||
function clang.getundefines(undefines)
|
||||
|
||||
-- Just pass through to GCC for now
|
||||
local flags = gcc.getundefines(undefines)
|
||||
return flags
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
@ -144,8 +152,8 @@
|
||||
|
||||
clang.ldflags = {
|
||||
architecture = {
|
||||
x32 = "-m32",
|
||||
x64 = "-m64",
|
||||
x86 = "-m32",
|
||||
x86_64 = "-m64",
|
||||
},
|
||||
kind = {
|
||||
SharedLib = function(cfg)
|
||||
|
@ -34,8 +34,8 @@
|
||||
|
||||
gcc.cflags = {
|
||||
architecture = {
|
||||
x32 = "-m32",
|
||||
x64 = "-m64",
|
||||
x86 = "-m32",
|
||||
x86_64 = "-m64",
|
||||
},
|
||||
flags = {
|
||||
FatalCompileWarnings = "-Werror",
|
||||
@ -48,11 +48,6 @@
|
||||
Fast = "-ffast-math",
|
||||
Strict = "-ffloat-store",
|
||||
},
|
||||
kind = {
|
||||
SharedLib = function(cfg)
|
||||
if cfg.system ~= premake.WINDOWS then return "-fPIC" end
|
||||
end,
|
||||
},
|
||||
strictaliasing = {
|
||||
Off = "-fno-strict-aliasing",
|
||||
Level1 = { "-fstrict-aliasing", "-Wstrict-aliasing=1" },
|
||||
@ -67,8 +62,12 @@
|
||||
Size = "-Os",
|
||||
Speed = "-O3",
|
||||
},
|
||||
pic = {
|
||||
On = "-fPIC",
|
||||
},
|
||||
vectorextensions = {
|
||||
AVX = "-mavx",
|
||||
AVX2 = "-mavx2",
|
||||
SSE = "-msse",
|
||||
SSE2 = "-msse2",
|
||||
},
|
||||
@ -80,9 +79,24 @@
|
||||
|
||||
function gcc.getcflags(cfg)
|
||||
local flags = config.mapFlags(cfg, gcc.cflags)
|
||||
flags = table.join(flags, gcc.getwarnings(cfg))
|
||||
return flags
|
||||
end
|
||||
|
||||
function gcc.getwarnings(cfg)
|
||||
local result = {}
|
||||
for _, enable in ipairs(cfg.enablewarnings) do
|
||||
table.insert(result, '-W' .. enable)
|
||||
end
|
||||
for _, disable in ipairs(cfg.disablewarnings) do
|
||||
table.insert(result, '-Wno-' .. disable)
|
||||
end
|
||||
for _, fatal in ipairs(cfg.fatalwarnings) do
|
||||
table.insert(result, '-Werror=' .. fatal)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Returns list of C++ compiler flags for a configuration.
|
||||
@ -92,7 +106,9 @@
|
||||
flags = {
|
||||
NoExceptions = "-fno-exceptions",
|
||||
NoRTTI = "-fno-rtti",
|
||||
NoBufferSecurityCheck = "-fno-stack-protector"
|
||||
NoBufferSecurityCheck = "-fno-stack-protector",
|
||||
["C++11"] = "-std=c++11",
|
||||
["C++14"] = "-std=c++14",
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,6 +130,14 @@
|
||||
return result
|
||||
end
|
||||
|
||||
function gcc.getundefines(undefines)
|
||||
local result = {}
|
||||
for _, undefine in ipairs(undefines) do
|
||||
table.insert(result, '-U' .. undefine)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Returns a list of forced include files, decorated for the compiler
|
||||
@ -157,8 +181,8 @@
|
||||
|
||||
gcc.ldflags = {
|
||||
architecture = {
|
||||
x32 = "-m32",
|
||||
x64 = "-m64",
|
||||
x86 = "-m32",
|
||||
x86_64 = "-m64",
|
||||
},
|
||||
flags = {
|
||||
_Symbols = function(cfg)
|
||||
@ -196,8 +220,8 @@
|
||||
|
||||
gcc.libraryDirectories = {
|
||||
architecture = {
|
||||
x32 = "-L/usr/lib32",
|
||||
x64 = "-L/usr/lib64",
|
||||
x86 = "-L/usr/lib32",
|
||||
x86_64 = "-L/usr/lib64",
|
||||
},
|
||||
system = {
|
||||
wii = "-L$(LIBOGC_LIB)",
|
||||
@ -213,6 +237,15 @@
|
||||
table.insert(flags, '-L' .. project.getrelative(cfg.project, dir))
|
||||
end
|
||||
|
||||
if cfg.flags.RelativeLinks then
|
||||
for _, dir in ipairs(premake.config.getlinks(cfg, "siblings", "directory")) do
|
||||
local libFlag = "-L" .. premake.project.getrelative(cfg.project, dir)
|
||||
if not table.contains(flags, libFlag) then
|
||||
table.insert(flags, libFlag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return flags
|
||||
end
|
||||
|
||||
@ -225,12 +258,21 @@
|
||||
function gcc.getlinks(cfg, systemonly)
|
||||
local result = {}
|
||||
|
||||
-- Don't use the -l form for sibling libraries, since they may have
|
||||
-- custom prefixes or extensions that will confuse the linker. Instead
|
||||
-- just list out the full relative path to the library.
|
||||
|
||||
if not systemonly then
|
||||
result = config.getlinks(cfg, "siblings", "fullpath")
|
||||
if cfg.flags.RelativeLinks then
|
||||
local libFiles = premake.config.getlinks(cfg, "siblings", "basename")
|
||||
for _, link in ipairs(libFiles) do
|
||||
if string.find(link, "lib") == 1 then
|
||||
link = link:sub(4)
|
||||
end
|
||||
table.insert(result, "-l" .. link)
|
||||
end
|
||||
else
|
||||
-- Don't use the -l form for sibling libraries, since they may have
|
||||
-- custom prefixes or extensions that will confuse the linker. Instead
|
||||
-- just list out the full relative path to the library.
|
||||
result = config.getlinks(cfg, "siblings", "fullpath")
|
||||
end
|
||||
end
|
||||
|
||||
-- The "-l" flag is fine for system libraries
|
||||
@ -285,14 +327,18 @@
|
||||
--
|
||||
|
||||
gcc.tools = {
|
||||
cc = "gcc",
|
||||
cxx = "g++",
|
||||
ar = "ar",
|
||||
rc = "windres"
|
||||
}
|
||||
|
||||
function gcc.gettoolname(cfg, tool)
|
||||
local names = gcc.tools[cfg.architecture] or gcc.tools[cfg.system] or {}
|
||||
local name = names[tool]
|
||||
|
||||
if tool == "rc" then
|
||||
name = name or "windres"
|
||||
if not name and (tool == "rc" or cfg.gccprefix) and gcc.tools[tool] then
|
||||
name = (cfg.gccprefix or "") .. gcc.tools[tool]
|
||||
end
|
||||
|
||||
return name
|
||||
|
@ -54,8 +54,9 @@
|
||||
},
|
||||
vectorextensions = {
|
||||
AVX = "/arch:AVX",
|
||||
SSE = "/arch:sse",
|
||||
SSE2 = "/arch:sse2",
|
||||
AVX2 = "/arch:AVX2",
|
||||
SSE = "/arch:SSE",
|
||||
SSE2 = "/arch:SSE2",
|
||||
},
|
||||
warnings = {
|
||||
Extra = "/W4",
|
||||
@ -66,6 +67,8 @@
|
||||
function msc.getcflags(cfg)
|
||||
local flags = config.mapFlags(cfg, msc.cflags)
|
||||
|
||||
flags = table.join(flags, msc.getwarnings(cfg))
|
||||
|
||||
local runtime = iif(cfg.flags.StaticRuntime, "/MT", "/MD")
|
||||
if config.isDebugBuild(cfg) then
|
||||
runtime = runtime .. "d"
|
||||
@ -75,6 +78,18 @@
|
||||
return flags
|
||||
end
|
||||
|
||||
function msc.getwarnings(cfg)
|
||||
local result = {}
|
||||
-- NOTE: VStudio can't enable specific warnings (workaround?)
|
||||
for _, disable in ipairs(cfg.disablewarnings) do
|
||||
table.insert(result, '/wd"' .. disable .. '"')
|
||||
end
|
||||
for _, fatal in ipairs(cfg.fatalwarnings) do
|
||||
table.insert(result, '/we"' .. fatal .. '"')
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Returns list of C++ compiler flags for a configuration.
|
||||
@ -104,7 +119,15 @@
|
||||
function msc.getdefines(defines)
|
||||
local result = {}
|
||||
for _, define in ipairs(defines) do
|
||||
table.insert(result, '-D' .. define)
|
||||
table.insert(result, '/D"' .. define .. '"')
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function msc.getundefines(undefines)
|
||||
local result = {}
|
||||
for _, undefine in ipairs(undefines) do
|
||||
table.insert(result, '/U"' .. undefine .. '"')
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
@ -6,6 +6,7 @@ return {
|
||||
"base/test_criteria.lua",
|
||||
"base/test_detoken.lua",
|
||||
"base/test_include.lua",
|
||||
"base/test_module_loader.lua",
|
||||
"base/test_option.lua",
|
||||
"base/test_os.lua",
|
||||
"base/test_override.lua",
|
||||
@ -55,7 +56,7 @@ return {
|
||||
"tools/test_gcc.lua",
|
||||
"tools/test_msc.lua",
|
||||
|
||||
-- Visual Studio 2005-2010 C# projects
|
||||
-- Visual Studio 2005-2013 C# projects
|
||||
"actions/vstudio/cs2005/test_assembly_refs.lua",
|
||||
"actions/vstudio/cs2005/test_build_events.lua",
|
||||
"actions/vstudio/cs2005/test_common_props.lua",
|
||||
@ -69,8 +70,9 @@ return {
|
||||
"actions/vstudio/cs2005/test_project_refs.lua",
|
||||
"actions/vstudio/cs2005/projectsettings.lua",
|
||||
"actions/vstudio/cs2005/test_targets.lua",
|
||||
"actions/vstudio/cs2005/test_user_file.lua",
|
||||
|
||||
-- Visual Studio 2005-2010 solutions
|
||||
-- Visual Studio 2005-2013 solutions
|
||||
"actions/vstudio/sln2005/test_dependencies.lua",
|
||||
"actions/vstudio/sln2005/test_header.lua",
|
||||
"actions/vstudio/sln2005/test_nested_projects.lua",
|
||||
@ -92,8 +94,9 @@ return {
|
||||
"actions/vstudio/vc200x/test_project.lua",
|
||||
"actions/vstudio/vc200x/test_project_refs.lua",
|
||||
"actions/vstudio/vc200x/test_resource_compiler.lua",
|
||||
"actions/vstudio/vc200x/test_user_file.lua",
|
||||
|
||||
-- Visual Studio 2010 C/C++ projects
|
||||
-- Visual Studio 2010-2013 C/C++ projects
|
||||
"actions/vstudio/vc2010/test_assembly_refs.lua",
|
||||
"actions/vstudio/vc2010/test_build_events.lua",
|
||||
"actions/vstudio/vc2010/test_compile_settings.lua",
|
||||
@ -102,6 +105,7 @@ return {
|
||||
"actions/vstudio/vc2010/test_excluded_configs.lua",
|
||||
"actions/vstudio/vc2010/test_extension_settings.lua",
|
||||
"actions/vstudio/vc2010/test_extension_targets.lua",
|
||||
"actions/vstudio/vc2010/test_floatingpoint.lua",
|
||||
"actions/vstudio/vc2010/test_globals.lua",
|
||||
"actions/vstudio/vc2010/test_header.lua",
|
||||
"actions/vstudio/vc2010/test_files.lua",
|
||||
@ -118,6 +122,8 @@ return {
|
||||
"actions/vstudio/vc2010/test_prop_sheet.lua",
|
||||
"actions/vstudio/vc2010/test_resource_compile.lua",
|
||||
"actions/vstudio/vc2010/test_rule_vars.lua",
|
||||
"actions/vstudio/vc2010/test_user_file.lua",
|
||||
"actions/vstudio/vc2010/test_vectorextensions.lua",
|
||||
|
||||
-- Makefile tests
|
||||
"actions/make/test_make_escaping.lua",
|
||||
|
@ -124,6 +124,26 @@
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check a linking to a sibling shared library using -l and -L.
|
||||
--
|
||||
|
||||
function suite.links_onSiblingSharedLib()
|
||||
links "MyProject2"
|
||||
flags { "RelativeLinks" }
|
||||
|
||||
test.createproject(sln)
|
||||
kind "SharedLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -Lbuild -s
|
||||
LIBS += -lMyProject2
|
||||
LDDEPS += build/libMyProject2.so
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- When referencing an external library via a path, the directory
|
||||
-- should be added to the library search paths, and the library
|
||||
|
@ -36,18 +36,18 @@
|
||||
--
|
||||
|
||||
function suite.groupRule_groupAsPhony()
|
||||
prepare()
|
||||
prepare()
|
||||
make.solutionPhonyRule(sln)
|
||||
test.capture [[
|
||||
.PHONY: all clean help $(PROJECTS) MainGroup MainGroup/SubGroup1 MainGroup/SubGroup2
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Transform solution groups into target aggregate
|
||||
--
|
||||
function suite.groupRule_groupRules()
|
||||
prepare()
|
||||
prepare()
|
||||
make.groupRules(sln)
|
||||
test.capture [[
|
||||
MainGroup: MainGroup/SubGroup1 MainGroup/SubGroup2 MyProject2
|
||||
|
@ -65,12 +65,10 @@
|
||||
|
||||
function suite.debugStartArguments()
|
||||
debugargs "foobar"
|
||||
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
cs2005.debugsettings(cfg)
|
||||
|
||||
cs2005.localDebuggerCommandArguments(cfg)
|
||||
test.capture [[
|
||||
<StartArguments>foobar</StartArguments>
|
||||
<StartArguments>foobar</StartArguments>
|
||||
]]
|
||||
end
|
||||
|
||||
|
@ -71,8 +71,8 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onX32()
|
||||
prepare("x32")
|
||||
function suite.onX86()
|
||||
prepare("x86")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@ -80,8 +80,8 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.onX64()
|
||||
prepare("x64")
|
||||
function suite.onX86_64()
|
||||
prepare("x86_64")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
|
49
tests/actions/vstudio/cs2005/test_user_file.lua
Normal file
49
tests/actions/vstudio/cs2005/test_user_file.lua
Normal file
@ -0,0 +1,49 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_user_file.lua
|
||||
-- Verify handling of empty and non-empty .user files for VC#.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("vstudio_cs2005_user_file")
|
||||
local cs2005 = premake.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2008"
|
||||
sln = test.createsolution()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(sln, 1)
|
||||
cs2005.generateUser(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debugger settings have been specified, then the .user
|
||||
-- file should not be written at all.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debugger setting has been specified, output.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onDebugSettings()
|
||||
debugargs { "hello" }
|
||||
prepare()
|
||||
test.hasoutput()
|
||||
end
|
||||
|
@ -192,7 +192,7 @@
|
||||
|
||||
function suite.onSingleCpp_noPlatforms_singleArch()
|
||||
project "MyProject"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -210,7 +210,7 @@
|
||||
|
||||
function suite.onSingleCs_noPlatforms_singleArch()
|
||||
project "MyProject"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -227,7 +227,7 @@
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_noPlatforms_singleArch()
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
@ -264,7 +264,7 @@
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -289,8 +289,8 @@
|
||||
-- Use the right variant for 32-bit architectures.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_noPlatforms_x32()
|
||||
architecture "x32"
|
||||
function suite.onSingleCpp_noPlatforms_x86()
|
||||
architecture "x86"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
@ -307,8 +307,8 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_noPlatforms_x32()
|
||||
architecture "x32"
|
||||
function suite.onSingleCs_noPlatforms_x86()
|
||||
architecture "x86"
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
@ -326,8 +326,8 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_noPlatforms_x32()
|
||||
architecture "x32"
|
||||
function suite.onMixedLanguage_noPlatforms_x86()
|
||||
architecture "x86"
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
@ -361,9 +361,9 @@
|
||||
function suite.onSingleCpp_withPlatforms_withArchs()
|
||||
platforms { "DLL32", "DLL64" }
|
||||
filter "platforms:DLL32"
|
||||
architecture "x32"
|
||||
architecture "x86"
|
||||
filter "platforms:DLL64"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject"
|
||||
prepare()
|
||||
@ -390,9 +390,9 @@
|
||||
function suite.onSingleCs_withPlatforms_withArchs()
|
||||
platforms { "DLL32", "DLL64" }
|
||||
filter "platforms:DLL32"
|
||||
architecture "x32"
|
||||
architecture "x86"
|
||||
filter "platforms:DLL64"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
@ -420,9 +420,9 @@
|
||||
function suite.onMixedLanguage_withPlatforms_withArchs()
|
||||
platforms { "DLL32", "DLL64" }
|
||||
filter "platforms:DLL32"
|
||||
architecture "x32"
|
||||
architecture "x86"
|
||||
filter "platforms:DLL64"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
@ -465,7 +465,7 @@
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_withPlatformsMatchingArch_noArchs()
|
||||
platforms { "x32", "Xbox360" }
|
||||
platforms { "x86", "Xbox360" }
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
@ -489,7 +489,7 @@
|
||||
end
|
||||
|
||||
function suite.onSingleCs_withPlatformsMatchingArch_noArchs()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
@ -514,7 +514,7 @@
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_withPlatformsMatchingArch_noArchs()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
@ -623,23 +623,23 @@
|
||||
---
|
||||
|
||||
function suite.sortsByBuildCfgAndPlatform()
|
||||
platforms { "Windows", "PS3" }
|
||||
platforms { "Windows", "Linux" }
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|PS3 = Debug|PS3
|
||||
Debug|Linux = Debug|Linux
|
||||
Debug|Windows = Debug|Windows
|
||||
Release|PS3 = Release|PS3
|
||||
Release|Linux = Release|Linux
|
||||
Release|Windows = Release|Windows
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|PS3.ActiveCfg = Debug PS3|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|PS3.Build.0 = Debug PS3|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Linux.ActiveCfg = Debug Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Linux.Build.0 = Debug Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Windows.ActiveCfg = Debug Windows|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Windows.Build.0 = Debug Windows|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|PS3.ActiveCfg = Release PS3|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|PS3.Build.0 = Release PS3|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Linux.ActiveCfg = Release Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Linux.Build.0 = Release Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Windows.ActiveCfg = Release Windows|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Windows.Build.0 = Release Windows|Win32
|
||||
EndGlobalSection
|
||||
@ -795,8 +795,8 @@
|
||||
---
|
||||
|
||||
function suite.onDefaultPlatforms()
|
||||
platforms { "x32", "x64" }
|
||||
defaultplatform "x64"
|
||||
platforms { "x86", "x86_64" }
|
||||
defaultplatform "x86_64"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
@ -809,4 +809,4 @@
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
@ -50,9 +50,9 @@
|
||||
-- If a platform is specified, it should be included in the platform name.
|
||||
--
|
||||
|
||||
function suite.usesWin32_onX32()
|
||||
function suite.usesWin32_onX86()
|
||||
solution "MySolution"
|
||||
platforms { "x32" }
|
||||
platforms { "x86" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
@ -65,8 +65,8 @@
|
||||
-- Check the x64 architecture handling.
|
||||
--
|
||||
|
||||
function suite.usesX64Architecture_onX64Platform()
|
||||
platforms { "x64" }
|
||||
function suite.usesX64Architecture_onX86_64Platform()
|
||||
platforms { "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.debugdir(cfg)
|
||||
vc200x.debugSettings(cfg)
|
||||
end
|
||||
|
||||
|
||||
@ -32,10 +32,7 @@
|
||||
|
||||
function suite.emptyBlock_onNoSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
/>
|
||||
]]
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
@ -49,9 +46,7 @@
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
Command="..\bin\emulator.exe"
|
||||
/>
|
||||
Command="..\bin\emulator.exe"
|
||||
]]
|
||||
end
|
||||
|
||||
@ -66,9 +61,7 @@
|
||||
debugdir "bin/debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
WorkingDirectory="..\bin\debug"
|
||||
/>
|
||||
WorkingDirectory="..\bin\debug"
|
||||
]]
|
||||
end
|
||||
|
||||
@ -81,9 +74,7 @@
|
||||
debugargs { "arg1", "arg2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
CommandArguments="arg1 arg2"
|
||||
/>
|
||||
CommandArguments="arg1 arg2"
|
||||
]]
|
||||
end
|
||||
|
||||
@ -96,9 +87,7 @@
|
||||
debugenvs { "key=value" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
Environment="key=value"
|
||||
/>
|
||||
Environment="key=value"
|
||||
]]
|
||||
end
|
||||
|
||||
@ -111,9 +100,7 @@
|
||||
debugenvs { 'key="value"' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
Environment="key="value""
|
||||
/>
|
||||
Environment="key="value""
|
||||
]]
|
||||
end
|
||||
|
||||
@ -127,9 +114,7 @@
|
||||
debugenvs { "key=value", "foo=bar" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
Environment="key=value
foo=bar"
|
||||
/>
|
||||
Environment="key=value
foo=bar"
|
||||
]]
|
||||
end
|
||||
|
||||
@ -144,9 +129,7 @@
|
||||
flags { "DebugEnvsDontMerge" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSettings
|
||||
Environment="key=value"
|
||||
EnvironmentMerge="false"
|
||||
/>
|
||||
Environment="key=value"
|
||||
EnvironmentMerge="false"
|
||||
]]
|
||||
end
|
||||
|
@ -65,7 +65,7 @@
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onMultipleArchitectures()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
@ -80,23 +80,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the PS3 platform.
|
||||
--
|
||||
|
||||
function suite.platformIsCorrect_onPS3()
|
||||
platforms { "PS3" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the Xbox360 platform.
|
||||
--
|
||||
|
48
tests/actions/vstudio/vc200x/test_user_file.lua
Normal file
48
tests/actions/vstudio/vc200x/test_user_file.lua
Normal file
@ -0,0 +1,48 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_user_file.lua
|
||||
-- Verify handling of empty and non-empty .user files for VC'200x.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("vstudio_vs200x_user_file")
|
||||
local vc200x = premake.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2008"
|
||||
sln = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(sln, 1)
|
||||
vc200x.generateUser(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debugger settings have been specified, then the .user
|
||||
-- file should not be written at all.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debugger setting has been specified, output.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onDebugSettings()
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
test.hasoutput()
|
||||
end
|
||||
|
@ -119,6 +119,36 @@
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Disable specific warnings.
|
||||
--
|
||||
|
||||
function suite.disableSpecificWarnings()
|
||||
disablewarnings { "disable" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DisableSpecificWarnings>disable;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Specific warnings as errors.
|
||||
--
|
||||
|
||||
function suite.specificWarningsAsErrors()
|
||||
fatalwarnings { "fatal" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<TreatSpecificWarningsAsErrors>fatal;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the optimization flags.
|
||||
--
|
||||
@ -236,6 +266,22 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If undefines are specified, the <UndefinePreprocessorDefinitions> element should be added.
|
||||
--
|
||||
|
||||
function suite.preprocessorDefinitions_onUnDefines()
|
||||
undefines { "DEBUG", "_DEBUG" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<UndefinePreprocessorDefinitions>DEBUG;_DEBUG;%(UndefinePreprocessorDefinitions)</UndefinePreprocessorDefinitions>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If build options are specified, the <AdditionalOptions> element should be specified.
|
||||
--
|
||||
@ -417,59 +463,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of floating point and SSE flags.
|
||||
--
|
||||
|
||||
function suite.instructionSet_onSSE()
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onSSE2()
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.floatingPoint_onFloatFast()
|
||||
flags "FloatFast"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.floatingPoint_onFloatStrict()
|
||||
flags "FloatStrict"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FloatingPointModel>Strict</FloatingPointModel>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify character handling.
|
||||
--
|
||||
@ -558,7 +551,7 @@
|
||||
|
||||
function suite.debugFormat_onWin32()
|
||||
flags "Symbols"
|
||||
architecture "x32"
|
||||
architecture "x86"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
@ -575,7 +568,7 @@
|
||||
|
||||
function suite.debugFormat_onWin64()
|
||||
flags "Symbols"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
|
49
tests/actions/vstudio/vc2010/test_floatingpoint.lua
Normal file
49
tests/actions/vstudio/vc2010/test_floatingpoint.lua
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
-- tests/actions/vstudio/vc2010/test_floatingpoint.lua
|
||||
-- Validate handling of vectorextensions() in VS 2010 C/C++ projects.
|
||||
--
|
||||
-- Created 26 Mar 2015 by Jason Perkins
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local suite = test.declare("vs2010_vc_floatingpoint")
|
||||
local m = premake.vstudio.vc2010
|
||||
|
||||
|
||||
local sln, prj
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2010"
|
||||
sln, prj = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
m.floatingPointModel(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function suite.instructionSet_onNotSet()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
function suite.floatingPoint_onFloatFast()
|
||||
flags "FloatFast"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.floatingPoint_onFloatStrict()
|
||||
flags "FloatStrict"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FloatingPointModel>Strict</FloatingPointModel>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
@ -55,9 +55,9 @@
|
||||
function suite.allArchitecturesListed_onMultipleArchitectures()
|
||||
platforms { "32b", "64b" }
|
||||
filter "platforms:32b"
|
||||
architecture "x32"
|
||||
architecture "x86"
|
||||
filter "platforms:64b"
|
||||
architecture "x64"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
@ -88,7 +88,7 @@
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onImplicitArchitectures()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
|
48
tests/actions/vstudio/vc2010/test_user_file.lua
Normal file
48
tests/actions/vstudio/vc2010/test_user_file.lua
Normal file
@ -0,0 +1,48 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_user_file.lua
|
||||
-- Verify handling of empty and non-empty .user files for VC'201x.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("vstudio_vs2010_user_file")
|
||||
local vc2010 = premake.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2010"
|
||||
sln = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(sln, 1)
|
||||
vc2010.generateUser(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debugger settings have been specified, then the .user
|
||||
-- file should not be written at all.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debugger setting has been specified, output.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onDebugSettings()
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
test.hasoutput()
|
||||
end
|
||||
|
77
tests/actions/vstudio/vc2010/test_vectorextensions.lua
Normal file
77
tests/actions/vstudio/vc2010/test_vectorextensions.lua
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
-- tests/actions/vstudio/vc2010/test_vectorextensions.lua
|
||||
-- Validate handling of vectorextensions() in VS 2010 C/C++ projects.
|
||||
--
|
||||
-- Created 26 Mar 2015 by Jason Perkins
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local suite = test.declare("vs2010_vc_vectorextensions")
|
||||
local m = premake.vstudio.vc2010
|
||||
|
||||
|
||||
local sln, prj
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2010"
|
||||
sln, prj = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
m.enableEnhancedInstructionSet(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function suite.instructionSet_onNotSet()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
function suite.instructionSet_onSSE()
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onSSE2()
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX()
|
||||
_ACTION = "vs2013"
|
||||
vectorextensions "AVX"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX_onVS2010()
|
||||
vectorextensions "AVX"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX2()
|
||||
_ACTION = "vs2013"
|
||||
vectorextensions "AVX2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX2_onVS2012()
|
||||
_ACTION = "vs2012"
|
||||
vectorextensions "AVX2"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- tests/base/test_criteria.lua
|
||||
-- Test suite for the criteria matching API.
|
||||
-- Copyright (c) 2012-2014 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("criteria")
|
||||
@ -31,7 +31,7 @@
|
||||
--
|
||||
|
||||
function suite.matches_fails_onMissingContext()
|
||||
crit = criteria.new { "system:Windows", "architecture:x32" }
|
||||
crit = criteria.new { "system:Windows", "architecture:x86" }
|
||||
test.isfalse(criteria.matches(crit, { configurations="Debug", system="Windows" }))
|
||||
end
|
||||
|
||||
@ -41,8 +41,8 @@
|
||||
--
|
||||
|
||||
function suite.matches_fails_onIncompleteTermMatch()
|
||||
crit = criteria.new { "platforms:ps3" }
|
||||
test.isfalse(criteria.matches(crit, { platforms="ps3 ppu sn" }))
|
||||
crit = criteria.new { "platforms:win64" }
|
||||
test.isfalse(criteria.matches(crit, { platforms="win64 dll dcrt" }))
|
||||
end
|
||||
|
||||
|
||||
@ -224,8 +224,8 @@
|
||||
end
|
||||
|
||||
function suite.fails_onIncompleteMatch_Unprefixed()
|
||||
crit = criteria.new({ "ps3" }, true)
|
||||
test.isfalse(criteria.matches(crit, { "ps3 ppu sn" }))
|
||||
crit = criteria.new({ "win64" }, true)
|
||||
test.isfalse(criteria.matches(crit, { "win64 dll dcrt" }))
|
||||
end
|
||||
|
||||
function suite.passes_onPatternMatch_Unprefixed()
|
||||
@ -308,3 +308,21 @@
|
||||
test.isnil(crit)
|
||||
test.isnotnil(err)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should respect field value aliases, if present.
|
||||
--
|
||||
|
||||
function suite.passes_onAliasedValue()
|
||||
premake.api.addAliases("system", { ["gnu-linux"] = "linux" })
|
||||
crit = criteria.new { "system:gnu-linux" }
|
||||
test.istrue(criteria.matches(crit, { system="linux" }))
|
||||
end
|
||||
|
||||
function suite.passes_onAliasedValue_withMixedCase()
|
||||
premake.api.addAliases("system", { ["gnu-linux"] = "linux" })
|
||||
crit = criteria.new { "System:GNU-Linux" }
|
||||
test.istrue(criteria.matches(crit, { system="linux" }))
|
||||
end
|
||||
|
||||
|
37
tests/base/test_module_loader.lua
Normal file
37
tests/base/test_module_loader.lua
Normal file
@ -0,0 +1,37 @@
|
||||
--
|
||||
-- tests/base/test_module_loader.lua
|
||||
-- Test the custom module loader.
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("module_loader")
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local loaderIndex
|
||||
|
||||
function suite.setup()
|
||||
table.insert(package.loaders, function (name)
|
||||
premake.out(name)
|
||||
return loadstring("")
|
||||
end)
|
||||
loaderIndex = #package.loaders
|
||||
end
|
||||
|
||||
function suite.teardown()
|
||||
table.remove(package.loaders, loaderIndex)
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that premake's module loader let other loaders try
|
||||
-- when it cannot find a module.
|
||||
--
|
||||
|
||||
function suite.letOtherLoadersTry()
|
||||
require("foo")
|
||||
test.capture [[
|
||||
foo
|
||||
]]
|
||||
end
|
@ -106,7 +106,7 @@
|
||||
|
||||
function suite.matchfiles_OnDottedFile()
|
||||
local result = os.matchfiles("../.*")
|
||||
test.istrue(table.contains(result, "../.hgignore"))
|
||||
test.istrue(table.contains(result, "../.gitignore"))
|
||||
end
|
||||
|
||||
|
||||
@ -132,6 +132,32 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- os.outputof() tests
|
||||
--
|
||||
|
||||
-- Check if outputof returns the command exit code
|
||||
-- in addition of the command output
|
||||
function suite.outputof_commandExitCode()
|
||||
if os.is("macosx")
|
||||
or os.is("linux")
|
||||
or os.is("solaris")
|
||||
or os.is("bsd")
|
||||
then
|
||||
-- Assumes 'true' and 'false' commands exist
|
||||
-- which should be the case on all *nix platforms
|
||||
for cmd, exitcode in pairs ({
|
||||
["true"] = 0,
|
||||
["false"] = 1
|
||||
})
|
||||
do
|
||||
local o, e = os.outputof(cmd)
|
||||
test.isequal(e, exitcode)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- os.translateCommand() tests
|
||||
--
|
||||
@ -145,4 +171,4 @@
|
||||
copy = function(value) return "test " .. value end
|
||||
}
|
||||
test.isequal("test a b", os.translateCommands("{COPY} a b", "test"))
|
||||
end
|
||||
end
|
||||
|
@ -298,6 +298,32 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- path.replaceextension() tests
|
||||
--
|
||||
|
||||
function suite.getabsolute_replaceExtension()
|
||||
test.isequal("/AB.foo", path.replaceextension("/AB.exe","foo"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_replaceExtensionWithDot()
|
||||
test.isequal("/AB.foo", path.replaceextension("/AB.exe",".foo"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_replaceExtensionWithDotMultipleDots()
|
||||
test.isequal("/nunit.framework.foo", path.replaceextension("/nunit.framework.dll",".foo"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_replaceExtensionCompletePath()
|
||||
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main.cpp",".foo"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_replaceExtensionWithoutExtension()
|
||||
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main",".foo"))
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- path.translate() tests
|
||||
--
|
||||
@ -338,3 +364,43 @@
|
||||
function suite.wildcards_escapeStarStar()
|
||||
test.isequal("Images/.*%.bmp", path.wildcards("Images/**.bmp"))
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- path.normalize tests
|
||||
--
|
||||
function suite.normalize_Test1()
|
||||
local p = path.normalize("d:/game/../test")
|
||||
test.isequal("d:/test", p)
|
||||
end
|
||||
|
||||
function suite.normalize_Test2()
|
||||
local p = path.normalize("d:/game/../../test")
|
||||
test.isequal("d:/../test", p)
|
||||
end
|
||||
|
||||
function suite.normalize_Test3()
|
||||
local p = path.normalize("../../test")
|
||||
test.isequal("../../test", p)
|
||||
end
|
||||
|
||||
function suite.normalize_Test4()
|
||||
local p = path.normalize("../../../test/*.h")
|
||||
test.isequal("../../../test/*.h", p)
|
||||
end
|
||||
|
||||
function suite.normalize_trailingDots1()
|
||||
local p = path.normalize("../game/test/..")
|
||||
test.isequal("../game", p)
|
||||
end
|
||||
|
||||
function suite.normalize_trailingDots2()
|
||||
local p = path.normalize("../game/..")
|
||||
test.isequal("..", p)
|
||||
end
|
||||
|
||||
function suite.normalize()
|
||||
test.isequal("d:/ProjectB/bin", path.normalize("d:/ProjectA/../ProjectB/bin"))
|
||||
test.isequal("/ProjectB/bin", path.normalize("/ProjectA/../ProjectB/bin"))
|
||||
end
|
@ -69,17 +69,17 @@
|
||||
function suite.variableMaintained_onLeadingVariable()
|
||||
system "windows"
|
||||
location "build"
|
||||
links { "$(SN_PS3_PATH)/sdk/lib/PS3TMAPI" }
|
||||
links { "$(LOCAL_DEV_PATH)/sdk/lib/DEVMAPI" }
|
||||
local r = prepare("all", "fullpath")
|
||||
test.isequal({ "$(SN_PS3_PATH)/sdk/lib/PS3TMAPI" }, r)
|
||||
test.isequal({ "$(LOCAL_DEV_PATH)/sdk/lib/DEVMAPI" }, r)
|
||||
end
|
||||
|
||||
function suite.variableMaintained_onQuotedVariable()
|
||||
system "windows"
|
||||
location "build"
|
||||
links { '"$(SN_PS3_PATH)/sdk/lib/PS3TMAPI.lib"' }
|
||||
links { '"$(LOCAL_DEV_PATH)/sdk/lib/DEVMAPI.lib"' }
|
||||
local r = prepare("all", "fullpath")
|
||||
test.isequal({ '"$(SN_PS3_PATH)/sdk/lib/PS3TMAPI.lib"' }, r)
|
||||
test.isequal({ '"$(LOCAL_DEV_PATH)/sdk/lib/DEVMAPI.lib"' }, r)
|
||||
end
|
||||
|
||||
|
||||
|
@ -47,10 +47,10 @@
|
||||
function suite.singleProject_withPlatforms()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prj = project "MyProject"
|
||||
|
||||
test.isequal("obj/x32/Debug", result("Debug", "x32"))
|
||||
test.isequal("obj/x86/Debug", result("Debug", "x86"))
|
||||
end
|
||||
|
||||
|
||||
@ -67,20 +67,20 @@
|
||||
function suite.singleProject_uniqueByTokens_withPlatforms()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prj = project "MyProject"
|
||||
objdir "obj/%{cfg.buildcfg}_%{cfg.platform}"
|
||||
|
||||
test.isequal("obj/Debug_x32", result("Debug", "x32"))
|
||||
test.isequal("obj/Debug_x86", result("Debug", "x86"))
|
||||
end
|
||||
|
||||
|
||||
function suite.allowOverlap_onPrefixCode()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prj = project "MyProject"
|
||||
objdir "!obj/%{cfg.buildcfg}"
|
||||
|
||||
test.isequal("obj/Debug", result("Debug", "x32"))
|
||||
test.isequal("obj/Debug", result("Debug", "x86"))
|
||||
end
|
||||
|
@ -106,19 +106,19 @@
|
||||
--
|
||||
|
||||
function suite.canMap_tupleToSingle()
|
||||
platforms { "Win32", "PS3" }
|
||||
platforms { "Win32", "Linux" }
|
||||
project ("MyProject")
|
||||
removeconfigurations "*"
|
||||
removeplatforms "*"
|
||||
configurations { "Debug Win32", "Release Win32", "Debug PS3", "Release PS3" }
|
||||
configurations { "Debug Win32", "Release Win32", "Debug Linux", "Release Linux" }
|
||||
configmap {
|
||||
[{"Debug", "Win32"}] = "Debug Win32",
|
||||
[{"Debug", "PS3"}] = "Debug PS3",
|
||||
[{"Debug", "Linux"}] = "Debug Linux",
|
||||
[{"Release", "Win32"}] = "Release Win32",
|
||||
[{"Release", "PS3"}] = "Release PS3"
|
||||
[{"Release", "Linux"}] = "Release Linux"
|
||||
}
|
||||
prepare("Debug", "PS3")
|
||||
test.isequal("Debug PS3", cfg.buildcfg)
|
||||
prepare("Debug", "Linux")
|
||||
test.isequal("Debug Linux", cfg.buildcfg)
|
||||
end
|
||||
|
||||
|
||||
@ -128,21 +128,21 @@
|
||||
--
|
||||
|
||||
function suite.canMap_tupleToTuple()
|
||||
platforms { "Win32", "PS3" }
|
||||
platforms { "Win32", "Linux" }
|
||||
project ("MyProject")
|
||||
removeconfigurations "*"
|
||||
removeplatforms "*"
|
||||
configurations { "Development", "Production" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
|
||||
configmap {
|
||||
[{"Debug", "Win32"}] = { "Development", "x32" },
|
||||
[{"Debug", "PS3"}] = { "Development", "x64" },
|
||||
[{"Release", "Win32"}] = { "Production", "x32" },
|
||||
[{"Release", "PS3"}] = { "Production", "x64" },
|
||||
[{"Debug", "Win32"}] = { "Development", "x86" },
|
||||
[{"Debug", "Linux"}] = { "Development", "x86_64" },
|
||||
[{"Release", "Win32"}] = { "Production", "x86" },
|
||||
[{"Release", "Linux"}] = { "Production", "x86_64" },
|
||||
}
|
||||
prepare("Debug", "PS3")
|
||||
test.isequal({ "Development", "x64" }, { cfg.buildcfg, cfg.platform })
|
||||
prepare("Debug", "Linux")
|
||||
test.isequal({ "Development", "x86_64" }, { cfg.buildcfg, cfg.platform })
|
||||
end
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
--
|
||||
|
||||
function suite.returnsNoValues_onNoConfigurationsButPlatforms()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
@ -77,13 +77,13 @@
|
||||
|
||||
function suite.pairsConfigsAndPlatformsInOrder()
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
Debug:x32
|
||||
Debug:x64
|
||||
Release:x32
|
||||
Release:x64
|
||||
Debug:x86
|
||||
Debug:x86_64
|
||||
Release:x86
|
||||
Release:x86_64
|
||||
]]
|
||||
end
|
||||
|
||||
@ -110,11 +110,11 @@
|
||||
function suite.mapsPlatform_toPlatform()
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "Win32" }
|
||||
configmap { ["Win32"] = "x64" }
|
||||
configmap { ["Win32"] = "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
Debug:x64
|
||||
Release:x64
|
||||
Debug:x86_64
|
||||
Release:x86_64
|
||||
]]
|
||||
end
|
||||
|
||||
@ -128,12 +128,12 @@
|
||||
function suite.mapsBuildCfg_toBuildCfgAndPlatform()
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "Win32" }
|
||||
configmap { ["Debug"] = { "ProjectDebug", "x64" } }
|
||||
configmap { ["Debug"] = { "ProjectDebug", "x86_64" } }
|
||||
prepare()
|
||||
test.capture [[
|
||||
ProjectDebug:x64
|
||||
ProjectDebug:x86_64
|
||||
ProjectDebug:Win32
|
||||
Release:x64
|
||||
Release:x86_64
|
||||
Release:Win32
|
||||
]]
|
||||
end
|
||||
|
@ -92,10 +92,10 @@
|
||||
--
|
||||
|
||||
function suite.setsArchitecture_onMatchingPlatform()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
project ("MyProject")
|
||||
prepare("Debug", "x32")
|
||||
test.isequal("x32", cfg.architecture)
|
||||
prepare("Debug", "x86")
|
||||
test.isequal("x86", cfg.architecture)
|
||||
end
|
||||
|
||||
|
||||
@ -105,9 +105,9 @@
|
||||
--
|
||||
|
||||
function suite.doesNotOverride_onMatchingPlatform()
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x64" }
|
||||
project ("MyProject")
|
||||
architecture "x64"
|
||||
prepare("Debug", "x32")
|
||||
test.isequal("x64", cfg.architecture)
|
||||
architecture "x86_64"
|
||||
prepare("Debug", "x86")
|
||||
test.isequal("x86_64", cfg.architecture)
|
||||
end
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
local sln
|
||||
function suite.setup()
|
||||
sln = solution("MySolution")
|
||||
sln = solution("MySolution")
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
@ -49,15 +49,15 @@
|
||||
|
||||
function suite.listsInOrder_onBuildConfigsAndPlatforms()
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
project("MyProject")
|
||||
prepare()
|
||||
test.capture [[
|
||||
-
|
||||
Debug:x32
|
||||
Debug:x64
|
||||
Release:x32
|
||||
Release:x64
|
||||
Debug:x86
|
||||
Debug:x86_64
|
||||
Release:x86
|
||||
Release:x86_64
|
||||
-
|
||||
]]
|
||||
end
|
||||
@ -72,7 +72,7 @@
|
||||
configurations { "Debug", "Release" }
|
||||
project ("MyProject")
|
||||
configurations { "PrjDebug", "PrjRelease" }
|
||||
platforms { "x32", "x64" }
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
-
|
||||
|
@ -44,8 +44,8 @@
|
||||
|
||||
function suite.directoryIncludesPlatform_onPlatformConflict()
|
||||
configurations { "Debug" }
|
||||
platforms { "x32", "x64" }
|
||||
test.isequal("obj/x32", result())
|
||||
platforms { "x86", "x86_64" }
|
||||
test.isequal("obj/x86", result())
|
||||
end
|
||||
|
||||
|
||||
@ -67,8 +67,8 @@
|
||||
|
||||
function suite.directoryIncludesBuildCfg_onPlatformAndBuildCfgConflict()
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "x64" }
|
||||
test.isequal("obj/x32/Debug", result())
|
||||
platforms { "x86", "x86_64" }
|
||||
test.isequal("obj/x86/Debug", result())
|
||||
end
|
||||
|
||||
|
||||
|
@ -121,6 +121,14 @@
|
||||
end
|
||||
|
||||
|
||||
function test.hasoutput()
|
||||
local actual = premake.captured()
|
||||
if actual == "" then
|
||||
test.fail("expected output, received none");
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function test.isemptycapture()
|
||||
local actual = premake.captured()
|
||||
if actual ~= "" then
|
||||
@ -258,16 +266,20 @@
|
||||
end
|
||||
|
||||
|
||||
function test.getproject(sln, i)
|
||||
function test.getsolution(sln)
|
||||
premake.oven.bake()
|
||||
sln = premake.global.getSolution(sln.name)
|
||||
return premake.global.getSolution(sln.name)
|
||||
end
|
||||
|
||||
|
||||
function test.getproject(sln, i)
|
||||
sln = test.getsolution(sln)
|
||||
return premake.solution.getproject(sln, i or 1)
|
||||
end
|
||||
|
||||
|
||||
function test.getconfig(prj, buildcfg, platform)
|
||||
premake.oven.bake()
|
||||
local sln = premake.global.getSolution(prj.solution.name)
|
||||
sln = test.getsolution(prj.solution)
|
||||
prj = premake.solution.getproject(sln, prj.name)
|
||||
return premake.project.getconfig(prj, buildcfg, platform)
|
||||
end
|
||||
|
@ -38,6 +38,15 @@
|
||||
test.isequal("windres", gcc.gettoolname(cfg, "rc"))
|
||||
end
|
||||
|
||||
function suite.tools_withPrefix()
|
||||
gccprefix "test-prefix-"
|
||||
prepare()
|
||||
test.isequal("test-prefix-gcc", gcc.gettoolname(cfg, "cc"))
|
||||
test.isequal("test-prefix-g++", gcc.gettoolname(cfg, "cxx"))
|
||||
test.isequal("test-prefix-ar", gcc.gettoolname(cfg, "ar"))
|
||||
test.isequal("test-prefix-windres", gcc.gettoolname(cfg, "rc"))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- By default, the -MMD -MP are used to generate dependencies.
|
||||
@ -76,6 +85,14 @@
|
||||
test.contains({ "-Werror" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onSpecificWarnings()
|
||||
enablewarnings { "enable" }
|
||||
disablewarnings { "disable" }
|
||||
fatalwarnings { "fatal" }
|
||||
prepare()
|
||||
test.contains({ "-Wenable", "-Wno-disable", "-Werror=fatal" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onFloastFast()
|
||||
floatingpoint "Fast"
|
||||
prepare()
|
||||
@ -106,6 +123,35 @@
|
||||
test.contains({ "-msse2" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onAVX()
|
||||
vectorextensions "AVX"
|
||||
prepare()
|
||||
test.contains({ "-mavx" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onAVX2()
|
||||
vectorextensions "AVX2"
|
||||
prepare()
|
||||
test.contains({ "-mavx2" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the defines and undefines.
|
||||
--
|
||||
|
||||
function suite.defines()
|
||||
defines "DEF"
|
||||
prepare()
|
||||
test.contains({ "-DDEF" }, gcc.getdefines(cfg.defines))
|
||||
end
|
||||
|
||||
function suite.undefines()
|
||||
undefines "UNDEF"
|
||||
prepare()
|
||||
test.contains({ "-UUNDEF" }, gcc.getundefines(cfg.undefines))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the optimization flags.
|
||||
@ -229,26 +275,26 @@
|
||||
-- Make sure system or architecture flags are added properly.
|
||||
--
|
||||
|
||||
function suite.cflags_onX32()
|
||||
architecture "x32"
|
||||
function suite.cflags_onX86()
|
||||
architecture "x86"
|
||||
prepare()
|
||||
test.contains({ "-m32" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onX32()
|
||||
architecture "x32"
|
||||
function suite.ldflags_onX86()
|
||||
architecture "x86"
|
||||
prepare()
|
||||
test.contains({ "-m32" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onX64()
|
||||
architecture "x64"
|
||||
function suite.cflags_onX86_64()
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.contains({ "-m64" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_onX64()
|
||||
architecture "x64"
|
||||
function suite.ldflags_onX86_64()
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.contains({ "-m64" }, gcc.getldflags(cfg))
|
||||
end
|
||||
|
@ -111,6 +111,14 @@
|
||||
test.contains("/WX", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onSpecificWarnings()
|
||||
enablewarnings { "enable" }
|
||||
disablewarnings { "disable" }
|
||||
fatalwarnings { "fatal" }
|
||||
prepare()
|
||||
test.contains({ '/wd"disable"', '/we"fatal"' }, msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.ldflags_OnFatalWarnings()
|
||||
flags "FatalWarnings"
|
||||
prepare()
|
||||
@ -159,13 +167,42 @@
|
||||
function suite.cflags_onSSE()
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.contains("/arch:sse", msc.getcflags(cfg))
|
||||
test.contains("/arch:SSE", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onSSE2()
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.contains("/arch:sse2", msc.getcflags(cfg))
|
||||
test.contains("/arch:SSE2", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onAVX()
|
||||
vectorextensions "AVX"
|
||||
prepare()
|
||||
test.contains("/arch:AVX", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onAVX2()
|
||||
vectorextensions "AVX2"
|
||||
prepare()
|
||||
test.contains("/arch:AVX2", msc.getcflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the defines and undefines.
|
||||
--
|
||||
|
||||
function suite.defines()
|
||||
defines "DEF"
|
||||
prepare()
|
||||
test.contains({ '/D"DEF"' }, msc.getdefines(cfg.defines))
|
||||
end
|
||||
|
||||
function suite.undefines()
|
||||
undefines "UNDEF"
|
||||
prepare()
|
||||
test.contains({ '/U"UNDEF"' }, msc.getundefines(cfg.undefines))
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user