Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2011-11-13 18:27:27 +0400
committerJason Perkins <starkos@industriousone.com>2011-11-13 18:27:27 +0400
commitfd26375aee5d111037f06ee0a4ba39cda388e9e4 (patch)
treec2626928bcc52f6b61df1cd49959c2a711555b42
parentbf1e7ed1e524e895414438c74474f1537550eea5 (diff)
parentcc5dbeb230236023a4d99e8d106081e9ecf5c469 (diff)
Merge latest changes from premake-dev
-rw-r--r--.hgignore5
-rw-r--r--CHANGES.txt50
-rw-r--r--scripts/embed.lua2
-rw-r--r--src/actions/make/_make.lua22
-rw-r--r--src/actions/make/make_cpp.lua115
-rw-r--r--src/actions/vstudio/vs200x_vcproj.lua38
-rw-r--r--src/actions/vstudio/vs2010_vcxproj.lua238
-rw-r--r--src/actions/xcode/xcode_common.lua8
-rw-r--r--src/base/api.lua10
-rw-r--r--src/base/bake.lua23
-rw-r--r--src/base/globals.lua6
-rw-r--r--src/base/project.lua14
-rwxr-xr-xsrc/host/os_getversion.c16
-rwxr-xr-xsrc/host/os_stat.c46
-rwxr-xr-xsrc/host/premake.c1
-rwxr-xr-xsrc/host/premake.h1
-rw-r--r--src/tools/gcc.lua24
-rw-r--r--tests/actions/make/test_make_pch.lua12
-rw-r--r--tests/actions/make/test_makesettings.lua51
-rw-r--r--tests/actions/make/test_wiidev.lua56
-rw-r--r--tests/actions/vstudio/test_vs2010_vcxproj.lua120
-rw-r--r--tests/actions/vstudio/vc200x/files.lua73
-rw-r--r--tests/actions/vstudio/vc200x/test_filters.lua6
-rw-r--r--tests/actions/vstudio/vc2010/test_links.lua87
-rw-r--r--tests/actions/xcode/test_xcode4_project.lua59
-rw-r--r--tests/actions/xcode/test_xcode_dependencies.lua4
-rw-r--r--tests/actions/xcode/test_xcode_project.lua35
-rw-r--r--tests/premake4.lua24
-rw-r--r--tests/project/test_vpaths.lua29
-rw-r--r--tests/test_gmake_cpp.lua8
-rw-r--r--tests/testfx.lua1
31 files changed, 871 insertions, 313 deletions
diff --git a/.hgignore b/.hgignore
index 48c8bc0..13b6351 100644
--- a/.hgignore
+++ b/.hgignore
@@ -26,3 +26,8 @@ Makefile
*.project
*.tags
+*.bbprojectsettings
+Scratchpad.txt
+Unix Worksheet.worksheet
+project.bbprojectdata
+Premake4.tmproj \ No newline at end of file
diff --git a/CHANGES.txt b/CHANGES.txt
index 402440d..ddff72d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,7 +3,7 @@
-------
* Feature 1590022: Source file filtering and grouping
-* Feature 3100379: C# support for Visual Studio 2010
+* Feature 3100379: C# support for Visual Studio 2010
* Feature 1657833: Set working directory for debugging
* Added support for Haiku OS (Yuriy O'Donnell)
* Patch 2963313: Enable setting .NET framework version (Justen Hyde)
@@ -24,12 +24,24 @@
* Patch 3043933 Allow gmake to use static lib when shared lib of same name exists (Jonathan Derque)
* Bug 3294459: vs10 x86_64 using incorrect debug format for minimal rebuild (learner)
* Bug 3297634: Special characters in directory name Xcode3 (jdale)
-* Feature 3100194: English alais' for Optimize flags
+* Feature 3100194: English aliases for Optimize flags
* Bug 3308203: Incorrect relative paths for gmake sibling static libraries (Adam)
-* Added debug environment variable support for Visual Studio
* Bug 3277343: SM_SERVERR2 is not always defined by default (Martin Ridgers)
-* Added debug environment variable support for Codeblocks using gdb
+* Added os.stat
* Bug 3381149: Path of PCH source file in VS10 not being translated (intyuh)
+* Patch 3021550: Add Wii homebrew platform (Pathogen David)
+* Patch 3035550: Make/Distcc outputs dependencies to wrong location
+* Patch 3138574: NoImportLib ignored in Windows makefiles dependencies (rjmyst3)
+* Patch 3367641: Remove warnings in Xcode 4
+* Patch 3372345: Gmake action's PCHs don't work with Mingw (Martin Ridgers)
+* Patch 3317329: Support vstudio CompileAs for mixed-language projects (xpol)
+* Patch 3337372: Improved precompiled header support (Anders Ericsson)
+* Patch 3401184: Fix Gmake LDFLAGS generation order (Adam Petrone)
+* Patch 3381066: Fix VS2010 project references
+* Added debug environment variable support for Visual Studio
+* Added debug environment variable support for Codeblocks using gdb
+
+
-------
4.3
-------
@@ -187,7 +199,7 @@ RC4 -> Final
RC3 -> RC4
- Embed scripts instead of bytecodes to avoid portability issues
-- solution() and project() now only set the active object when
+- solution() and project() now only set the active object when
called with a name; remains unchanged otherwise
RC2 -> RC3
@@ -221,7 +233,7 @@ RC1 -> RC2
- Added new cb-ow (Code::Blocks Open Watcom) target (Tim Channon)
- Place OSX winexe's into Content/MacOS folder (William Burnson)
- Sibling executables may now be listed in package.links
-- Bug 1520012: Improper Makefiles when filenames have spaces
+- Bug 1520012: Improper Makefiles when filenames have spaces
(Diaa Sami)
- Bug 2045506: "no-exceptions" flag ignored for VS200x (Benoit Miller)
- Bug 2034470: Error in cmd line error handler
@@ -233,12 +245,12 @@ RC1 -> RC2
-----
- Patch 1946122: Add support for VS2008 (Ryan Pusztai)
-- Patch 1913448: Win32 crash when using '--clean --usetargetpath'
+- Patch 1913448: Win32 crash when using '--clean --usetargetpath'
(David Walters)
- Patch 1771168: luaL_getn speed optimization (Richard O'Grady)
- Bug 1939089: Premake segfault on Linux/PPC (Fabio Till)
- Fixed "bad argument #2 to 'chdir'" error
-- Disable -MMD on multiple -arch flags (poor man's Universal binary
+- Disable -MMD on multiple -arch flags (poor man's Universal binary
support)
@@ -248,12 +260,12 @@ RC1 -> RC2
- Prevent creation of import libraries on OS X
- Improved handling of dylibs on OS X
-- Patch 1771977: Ability to compile C source as C++ in Code::Blocks
+- Patch 1771977: Ability to compile C source as C++ in Code::Blocks
(Ryan Pusztai)
- Bug 1804810: out-implib not present in linux gnu compler toolchain
- Bug 1806949: .Net reference paths are broken when bindir is specified
- Bug 1806960: Make clean does not remove .mdb files
-- Bug 1831389: Makefiles stored in subdirs contain no targets on
+- Bug 1831389: Makefiles stored in subdirs contain no targets on
first run
@@ -301,7 +313,7 @@ RC1 -> RC2
- Bug 1655595: Compile/build problem on FreeBSD
- Bug: "gnu" clean rule doesn't work in cmd.exe
- Improved behavior of Linux findlib()
-- Updated Code::Blocks support to latest project version
+- Updated Code::Blocks support to latest project version
(major="1" minor="6")
- Patch 1681666: GNU targets always show the console if kind = 'winexe'
@@ -349,7 +361,7 @@ RC1 -> RC2
- Added unit test suite
- Merged Scott Graham unicode build flag patch
- Removed package.warninglevel in favor of extra-warnings flag
-- Added package.targetprefix
+- Added package.targetprefix
- Overhauled structure of generated GNU makefiles
- Added --os command line option
- Fixed bug 1268588: Use gcc to link C packages
@@ -385,7 +397,7 @@ RC1 -> RC2
- Worked around VS.NET bug for .NET assemblies > 64K.
- Added --very-verbose flag to GNU generator.
- GNU generator now supports assembly sources.
-
+
-----
2.1
@@ -452,13 +464,13 @@ RC1 -> RC2
- Added support for Digital Mars compiler.
--------
+-------
1.6.1
-------
- VS7 generator crashed if a package was built before one of its
dependencies. Now immediately assigns UUID before processing.
-
+
-----
1.6
@@ -466,20 +478,20 @@ RC1 -> RC2
- Added support for Visual Studio 2003 and SharpDevelop.
- Added binaries directory as a reference path for VS7.
-
+
-----
1.5
-----
- Added initial support for building static libraries.
-- Added "no-main" flag, prevents overriding WinMain() on
+- Added "no-main" flag, prevents overriding WinMain() on
Windows builds.
- Added "--no-rtti" and "no-exceptions" build flags to
disable those C++ features.
- Display error message when project has no packages.
- Moved VC7 *.pdb files into intermediates directory.
-
+
-----
1.4
@@ -487,7 +499,7 @@ RC1 -> RC2
- Bug fixes to the path manipulation routines.
- GNU makefiles are regenerated when premake scripts change.
-
+
-----
1.3
diff --git a/scripts/embed.lua b/scripts/embed.lua
index 2784c40..94b7cbf 100644
--- a/scripts/embed.lua
+++ b/scripts/embed.lua
@@ -7,7 +7,7 @@
local function stripfile(fname)
local f = io.open(fname)
- local s = f:read("*a")
+ local s = assert(f:read("*a"))
f:close()
-- strip tabs
diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua
index 42b84fd..0bf80f6 100644
--- a/src/actions/make/_make.lua
+++ b/src/actions/make/_make.lua
@@ -1,11 +1,12 @@
--
-- _make.lua
-- Define the makefile action(s).
--- Copyright (c) 2002-2010 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
--
_MAKE = { }
premake.make = { }
+ local make = premake.make
--
-- Escape a string so it can be written to a makefile.
@@ -99,7 +100,26 @@
return result
end
+
+
+--
+-- Write out the raw settings blocks.
+--
+
+ function make.settings(cfg, cc)
+ if #cfg.makesettings > 0 then
+ for _, value in ipairs(cfg.makesettings) do
+ _p(value)
+ end
+ end
+ local toolsettings = cc.platforms[cfg.platform].cfgsettings
+ if toolsettings then
+ _p(toolsettings)
+ end
+ end
+
+
--
-- Register the "gmake" action
--
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index 790bc63..f50eb93 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -1,11 +1,12 @@
--
-- make_cpp.lua
-- Generate a C/C++ project makefile.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
--
premake.make.cpp = { }
- local _ = premake.make.cpp
+ local cpp = premake.make.cpp
+ local make = premake.make
function premake.make_cpp(prj)
@@ -106,18 +107,14 @@
_p('')
-- precompiler header rule
- _.pchrules(prj)
+ cpp.pchrules(prj)
-- per-file rules
for _, file in ipairs(prj.files) do
if path.iscppfile(file) then
_p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
_p('\t@echo $(notdir $<)')
- if (path.iscfile(file)) then
- _p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
- else
- _p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
- end
+ cpp.buildcommand(path.iscfile(file))
elseif (path.getextension(file) == ".rc") then
_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
_p('\t@echo $(notdir $<)')
@@ -166,7 +163,7 @@
_p('')
end
-
+
--
-- Write a block of configuration settings.
--
@@ -175,33 +172,22 @@
_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))
- -- if this platform requires a special compiler or linker, list it now
- local platform = cc.platforms[cfg.platform]
- if platform.cc then
- _p(' CC = %s', platform.cc)
- end
- if platform.cxx then
- _p(' CXX = %s', platform.cxx)
- end
- if platform.ar then
- _p(' AR = %s', platform.ar)
- end
+ -- if this platform requires a special compiler or linker, list it here
+ cpp.platformtools(cfg, cc)
_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))
_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))
_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))
_p(' DEFINES += %s', table.concat(cc.getdefines(cfg.defines), " "))
_p(' INCLUDES += %s', table.concat(cc.getincludedirs(cfg.includedirs), " "))
- _p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " "))
+
+ -- CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, and RESFLAGS
+ cpp.flags(cfg, cc)
-- set up precompiled headers
- _.pchconfig(cfg)
+ cpp.pchconfig(cfg)
- _p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
- _p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
- _p(' LDFLAGS += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), " "))
_p(' LIBS += %s', table.concat(cc.getlinkflags(cfg), " "))
- _p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " "))
_p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "siblings", "fullpath")), " "))
if cfg.kind == "StaticLib" then
@@ -237,16 +223,67 @@
end
_p(' endef')
+ -- write out config-level makesettings blocks
+ make.settings(cfg, cc)
+
_p('endif')
_p('')
end
--
+-- Platform support
+--
+
+ function cpp.platformtools(cfg, cc)
+ local platform = cc.platforms[cfg.platform]
+ if platform.cc then
+ _p(' CC = %s', platform.cc)
+ end
+ if platform.cxx then
+ _p(' CXX = %s', platform.cxx)
+ end
+ if platform.ar then
+ _p(' AR = %s', platform.ar)
+ end
+ end
+
+
+--
+-- Configurations
+--
+
+ function cpp.flags(cfg, cc)
+ _p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " "))
+ _p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
+ _p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
+
+ -- Patch #3401184 changed the order
+ _p(' LDFLAGS += %s', table.concat(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions), " "))
+
+ _p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s',
+ table.concat(table.join(cc.getdefines(cfg.resdefines),
+ cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " "))
+ end
+
+
+--
-- Precompiled header support
--
- function _.pchconfig(cfg)
+ function cpp.pchconfig(cfg)
+ -- GCC needs the full path to the PCH, while Visual Studio needs
+ -- only the name (or rather, the name as specified in the #include
+ -- statement). Try to locate the PCH in the project.
+ local pchheader = cfg.pchheader
+ for _, incdir in ipairs(cfg.includedirs) do
+ local testname = path.join(incdir, cfg.pchheader)
+ if os.isfile(testname) then
+ pchheader = testname
+ break
+ end
+ end
+
if not cfg.flags.NoPCH and cfg.pchheader then
_p(' PCH = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader)))
_p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader)))
@@ -254,16 +291,28 @@
end
end
- function _.pchrules(prj)
+ function cpp.pchrules(prj)
_p('ifneq (,$(PCH))')
_p('$(GCH): $(PCH)')
_p('\t@echo $(notdir $<)')
+ _p('ifeq (posix,$(SHELLTYPE))')
_p('\t-$(SILENT) cp $< $(OBJDIR)')
- if prj.language == "C" then
- _p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
- else
- _p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
- end
+ _p('else')
+ _p('\t$(SILENT) xcopy /D /Y /Q "$(subst /,\\,$<)" "$(subst /,\\,$(OBJDIR))" 1>nul')
+ _p('endif')
+ cpp.buildcommand(prj.language == "C")
_p('endif')
_p('')
end
+
+
+--
+-- Build command for a single file.
+--
+
+ function cpp.buildcommand(iscfile)
+ local flags = iif(iscfile, '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)')
+ _p('\t$(SILENT) %s -o "$@" -MF $(@:%%.o=%%.d) -c "$<"', flags)
+ end
+
+
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index 430652f..d79c4bf 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -122,8 +122,10 @@
-- source files are handled at the leaves
onleaf = function(node, depth)
+ local fname = node.cfg.name
+
_p(depth, '<File')
- _p(depth, '\tRelativePath="%s"', path.translate(node.cfg.name, "\\"))
+ _p(depth, '\tRelativePath="%s"', path.translate(fname, "\\"))
_p(depth, '\t>')
depth = depth + 1
@@ -134,21 +136,33 @@
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
local usePCH = (not prj.flags.NoPCH and prj.pchsource == node.cfg.name)
- if (usePCH) then
+ local useCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj))
+
+ if usePCH or useCompileAs then
_p(depth, '<FileConfiguration')
_p(depth, '\tName="%s"', cfginfo.name)
_p(depth, '\t>')
_p(depth, '\t<Tool')
- _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360", "VCCLX360CompilerTool", "VCCLCompilerTool"))
-
- if cfg.system == "PS3" then
- local options = table.join(premake.snc.getcflags(cfg), premake.snc.getcxxflags(cfg), cfg.buildoptions)
- options = table.concat(options, " ");
- options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"'
- _p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options))
- else
- _p(depth, '\t\tUsePrecompiledHeader="1"')
- end
+ _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360",
+ "VCCLX360CompilerTool",
+ "VCCLCompilerTool"))
+
+ if useCompileAs then
+ _p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2))
+ end
+
+ if usePCH then
+ if cfg.system == "PS3" then
+ local options = table.join(premake.snc.getcflags(cfg),
+ premake.snc.getcxxflags(cfg),
+ cfg.buildoptions)
+ options = table.concat(options, " ");
+ options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"'
+ _p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options))
+ else
+ _p(depth, '\t\tUsePrecompiledHeader="1"')
+ end
+ end
_p(depth, '\t/>')
_p(depth, '</FileConfiguration>')
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index 4568428..29621b5 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -6,9 +6,10 @@
premake.vstudio.vc2010 = { }
local vc2010 = premake.vstudio.vc2010
-
+ local vstudio = premake.vstudio
- local function vs2010_config(prj)
+
+ local function vs2010_config(prj)
_p(1,'<ItemGroup Label="ProjectConfigurations">')
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
_p(2,'<ProjectConfiguration Include="%s">', premake.esc(cfginfo.name))
@@ -18,7 +19,7 @@
end
_p(1,'</ItemGroup>')
end
-
+
local function vs2010_globals(prj)
_p(1,'<PropertyGroup Label="Globals">')
_p(2,'<ProjectGuid>{%s}</ProjectGuid>',prj.uuid)
@@ -33,10 +34,10 @@
end
_p(1,'</PropertyGroup>')
end
-
+
function vc2010.config_type(config)
local t =
- {
+ {
SharedLib = "DynamicLibrary",
StaticLib = "StaticLibrary",
ConsoleApp = "Application",
@@ -44,13 +45,13 @@
}
return t[config.kind]
end
-
-
-
+
+
+
local function if_config_and_platform()
return 'Condition="\'$(Configuration)|$(Platform)\'==\'%s\'"'
- end
-
+ end
+
local function optimisation(cfg)
local result = "Disabled"
for _, value in ipairs(cfg.flags) do
@@ -64,7 +65,7 @@
end
return result
end
-
+
local function config_type_block(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
@@ -72,21 +73,21 @@
, premake.esc(cfginfo.name))
_p(2,'<ConfigurationType>%s</ConfigurationType>',vc2010.config_type(cfg))
_p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,"Unicode","MultiByte"))
-
+
if cfg.flags.MFC then
_p(2,'<UseOfMfc>Dynamic</UseOfMfc>')
end
-
+
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>'
,iif(optimisation(cfg) == "Disabled","true","false"))
if cfg.flags.Managed then
_p(2,'<CLRSupport>true</CLRSupport>')
- end
+ end
_p(1,'</PropertyGroup>')
end
end
-
+
local function import_props(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
@@ -104,8 +105,8 @@
,tostring(premake.config.isincrementallink(cfg)))
end
end
-
-
+
+
local function ignore_import_lib(cfg,cfginfo)
if cfg.kind == "SharedLib" then
local shouldIgnore = "false"
@@ -114,12 +115,12 @@
,premake.esc(cfginfo.name),shouldIgnore)
end
end
-
-
+
+
local function intermediate_and_out_dirs(prj)
_p(1,'<PropertyGroup>')
_p(2,'<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>')
-
+
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
_p(2,'<OutDir '..if_config_and_platform() ..'>%s\\</OutDir>'
@@ -139,7 +140,7 @@
_p(1,'</PropertyGroup>')
end
-
+
local function runtime(cfg)
local runtime
local flags = cfg.flags
@@ -150,11 +151,11 @@
end
return runtime
end
-
+
local function precompiled_header(cfg)
if not cfg.flags.NoPCH and cfg.pchheader then
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
- _p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))
+ _p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)
else
_p(3,'<PrecompiledHeader></PrecompiledHeader>')
end
@@ -168,22 +169,22 @@
_p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>')
end
end
-
+
local function include_dirs(indent,cfg)
if #cfg.includedirs > 0 then
_p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>'
,premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\')))
end
end
-
+
local function resource_compile(cfg)
_p(2,'<ResourceCompile>')
preprocessor(3,cfg)
include_dirs(3,cfg)
_p(2,'</ResourceCompile>')
-
+
end
-
+
local function exceptions(cfg)
if cfg.flags.NoExceptions then
_p(2,'<ExceptionHandling>false</ExceptionHandling>')
@@ -192,13 +193,13 @@
--SEH is not required for Managed and is implied
end
end
-
+
local function rtti(cfg)
if cfg.flags.NoRTTI and not cfg.flags.Managed then
_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
end
end
-
+
local function wchar_t_buildin(cfg)
if cfg.flags.NativeWChar then
_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
@@ -206,7 +207,7 @@
_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
end
end
-
+
local function sse(cfg)
if cfg.flags.EnableSSE then
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
@@ -214,7 +215,7 @@
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
end
end
-
+
local function floating_point(cfg)
if cfg.flags.FloatFast then
_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')
@@ -222,7 +223,7 @@
_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')
end
end
-
+
local function debug_info(cfg)
--
@@ -233,7 +234,7 @@
local debug_info = ''
if cfg.flags.Symbols then
if cfg.platform == "x64"
- or cfg.flags.Managed
+ or cfg.flags.Managed
or premake.config.isoptimizedbuild(cfg.flags)
or cfg.flags.NoEditAndContinue
then
@@ -242,10 +243,10 @@
debug_info = "EditAndContinue"
end
end
-
+
_p(3,'<DebugInformationFormat>%s</DebugInformationFormat>',debug_info)
end
-
+
local function minimal_build(cfg)
if premake.config.isdebugbuild(cfg) and not cfg.flags.NoMinimalRebuild then
_p(3,'<MinimalRebuild>true</MinimalRebuild>')
@@ -253,62 +254,62 @@
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
end
end
-
+
local function compile_language(cfg)
if cfg.language == "C" then
_p(3,'<CompileAs>CompileAsC</CompileAs>')
end
- end
-
+ end
+
local function vs10_clcompile(cfg)
_p(2,'<ClCompile>')
-
+
if #cfg.buildoptions > 0 then
_p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',
table.concat(premake.esc(cfg.buildoptions), " "))
end
-
+
_p(3,'<Optimization>%s</Optimization>',optimisation(cfg))
-
+
include_dirs(3,cfg)
preprocessor(3,cfg)
minimal_build(cfg)
-
+
if not premake.config.isoptimizedbuild(cfg.flags) then
if not cfg.flags.Managed then
_p(3,'<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')
end
-
+
if cfg.flags.ExtraWarnings then
_p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')
end
else
_p(3,'<StringPooling>true</StringPooling>')
end
-
+
_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))
-
+
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
-
+
precompiled_header(cfg)
-
+
if cfg.flags.ExtraWarnings then
_p(3,'<WarningLevel>Level4</WarningLevel>')
else
_p(3,'<WarningLevel>Level3</WarningLevel>')
end
-
+
if cfg.flags.FatalWarnings then
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
end
-
+
exceptions(cfg)
rtti(cfg)
wchar_t_buildin(cfg)
sse(cfg)
floating_point(cfg)
debug_info(cfg)
-
+
if cfg.flags.Symbols then
_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'
, path.getbasename(cfg.buildtarget.name))
@@ -317,31 +318,31 @@
if cfg.flags.NoFramePointer then
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
end
-
+
compile_language(cfg)
_p(2,'</ClCompile>')
end
- local function event_hooks(cfg)
+ local function event_hooks(cfg)
if #cfg.postbuildcommands> 0 then
_p(2,'<PostBuildEvent>')
_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
_p(2,'</PostBuildEvent>')
end
-
+
if #cfg.prebuildcommands> 0 then
_p(2,'<PreBuildEvent>')
_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")))
_p(2,'</PreBuildEvent>')
end
-
+
if #cfg.prelinkcommands> 0 then
_p(2,'<PreLinkEvent>')
_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n")))
_p(2,'</PreLinkEvent>')
- end
+ end
end
local function additional_options(indent,cfg)
@@ -357,7 +358,7 @@
_p(index,'<TargetMachine>%s</TargetMachine>', platforms[cfg.platform])
end
end
-
+
local function item_def_lib(cfg)
if cfg.kind == 'StaticLib' then
_p(1,'<Lib>')
@@ -367,9 +368,9 @@
_p(1,'</Lib>')
end
end
-
-
+
+
local function import_lib(cfg)
--Prevent the generation of an import library for a Windows DLL.
if cfg.kind == "SharedLib" then
@@ -377,39 +378,45 @@
_p(3,'<ImportLibrary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname))
end
end
-
+
local function common_link_section(cfg)
_p(3,'<SubSystem>%s</SubSystem>',iif(cfg.kind == "ConsoleApp","Console", "Windows"))
-
- if cfg.flags.Symbols then
+
+ if cfg.flags.Symbols then
_p(3,'<GenerateDebugInformation>true</GenerateDebugInformation>')
else
_p(3,'<GenerateDebugInformation>false</GenerateDebugInformation>')
end
-
+
if premake.config.isoptimizedbuild(cfg.flags) then
_p(3,'<OptimizeReferences>true</OptimizeReferences>')
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
end
end
-
+
+
+ function vc2010.additionalDependencies(cfg)
+ local links = premake.getlinks(cfg, "system", "fullpath")
+ if #links > 0 then
+ _p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',
+ table.concat(links, ";"))
+ end
+ end
+
+
local function item_link(cfg)
_p(2,'<Link>')
if cfg.kind ~= 'StaticLib' then
-
- if #cfg.links > 0 then
- _p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',
- table.concat(premake.getlinks(cfg, "all", "fullpath"), ";"))
- end
- _p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
-
- _p(3,'<AdditionalLibraryDirectories>%s%s%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>',
- table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"),
- iif(cfg.libdirs and #cfg.libdirs >0,';',''))
-
+ vc2010.additionalDependencies(cfg)
+ _p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
+
+ _p(3,'<AdditionalLibraryDirectories>%s%s%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>',
+ table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"),
+ iif(cfg.libdirs and #cfg.libdirs > 0,';',''))
+
common_link_section(cfg)
-
+
if vc2010.config_type(cfg) == 'Application' and not cfg.flags.WinMain and not cfg.flags.Managed then
_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
end
@@ -420,10 +427,11 @@
else
common_link_section(cfg)
end
-
+
_p(2,'</Link>')
end
-
+
+
local function item_definitions(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
@@ -436,11 +444,11 @@
event_hooks(cfg)
_p(1,'</ItemDefinitionGroup>')
-
+
end
end
-
-
+
+
--
-- Retrieve a list of files for a particular build group, one of
@@ -456,7 +464,7 @@
None = {},
ResourceCompile = {},
}
-
+
for file in premake.project.eachfile(prj) do
if path.iscppfile(file.name) then
table.insert(sortedfiles.ClCompile, file)
@@ -468,11 +476,11 @@
table.insert(sortedfiles.None, file)
end
end
-
+
-- Cache the sorted files; they are used several places
prj.vc2010sortedfiles = sortedfiles
end
-
+
return sortedfiles[group]
end
@@ -500,11 +508,11 @@
end
end
-
+
function vc2010.compilerfilesgroup(prj)
local configs = prj.solution.vstudio_configs
local files = vc2010.getfilegroup(prj, "ClCompile")
- if #files > 0 then
+ if #files > 0 then
local config_mappings = {}
for _, cfginfo in ipairs(configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
@@ -512,17 +520,17 @@
config_mappings[cfginfo] = path.translate(cfg.pchsource, "\\")
end
end
-
+
_p(1,'<ItemGroup>')
for _, file in ipairs(files) do
local translatedpath = path.translate(file.name, "\\")
_p(2,'<ClCompile Include=\"%s\">', translatedpath)
for _, cfginfo in ipairs(configs) do
- if config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then
+ if config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then
_p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>', premake.esc(cfginfo.name))
config_mappings[cfginfo] = nil --only one source file per pch
end
- end
+ end
_p(2,'</ClCompile>')
end
_p(1,'</ItemGroup>')
@@ -537,12 +545,12 @@
function vc2010.header(targets)
io.eol = "\r\n"
_p('<?xml version="1.0" encoding="utf-8"?>')
-
+
local t = ""
if targets then
t = ' DefaultTargets="' .. targets .. '"'
end
-
+
_p('<Project%s ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', t)
end
@@ -557,28 +565,29 @@
vs2010_config(prj)
vs2010_globals(prj)
-
+
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />')
-
+
config_type_block(prj)
-
+
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />')
-
+
--check what this section is doing
_p(1,'<ImportGroup Label="ExtensionSettings">')
_p(1,'</ImportGroup>')
-
-
+
+
import_props(prj)
-
+
--what type of macros are these?
_p(1,'<PropertyGroup Label="UserMacros" />')
-
+
intermediate_and_out_dirs(prj)
-
+
item_definitions(prj)
-
+
vc2010.files(prj)
+ vc2010.projectReferences(prj)
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
_p(1,'<ImportGroup Label="ExtensionTargets">')
@@ -586,7 +595,26 @@
_p('</Project>')
end
-
+
+
+--
+-- Generate the list of project dependencies.
+--
+
+ function vc2010.projectReferences(prj)
+ local deps = premake.getdependencies(prj)
+ if #deps > 0 then
+ _p(1,'<ItemGroup>')
+ for _, dep in ipairs(deps) do
+ local deppath = path.getrelative(prj.solution.location, vstudio.projectfile(dep))
+ _p(2,'<ProjectReference Include=\"%s\">', path.translate(deppath, "\\"))
+ _p(3,'<Project>{%s}</Project>', dep.uuid)
+ _p(2,'</ProjectReference>')
+ end
+ _p(1,'</ItemGroup>')
+ end
+ end
+
--
-- Generate the .vcxproj.user file
@@ -603,8 +631,8 @@
end
function vc2010.debugenvs(cfg)
- if cfg.debugenvs and #cfg.debugenvs > 0 then
- _p(2,'<LocalDebuggerEnvironment>%s%s</LocalDebuggerEnvironment>',table.concat(cfg.debugenvs, "\n")
+ if cfg.debugenvs and #cfg.debugenvs > 0 then
+ _p(2,'<LocalDebuggerEnvironment>%s%s</LocalDebuggerEnvironment>',table.concat(cfg.debugenvs, "\n")
,iif(cfg.flags.DebugEnvsInherit,'\n$(LocalDebuggerEnvironment)','')
)
if cfg.flags.DebugEnvsDontMerge then
@@ -625,6 +653,6 @@
end
_p('</Project>')
end
-
-
+
+
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
index 5ebfb0d..286fd4c 100644
--- a/src/actions/xcode/xcode_common.lua
+++ b/src/actions/xcode/xcode_common.lua
@@ -1,7 +1,7 @@
--
-- xcode_common.lua
-- Functions to generate the different sections of an Xcode project.
--- Copyright (c) 2009-2010 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
local xcode = premake.xcode
@@ -481,7 +481,7 @@
_p(2,'08FB7793FE84155DC02AAC07 /* Project object */ = {')
_p(3,'isa = PBXProject;')
_p(3,'buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "%s" */;', tr.name)
- _p(3,'compatibilityVersion = "Xcode 3.1";')
+ _p(3,'compatibilityVersion = "Xcode 3.2";')
_p(3,'hasScannedForEncodings = 1;')
_p(3,'mainGroup = %s /* %s */;', tr.id, tr.name)
_p(3,'projectDirPath = "";')
@@ -748,7 +748,7 @@
_p(4,'GCC_ENABLE_CPP_RTTI = NO;')
end
- if cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then
+ if _ACTION ~= "xcode4" and cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then
_p(4,'GCC_ENABLE_FIX_AND_CONTINUE = YES;')
end
@@ -814,8 +814,6 @@
flags = table.join(flags, cfg.linkoptions)
xcode.printlist(flags, 'OTHER_LDFLAGS')
- _p(4,'PREBINDING = NO;')
-
if cfg.flags.StaticRuntime then
_p(4,'STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;')
end
diff --git a/src/base/api.lua b/src/base/api.lua
index cc51321..b47d107 100644
--- a/src/base/api.lua
+++ b/src/base/api.lua
@@ -262,6 +262,12 @@
scope = "container",
},
+ makesettings =
+ {
+ kind = "list",
+ scope = "config",
+ },
+
objdir =
{
kind = "path",
@@ -389,7 +395,7 @@
vpaths =
{
- kind = "keyvalue",
+ kind = "keypath",
scope = "container",
},
@@ -630,7 +636,7 @@
return premake.setdirarray(scope, name, value)
elseif kind == "filelist" then
return premake.setfilearray(scope, name, value)
- elseif kind == "keyvalue" then
+ elseif kind == "keyvalue" or kind == "keypath" then
return premake.setkeyvalue(scope, name, value)
end
end
diff --git a/src/base/bake.lua b/src/base/bake.lua
index fe511cb..9276af8 100644
--- a/src/base/bake.lua
+++ b/src/base/bake.lua
@@ -22,7 +22,14 @@
projects = true,
__configs = true,
}
-
+
+-- do not cascade these fields from projects to configurations
+
+ local nocascade =
+ {
+ makesettings = true,
+ }
+
-- leave these paths as absolute, rather than converting to project relative
local keeprelative =
@@ -116,14 +123,22 @@
--
local function adjustpaths(location, obj)
+ function adjustpathlist(list)
+ for i, p in ipairs(list) do
+ list[i] = path.getrelative(location, p)
+ end
+ end
+
for name, value in pairs(obj) do
local field = premake.fields[name]
if field and value and not keeprelative[name] then
if field.kind == "path" then
obj[name] = path.getrelative(location, value)
elseif field.kind == "dirlist" or field.kind == "filelist" then
- for i, p in ipairs(value) do
- value[i] = path.getrelative(location, p)
+ adjustpathlist(value)
+ elseif field.kind == "keypath" then
+ for k,v in pairs(value) do
+ adjustpathlist(v)
end
end
end
@@ -144,7 +159,7 @@
local function mergefield(kind, dest, src)
local tbl = dest or { }
- if kind == "keyvalue" then
+ if kind == "keyvalue" or kind == "keypath" then
for key, value in pairs(src) do
tbl[key] = mergefield("list", tbl[key], value)
end
diff --git a/src/base/globals.lua b/src/base/globals.lua
index 47966ff..99c8ac7 100644
--- a/src/base/globals.lua
+++ b/src/base/globals.lua
@@ -45,6 +45,12 @@
nosharedlibs = true,
namestyle = "PS3",
},
+ WiiDev =
+ {
+ cfgsuffix = "wii",
+ iscrosscompiler = true,
+ namestyle = "PS3",
+ },
Xbox360 =
{
cfgsuffix = "xbox360",
diff --git a/src/base/project.lua b/src/base/project.lua
index 1f40cde..2fcb0fa 100644
--- a/src/base/project.lua
+++ b/src/base/project.lua
@@ -441,7 +441,10 @@
local kind = cfg.kind
if premake.iscppproject(cfg) then
-- On Windows, shared libraries link against a static import library
- if (namestyle == "windows" or system == "windows") and kind == "SharedLib" and direction == "link" then
+ if (namestyle == "windows" or system == "windows")
+ and kind == "SharedLib" and direction == "link"
+ and not cfg.flags.NoImportLib
+ then
kind = "StaticLib"
end
@@ -619,6 +622,15 @@
--
+-- Returns true if the project use the C language.
+--
+
+ function premake.project.iscproject(prj)
+ return prj.language == "C"
+ end
+
+
+--
-- Returns true if the project uses a C/C++ language.
--
diff --git a/src/host/os_getversion.c b/src/host/os_getversion.c
index 7874162..3cef742 100755
--- a/src/host/os_getversion.c
+++ b/src/host/os_getversion.c
@@ -26,7 +26,7 @@ int os_getversion(lua_State* L)
lua_pushstring(L, "majorversion");
lua_pushnumber(L, info.majorversion);
lua_settable(L, -3);
-
+
lua_pushstring(L, "minorversion");
lua_pushnumber(L, info.minorversion);
lua_settable(L, -3);
@@ -58,8 +58,8 @@ SYSTEM_INFO getsysteminfo()
{
typedef void (WINAPI *GetNativeSystemInfoSig)(LPSYSTEM_INFO);
GetNativeSystemInfoSig nativeSystemInfo = (GetNativeSystemInfoSig)
- GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetNativeSystemInfo");
-
+ GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetNativeSystemInfo");
+
SYSTEM_INFO systemInfo = {{0}};
if ( nativeSystemInfo ) nativeSystemInfo(&systemInfo);
else GetSystemInfo(&systemInfo);
@@ -76,7 +76,7 @@ void getversion(struct OsVersionInfo* info)
info->majorversion = versionInfo.dwMajorVersion;
info->minorversion = versionInfo.dwMinorVersion;
info->revision = versionInfo.wServicePackMajor;
-
+
if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 0)
{
info->description = "Windows 2000";
@@ -123,7 +123,7 @@ void getversion(struct OsVersionInfo* info)
{
info->description = "Windows Server 2008 R2";
}
- else
+ else
{
info->description = "Windows 7";
}
@@ -141,11 +141,11 @@ void getversion(struct OsVersionInfo* info)
#include <CoreServices/CoreServices.h>
void getversion(struct OsVersionInfo* info)
-{
+{
Gestalt(gestaltSystemVersionMajor, &info->majorversion);
Gestalt(gestaltSystemVersionMinor, &info->minorversion);
- Gestalt(gestaltSystemVersionBugFix, &info->revision);
-
+ Gestalt(gestaltSystemVersionBugFix, &info->revision);
+
info->description = "Mac OS X";
if (info->majorversion == 10)
{
diff --git a/src/host/os_stat.c b/src/host/os_stat.c
new file mode 100755
index 0000000..b3554dc
--- /dev/null
+++ b/src/host/os_stat.c
@@ -0,0 +1,46 @@
+/**
+ * \file os_stat.c
+ * \brief Retrieve information about a file.
+ * \author Copyright (c) 2011 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include <sys/stat.h>
+#include <errno.h>
+
+int os_stat(lua_State* L)
+{
+ struct stat s;
+
+ const char* filename = luaL_checkstring(L, 1);
+ if (stat(filename, &s) != 0)
+ {
+ lua_pushnil(L);
+ switch (errno)
+ {
+ case EACCES:
+ lua_pushfstring(L, "'%s' could not be accessed", filename);
+ break;
+ case ENOENT:
+ lua_pushfstring(L, "'%s' was not found", filename);
+ break;
+ default:
+ lua_pushfstring(L, "An unknown error %d occured while accessing '%s'", errno, filename);
+ break;
+ }
+ return 2;
+ }
+
+
+ lua_newtable(L);
+
+ lua_pushstring(L, "mtime");
+ lua_pushinteger(L, (lua_Integer)s.st_mtime);
+ lua_settable(L, -3);
+
+ lua_pushstring(L, "size");
+ lua_pushnumber(L, s.st_size);
+ lua_settable(L, -3);
+
+ return 1;
+}
diff --git a/src/host/premake.c b/src/host/premake.c
index 7548ff4..025d8c7 100755
--- a/src/host/premake.c
+++ b/src/host/premake.c
@@ -49,6 +49,7 @@ static const luaL_Reg os_functions[] = {
{ "mkdir", os_mkdir },
{ "pathsearch", os_pathsearch },
{ "rmdir", os_rmdir },
+ { "stat", os_stat },
{ "uuid", os_uuid },
{ NULL, NULL }
};
diff --git a/src/host/premake.h b/src/host/premake.h
index cd7d522..fba3ea5 100755
--- a/src/host/premake.h
+++ b/src/host/premake.h
@@ -67,6 +67,7 @@ int os_matchstart(lua_State* L);
int os_mkdir(lua_State* L);
int os_pathsearch(lua_State* L);
int os_rmdir(lua_State* L);
+int os_stat(lua_State* L);
int os_uuid(lua_State* L);
int string_endswith(lua_State* L);
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua
index caedd52..1e8ed31 100644
--- a/src/tools/gcc.lua
+++ b/src/tools/gcc.lua
@@ -79,7 +79,16 @@
cxx = "ppu-lv2-g++",
ar = "ppu-lv2-ar",
cppflags = "-MMD",
- }
+ },
+ WiiDev = {
+ cppflags = "-MMD -MP -I$(LIBOGC_INC) $(MACHDEP)",
+ ldflags = "-L$(LIBOGC_LIB) $(MACHDEP)",
+ cfgsettings = [[
+ ifeq ($(strip $(DEVKITPPC)),)
+ $(error "DEVKITPPC environment variable is not set")'
+ endif
+ include $(DEVKITPPC)/wii_rules']],
+ },
}
local platforms = premake.gcc.platforms
@@ -118,9 +127,8 @@
local result = table.translate(cfg.flags, cxxflags)
return result
end
-
-
+
--
-- Returns a list of linker flags, based on the supplied configuration.
--
@@ -240,3 +248,13 @@
end
return result
end
+
+
+--
+-- Return platform specific project and configuration level
+-- makesettings blocks.
+--
+
+ function premake.gcc.getcfgsettings(cfg)
+ return platforms[cfg.platform].cfgsettings
+ end
diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua
index 8d772d4..f52bf3e 100644
--- a/tests/actions/make/test_make_pch.lua
+++ b/tests/actions/make/test_make_pch.lua
@@ -68,8 +68,12 @@
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
+ifeq (posix,$(SHELLTYPE))
-$(SILENT) cp $< $(OBJDIR)
- $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
+else
+ $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
+endif
+ $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
endif
]]
end
@@ -83,8 +87,12 @@ endif
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
+ifeq (posix,$(SHELLTYPE))
-$(SILENT) cp $< $(OBJDIR)
- $(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"
+else
+ $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
+endif
+ $(SILENT) $(CC) $(CFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
endif
]]
end
diff --git a/tests/actions/make/test_makesettings.lua b/tests/actions/make/test_makesettings.lua
new file mode 100644
index 0000000..8a6f132
--- /dev/null
+++ b/tests/actions/make/test_makesettings.lua
@@ -0,0 +1,51 @@
+--
+-- tests/actions/make/test_makesettings.lua
+-- Tests makesettings lists in generated makefiles.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.make_settings = { }
+ local suite = T.make_settings
+ local make = premake.make
+
+ local sln, prj, cfg
+
+ function suite.setup()
+ _ACTION = "gmake"
+
+ sln = solution("MySolution")
+ configurations { "Debug", "Release" }
+ makesettings { "SOLUTION_LEVEL_SETTINGS" }
+
+ project("MyProject")
+ makesettings { "PROJECT_LEVEL_SETTINGS" }
+
+ configuration { "Debug" }
+ makesettings { "DEBUG_LEVEL_SETTINGS" }
+
+ configuration { "Release" }
+ makesettings { "RELEASE_LEVEL_SETTINGS" }
+
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ cfg = premake.getconfig(prj, "Debug")
+ end
+
+
+ function suite.writesProjectSettings()
+ make.settings(prj, premake.gcc)
+ test.capture [[
+SOLUTION_LEVEL_SETTINGS
+PROJECT_LEVEL_SETTINGS
+
+ ]]
+ end
+
+ function suite.writesConfigSettings()
+ make.settings(cfg, premake.gcc)
+ test.capture [[
+DEBUG_LEVEL_SETTINGS
+
+ ]]
+ end
+
diff --git a/tests/actions/make/test_wiidev.lua b/tests/actions/make/test_wiidev.lua
new file mode 100644
index 0000000..fd0bfdd
--- /dev/null
+++ b/tests/actions/make/test_wiidev.lua
@@ -0,0 +1,56 @@
+--
+-- tests/actions/make/test_wiidev.lua
+-- Tests for Wii homebrew support in makefiles.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.make_wiidev = { }
+ local suite = T.make_wiidev
+ local make = premake.make
+ local cpp = premake.make.cpp
+
+ local sln, prj, cfg
+
+ function suite.setup()
+ _ACTION = "gmake"
+
+ sln = solution("MySolution")
+ configurations { "Debug", "Release" }
+ platforms { "WiiDev" }
+
+ prj = project("MyProject")
+
+ premake.bake.buildconfigs()
+ cfg = premake.getconfig(prj, "Debug", "WiiDev")
+ end
+
+
+--
+-- Make sure that the Wii-specific flags are passed to the tools.
+--
+
+ function suite.writesCorrectFlags()
+ cpp.flags(cfg, premake.gcc)
+ test.capture [[
+ CPPFLAGS += -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) -MP $(DEFINES) $(INCLUDES)
+ CFLAGS += $(CPPFLAGS) $(ARCH)
+ CXXFLAGS += $(CFLAGS)
+ LDFLAGS += -s -L$(LIBOGC_LIB) $(MACHDEP)
+ RESFLAGS += $(DEFINES) $(INCLUDES)
+ ]]
+ end
+
+
+--
+-- Make sure the dev kit include is written to each Wii build configuration.
+--
+
+ function suite.writesIncludeBlock()
+ make.settings(cfg, premake.gcc)
+ test.capture [[
+ ifeq ($(strip $(DEVKITPPC)),)
+ $(error "DEVKITPPC environment variable is not set")'
+ endif
+ include $(DEVKITPPC)/wii_rules'
+ ]]
+ end
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua
index 42a5a4c..a7a3942 100644
--- a/tests/actions/vstudio/test_vs2010_vcxproj.lua
+++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua
@@ -3,8 +3,8 @@
local include_directory = "bar/foo"
local include_directory2 = "baz/foo"
local debug_define = "I_AM_ALIVE_NUMBER_FIVE"
- local vc2010 = premake.vstudio.vc2010
-
+ local vc2010 = premake.vstudio.vc2010
+
local sln, prj
function vs10_vcxproj.teardown()
sln = nil
@@ -16,30 +16,30 @@
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
-
+
prj = project "MyProject"
language "C++"
kind "ConsoleApp"
- uuid "AE61726D-187C-E440-BD07-2556188A6565"
-
+ uuid "AE61726D-187C-E440-BD07-2556188A6565"
+
includedirs
{
include_directory,
include_directory2
}
- files
- {
- "foo/dummyHeader.h",
- "foo/dummySource.cpp",
+ files
+ {
+ "foo/dummyHeader.h",
+ "foo/dummySource.cpp",
"../src/host/*h",
"../src/host/*.c",
"dummyResourceScript.rc"
}
-
+
configuration("Release")
flags {"Optimize"}
links{"foo","bar"}
-
+
configuration("Debug")
defines {debug_define}
links{"foo_d"}
@@ -75,12 +75,12 @@
local buffer = get_buffer()
test.string_contains(buffer,'<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">.*</Project>')
end
-
+
function vs10_vcxproj.configItemGroupPresent()
local buffer = get_buffer()
test.string_contains(buffer,'<ItemGroup Label="ProjectConfigurations">.*</ItemGroup>')
end
-
+
function vs10_vcxproj.configBlocksArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<ProjectConfiguration.*</ProjectConfiguration>')
@@ -90,38 +90,38 @@
local buffer = get_buffer()
test.string_contains(buffer,'<PropertyGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'" Label="Configuration">.*</PropertyGroup>')
end
-
+
function vs10_vcxproj.twoConfigTypeBlocksPresent()
local buffer = get_buffer()
- test.string_contains(buffer,'<PropertyGroup Condition.*</PropertyGroup>.*<PropertyGroup Condition=.*</PropertyGroup>')
+ test.string_contains(buffer,'<PropertyGroup Condition.*</PropertyGroup>.*<PropertyGroup Condition=.*</PropertyGroup>')
end
-
+
function vs10_vcxproj.propsDefaultForCppProjArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<Import Project="$%(VCTargetsPath%)\\Microsoft.Cpp.Default.props" />')
end
-
-
+
+
function vs10_vcxproj.propsForCppProjArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<Import Project="%$%(VCTargetsPath%)\\Microsoft.Cpp.props" />')
end
-
+
function vs10_vcxproj.extensionSettingArePresent()
local buffer = get_buffer()
test.string_contains(buffer,'<ImportGroup Label="ExtensionSettings">.*</ImportGroup>')
end
-
+
function vs10_vcxproj.userMacrosPresent()
local buffer = get_buffer()
test.string_contains(buffer,'<PropertyGroup Label="UserMacros" />')
end
-
+
function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber()
local buffer = get_buffer()
test.string_contains(buffer,'<PropertyGroup>.*<_ProjectFileVersion>10%.0%.30319%.1</_ProjectFileVersion>')
end
-
+
function vs10_vcxproj.outDirPresent()
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir.*</OutDir>')
@@ -130,7 +130,7 @@
local buffer = get_buffer()
test.string_contains(buffer,'<IntDir.*</IntDir>')
end
-
+
function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs()
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir.*</OutDir>.*<IntDir.*</IntDir>.*<OutDir.*</OutDir>.*<IntDir.*</IntDir>')
@@ -140,68 +140,68 @@
local buffer = get_buffer()
test.string_contains(buffer,'<ItemDefinitionGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">.*</ItemDefinitionGroup>')
end
-
+
function vs10_vcxproj.containsClCompileBlock()
local buffer = get_buffer()
- test.string_contains(buffer,'<ClCompile>.*</ClCompile>')
+ test.string_contains(buffer,'<ClCompile>.*</ClCompile>')
end
function vs10_vcxproj.containsAdditionalOptions()
buildoptions {"/Gm"}
local buffer = get_buffer()
- test.string_contains(buffer,'<AdditionalOptions>/Gm %%%(AdditionalOptions%)</AdditionalOptions>')
+ test.string_contains(buffer,'<AdditionalOptions>/Gm %%%(AdditionalOptions%)</AdditionalOptions>')
end
-
+
local function cl_compile_string(version)
return '<ItemDefinitionGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\''..version..'|Win32\'">.*<ClCompile>'
end
-
+
function vs10_vcxproj.debugHasNoOptimisation()
local buffer = get_buffer()
test.string_contains(buffer, cl_compile_string('Debug').. '.*<Optimization>Disabled</Optimization>.*</ItemDefinitionGroup>')
end
-
+
function vs10_vcxproj.releaseHasFullOptimisation()
local buffer = get_buffer()
test.string_contains(buffer, cl_compile_string('Release').. '.*<Optimization>Full</Optimization>.*</ItemDefinitionGroup>')
end
-
+
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>'.. path.translate(include_directory, '\\') ..'.*</AdditionalIncludeDirectories>')
end
-
+
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PrefixWithSemiColon()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*;'.. path.translate(include_directory2, '\\') ..'.*</AdditionalIncludeDirectories>')
end
-
+
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PostfixWithSemiColon()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*'.. path.translate(include_directory2, '\\') ..';.*</AdditionalIncludeDirectories>')
end
-
+
function vs10_vcxproj.debugContainsPreprossorBlock()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug').. '.*<PreprocessorDefinitions>.*</PreprocessorDefinitions>')
end
-
+
function vs10_vcxproj.debugHasDebugDefine()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Debug')..'.*<PreprocessorDefinitions>.*'..debug_define..'.*</PreprocessorDefinitions>')
end
-
+
function vs10_vcxproj.releaseHasStringPoolingOn()
local buffer = get_buffer()
test.string_contains(buffer,cl_compile_string('Release')..'.*<StringPooling>true</StringPooling>')
end
-
+
function vs10_vcxproj.hasItemGroupSection()
local buffer = get_buffer()
test.string_contains(buffer,'<ItemGroup>.*</ItemGroup>')
end
-
+
function vs10_vcxproj.itemGroupSection_hasResourceCompileSection()
--for some reason this does not work here and it needs to be in
--the project setting at the top ?
@@ -214,25 +214,25 @@
local buffer = get_buffer()
test.string_contains(buffer,'<ProjectConfiguration Include="Debug|Win32">')
end
-
+
function vs10_vcxproj.postBuildEvent_isPresent()
postbuildcommands { "doSomeThing" }
local buffer = get_buffer()
test.string_contains(buffer,'<PostBuildEvent>.*<Command>.*</Command>.*</PostBuildEvent>')
end
-
+
function vs10_vcxproj.postBuildEvent_containsCorrectInformationBetweenCommandTag()
postbuildcommands { "doSomeThing" }
local buffer = get_buffer()
test.string_contains(buffer,'<PostBuildEvent>.*<Command>doSomeThing</Command>.*</PostBuildEvent>')
end
-
+
function vs10_vcxproj.postBuildEvent_eventEncloseByQuotes_containsCorrectInformationBetweenCommandTag()
postbuildcommands { "\"doSomeThing\"" }
local buffer = get_buffer()
test.string_contains(buffer,'<PostBuildEvent>.*<Command>&quot;doSomeThing&quot;</Command>.*</PostBuildEvent>')
end
-
+
function vs10_vcxproj.outDir_directorySuppliedIsNotSlashPostFixed_bufferContainsOutDirSlashPostFixed()
targetdir("dir")
local buffer = get_buffer()
@@ -245,28 +245,28 @@
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
end
-
+
function vs10_vcxproj.outDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsOutDirSlashPostFixed()
targetdir("dir\\")
local buffer = get_buffer()
test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
end
-
- function vs10_vcxproj.objectDir_directorySuppliedIsNotSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
+
+ function vs10_vcxproj.objectDir_directorySuppliedIsNotSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
objdir ("dir")
local buffer = get_buffer()
test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
end
-
+
--postfixed directory slashes are removed by default
- --yet these following two tests are to ensure if this behaviour is changed they will fail
+ --yet these following two tests are to ensure if this behaviour is changed they will fail
function vs10_vcxproj.objectDir_directorySuppliedWhichIsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
objdir ("dir/")
local buffer = get_buffer()
test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
end
-
+
function vs10_vcxproj.objectDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
objdir ("dir\\")
local buffer = get_buffer()
@@ -283,7 +283,7 @@
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<SmallerTypeCheck>')
end
-
+
function vs10_vcxproj.debugAndExtraWarnings_bufferContainsSmallerTypeCheck()
configuration("Debug")
flags {"ExtraWarnings"}
@@ -297,35 +297,35 @@
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<SmallerTypeCheck>')
end
-
+
function vs10_vcxproj.onlyOneProjectConfigurationBlockWhenMultipleConfigs()
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<ItemGroup Label="ProjectConfigurations">.*<ItemGroup Label="ProjectConfigurations">')
- end
-
+ end
+
function vs10_vcxproj.languageC_bufferContainsCompileAsC()
- language "C"
+ language "C"
local buffer = get_buffer()
test.string_contains(buffer,'<CompileAs>CompileAsC</CompileAs>')
- end
-
+ end
+
local debug_config_pch_string = '<PrecompiledHeader Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">Create</PrecompiledHeader>'
local release_config_pch_string = debug_config_pch_string:gsub('Debug','Release')
-
+
function vs10_vcxproj.noPchFlagSet_bufferDoesNotContainPchCreate()
configuration("Debug")
flags{"NoPCH"}
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
end
-
+
function vs10_vcxproj.pchHeaderSetYetPchSourceIsNot_bufferDoesNotContainPchCreate()
configuration("Debug")
pchheader "foo/dummyHeader.h"
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
- end
-
+ end
+
function vs10_vcxproj.pchHeaderAndSourceSet_yetAlsoNoPch_bufferDoesNotContainpchCreate()
configuration('Debug')
pchheader "foo/dummyHeader.h"
@@ -339,8 +339,8 @@
configuration("Debug")
pchheader "foo/dummyHeader.h"
pchsource "foo/dummySource.cpp"
- local buffer = get_buffer()
- test.string_contains(buffer,debug_config_pch_string)
+ local buffer = get_buffer()
+ test.string_contains(buffer,debug_config_pch_string)
end
function vs10_vcxproj.wholeProgramOptimizationIsNotSetByDefault_bufferDoesNotContainWholeProgramOptimization()
diff --git a/tests/actions/vstudio/vc200x/files.lua b/tests/actions/vstudio/vc200x/files.lua
index facb17d..4633674 100644
--- a/tests/actions/vstudio/vc200x/files.lua
+++ b/tests/actions/vstudio/vc200x/files.lua
@@ -32,18 +32,18 @@
--
function suite.SimpleSourceFile()
- files { "hello.c" }
+ files { "hello.cpp" }
prepare()
test.capture [[
<File
- RelativePath="hello.c"
+ RelativePath="hello.cpp"
>
</File>
]]
end
function suite.SingleFolderLevel()
- files { "src/hello.c" }
+ files { "src/hello.cpp" }
prepare()
test.capture [[
<Filter
@@ -51,7 +51,7 @@
Filter=""
>
<File
- RelativePath="src\hello.c"
+ RelativePath="src\hello.cpp"
>
</File>
</Filter>
@@ -59,7 +59,7 @@
end
function suite.MultipleFolderLevels()
- files { "src/greetings/hello.c" }
+ files { "src/greetings/hello.cpp" }
prepare()
test.capture [[
<Filter
@@ -71,7 +71,7 @@
Filter=""
>
<File
- RelativePath="src\greetings\hello.c"
+ RelativePath="src\greetings\hello.cpp"
>
</File>
</Filter>
@@ -81,6 +81,67 @@
--
+-- Mixed language support
+--
+
+ function suite.CompileAsC_InCppProject()
+ language "c++"
+ files { "hello.c" }
+ prepare()
+ test.capture [[
+ <File
+ RelativePath="hello.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="1"
+ />
+ </FileConfiguration>
+ </File>
+ ]]
+ end
+
+ function suite.CompileAsCpp_InCProject()
+ language "c"
+ files { "hello.cpp" }
+ prepare()
+ test.capture [[
+ <File
+ RelativePath="hello.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ </File>
+ ]]
+ end
+
+
+--
-- PCH support
--
diff --git a/tests/actions/vstudio/vc200x/test_filters.lua b/tests/actions/vstudio/vc200x/test_filters.lua
index d2bb3cd..148dcd4 100644
--- a/tests/actions/vstudio/vc200x/test_filters.lua
+++ b/tests/actions/vstudio/vc200x/test_filters.lua
@@ -40,8 +40,8 @@ local vc200x = premake.vstudio.vc200x
--
function suite.Filter_UsesVirtualForm_OnVpath()
- files { "src/hello.c" }
- vpaths { ["Source Files"] = "**.c" }
+ files { "src/hello.cpp" }
+ vpaths { ["Source Files"] = "**.cpp" }
prepare()
vc200x.Files(prj)
test.capture [[
@@ -50,7 +50,7 @@ local vc200x = premake.vstudio.vc200x
Filter=""
>
<File
- RelativePath="src\hello.c"
+ RelativePath="src\hello.cpp"
>
</File>
</Filter>
diff --git a/tests/actions/vstudio/vc2010/test_links.lua b/tests/actions/vstudio/vc2010/test_links.lua
new file mode 100644
index 0000000..de642f5
--- /dev/null
+++ b/tests/actions/vstudio/vc2010/test_links.lua
@@ -0,0 +1,87 @@
+--
+-- tests/actions/vstudio/vc2010/test_links.lua
+-- Validate linking and project references in Visual Studio 2010 C/C++ projects.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.vstudio_vs2010_links = { }
+ local suite = T.vstudio_vs2010_links
+ local vc2010 = premake.vstudio.vc2010
+
+
+--
+-- Setup
+--
+
+ local sln, prj, prj2
+
+ function suite.setup()
+ os_uuid = os.uuid
+ os.uuid = function() return "00112233-4455-6677-8888-99AABBCCDDEE" end
+
+ sln = test.createsolution()
+ test.createproject(sln)
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ prj2 = premake.solution.getproject(sln, 2)
+ sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
+ end
+
+
+--
+-- If there are no sibling projects listed in links(), then the
+-- entire project references item group should be skipped.
+--
+
+ function suite.noSectionWritten_onNoSiblingReferences()
+ prepare()
+ vc2010.projectReferences(prj2)
+ test.isemptycapture()
+ end
+
+
+--
+-- If a sibling project is listed in links(), an item group should
+-- be written with a reference to that sibling project.
+--
+
+ function suite.projectReferenceAdded_onSiblingProjectLink()
+ links { "MyProject" }
+ prepare()
+ vc2010.projectReferences(prj2)
+ test.capture [[
+ <ItemGroup>
+ <ProjectReference Include="MyProject.vcproj">
+ <Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ ]]
+ end
+
+
+--
+-- If a sibling library is listed in links(), it should NOT appear in
+-- the additional dependencies element. Visual Studio will figure that
+-- out from the project reference item group.
+--
+
+ function suite.noDependencies_onOnlySiblingProjectLinks()
+ links { "MyProject" }
+ prepare()
+ vc2010.additionalDependencies(prj2)
+ test.isemptycapture()
+ end
+
+ function suite.onlySystemDependencies_OnSiblingProjectLink()
+ links { "MyProject", "kernel32" }
+ prepare()
+ vc2010.additionalDependencies(prj2)
+ test.capture [[
+ <AdditionalDependencies>kernel32;%(AdditionalDependencies)</AdditionalDependencies>
+ ]]
+ end
+
+
diff --git a/tests/actions/xcode/test_xcode4_project.lua b/tests/actions/xcode/test_xcode4_project.lua
new file mode 100644
index 0000000..30cda28
--- /dev/null
+++ b/tests/actions/xcode/test_xcode4_project.lua
@@ -0,0 +1,59 @@
+--
+-- tests/actions/xcode/test_xcode4_project.lua
+-- Automated test suite for Xcode project generation.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.xcode4_project = { }
+
+ local suite = T.xcode4_project
+ local xcode = premake.xcode
+
+
+---------------------------------------------------------------------------
+-- Setup/Teardown
+---------------------------------------------------------------------------
+
+ local sln, tr
+ function suite.setup()
+ _ACTION = "xcode4"
+ io.eol = "\n"
+ xcode.used_ids = { } -- reset the list of generated IDs
+ sln = test.createsolution()
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ xcode.preparesolution(sln)
+ local prj = premake.solution.getproject(sln, 1)
+ tr = xcode.buildprjtree(prj)
+ end
+
+
+---------------------------------------------------------------------------
+-- XCBuildConfiguration_Project tests
+---------------------------------------------------------------------------
+
+ function suite.XCBuildConfigurationProject_OnSymbols()
+ flags { "Symbols" }
+ prepare()
+ xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
+ test.capture [[
+ [MyProject:Debug(2)] /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+ CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OBJROOT = "obj/Debug";
+ ONLY_ACTIVE_ARCH = YES;
+ };
+ name = "Debug";
+ };
+ ]]
+ end
diff --git a/tests/actions/xcode/test_xcode_dependencies.lua b/tests/actions/xcode/test_xcode_dependencies.lua
index e748b2b..ad14d5e 100644
--- a/tests/actions/xcode/test_xcode_dependencies.lua
+++ b/tests/actions/xcode/test_xcode_dependencies.lua
@@ -1,7 +1,7 @@
--
-- tests/actions/xcode/test_xcode_dependencies.lua
-- Automated test suite for Xcode project dependencies.
--- Copyright (c) 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
T.xcode3_deps = { }
@@ -249,7 +249,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "MyProject" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
mainGroup = [MyProject] /* MyProject */;
projectDirPath = "";
diff --git a/tests/actions/xcode/test_xcode_project.lua b/tests/actions/xcode/test_xcode_project.lua
index 4ab50ba..1ecde36 100644
--- a/tests/actions/xcode/test_xcode_project.lua
+++ b/tests/actions/xcode/test_xcode_project.lua
@@ -1,7 +1,7 @@
--
-- tests/actions/xcode/test_xcode_project.lua
-- Automated test suite for Xcode project generation.
--- Copyright (c) 2009-2010 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
T.xcode3_project = { }
@@ -16,7 +16,7 @@
local sln, tr
function suite.setup()
- premake.action.set("xcode3")
+ _ACTION = "xcode3"
io.eol = "\n"
xcode.used_ids = { } -- reset the list of generated IDs
sln = test.createsolution()
@@ -656,7 +656,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "MyProject" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
mainGroup = [MyProject] /* MyProject */;
projectDirPath = "";
@@ -1084,7 +1084,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1109,7 +1108,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1134,7 +1132,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1159,7 +1156,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
};
name = "Debug";
@@ -1186,7 +1182,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
SYMROOT = "bin";
};
name = "Debug";
@@ -1216,7 +1211,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1245,7 +1239,6 @@
);
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1274,7 +1267,6 @@
"build option 1",
"build option 2",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1302,7 +1294,6 @@
OTHER_LDFLAGS = (
"-lldap",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1330,7 +1321,6 @@
"link option 1",
"link option 2",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1355,7 +1345,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
WARNING_CFLAGS = "-Wall";
};
name = "Debug";
@@ -1382,7 +1371,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1410,7 +1398,6 @@
OTHER_CFLAGS = (
"-ffast-math",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1438,7 +1425,6 @@
OTHER_CFLAGS = (
"-ffloat-store",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1464,7 +1450,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1491,7 +1476,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1519,7 +1503,6 @@
OTHER_CFLAGS = (
"-fomit-frame-pointer",
);
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1545,7 +1528,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1571,7 +1553,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1598,7 +1579,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1627,7 +1607,6 @@
);
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1654,7 +1633,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1679,7 +1657,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1704,7 +1681,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal32/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1729,7 +1705,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal64/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1754,7 +1729,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1779,7 +1753,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/x32/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1804,7 +1777,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/x64/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug";
};
@@ -1828,7 +1800,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Universal32/Debug";
ONLY_ACTIVE_ARCH = NO;
- PREBINDING = NO;
};
name = "Debug 32-bit Universal";
};
diff --git a/tests/premake4.lua b/tests/premake4.lua
index e24b7eb..1154235 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -13,7 +13,7 @@
test.createsolution = function()
local sln = solution "MySolution"
configurations { "Debug", "Release" }
-
+
local prj = project "MyProject"
language "C++"
kind "ConsoleApp"
@@ -25,7 +25,7 @@
test.createproject = function(sln)
local n = #sln.projects + 1
if n == 1 then n = "" end
-
+
local prj = project ("MyProject" .. n)
language "C++"
kind "ConsoleApp"
@@ -60,14 +60,14 @@
dofile("test_project.lua")
dofile("project/test_eachfile.lua")
dofile("project/test_vpaths.lua")
-
+
-- Baking tests
dofile("base/test_baking.lua")
dofile("baking/test_merging.lua")
-
+
-- Clean tests
dofile("actions/test_clean.lua")
-
+
-- Visual Studio tests
dofile("test_vs2002_sln.lua")
dofile("test_vs2003_sln.lua")
@@ -100,30 +100,34 @@
dofile("actions/vstudio/vc200x/header.lua")
dofile("actions/vstudio/vc200x/files.lua")
dofile("actions/vstudio/vc200x/test_filters.lua")
-
+
-- Visual Studio 2010 C/C++ projects
dofile("actions/vstudio/vc2010/test_debugdir.lua")
dofile("actions/vstudio/vc2010/test_header.lua")
dofile("actions/vstudio/vc2010/test_files.lua")
dofile("actions/vstudio/vc2010/test_filters.lua")
+ dofile("actions/vstudio/vc2010/test_links.lua")
dofile("actions/vstudio/vc2010/test_pch.lua")
-- Makefile tests
dofile("actions/make/test_make_escaping.lua")
dofile("actions/make/test_make_pch.lua")
dofile("actions/make/test_make_linking.lua")
-
+ -- dofile("actions/make/test_makesettings.lua")
+ dofile("actions/make/test_wiidev.lua")
+
-- Xcode3 tests
dofile("actions/xcode/test_xcode_common.lua")
dofile("actions/xcode/test_xcode_project.lua")
dofile("actions/xcode/test_xcode_dependencies.lua")
-- Xcode4 tests
+ dofile("actions/xcode/test_xcode4_project.lua")
dofile("actions/xcode/test_xcode4_workspace.lua")
-
+
-- CodeLite tests
dofile("actions/codelite/codelite_files.lua")
-
+
-- CodeBlocks tests
dofile("actions/codeblocks/codeblocks_files.lua")
dofile("actions/codeblocks/test_filters.lua")
@@ -136,7 +140,7 @@
newaction {
trigger = "test",
description = "Run the automated test suite",
-
+
execute = function ()
passed, failed = test.runall()
msg = string.format("%d tests passed, %d failed", passed, failed)
diff --git a/tests/project/test_vpaths.lua b/tests/project/test_vpaths.lua
index 49631e2..8616907 100644
--- a/tests/project/test_vpaths.lua
+++ b/tests/project/test_vpaths.lua
@@ -124,3 +124,32 @@
prepare()
test.isequal("src/hello.c", project.getvpath(prj, "../../src/hello.c"))
end
+
+
+--
+-- Test with project locations
+--
+
+ function suite.MatchPath_OnProjectLocationSet()
+ location "build"
+ files "src/hello.h"
+ vpaths { [""] = "src" }
+ prepare()
+ test.isequal("hello.h", project.getvpath(prj, prj.files[1]))
+ end
+
+ function suite.MatchFilePattern_OnProjectLocationSet()
+ location "build"
+ files "src/hello.h"
+ vpaths { ["Headers"] = "**.h" }
+ prepare()
+ test.isequal("Headers/hello.h", project.getvpath(prj, prj.files[1]))
+ end
+
+ function suite.MatchFilePatternWithPath_OnProjectLocationSet()
+ location "build"
+ files "src/hello.h"
+ vpaths { ["Headers"] = "src/**.h" }
+ prepare()
+ test.isequal("Headers/hello.h", project.getvpath(prj, prj.files[1]))
+ end
diff --git a/tests/test_gmake_cpp.lua b/tests/test_gmake_cpp.lua
index 5730ca9..8c80411 100644
--- a/tests/test_gmake_cpp.lua
+++ b/tests/test_gmake_cpp.lua
@@ -82,8 +82,8 @@ ifeq ($(config),debug)
CFLAGS += $(CPPFLAGS) $(ARCH)
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
@@ -116,8 +116,8 @@ ifeq ($(config),debugps3)
CFLAGS += $(CPPFLAGS) $(ARCH)
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
@@ -147,8 +147,8 @@ ifeq ($(config),debug64)
CFLAGS += $(CPPFLAGS) $(ARCH) -m64
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -m64 -L/usr/lib64
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
@@ -179,8 +179,8 @@ ifeq ($(config),debuguniv32)
CFLAGS += $(CPPFLAGS) $(ARCH) -arch i386 -arch ppc
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -arch i386 -arch ppc
- LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
+ LIBS +=
LDDEPS +=
LINKCMD = libtool -o $(TARGET) $(OBJECTS)
define PREBUILDCMDS
diff --git a/tests/testfx.lua b/tests/testfx.lua
index 3c412a7..a33a391 100644
--- a/tests/testfx.lua
+++ b/tests/testfx.lua
@@ -200,6 +200,7 @@
_OS = _OS_host
premake.solution.list = { }
io.indent = nil
+ io.eol = "\n"
-- reset captured I/O values
test.value_openedfilename = nil