Merge with premake-dev

This commit is contained in:
Jason Perkins 2011-12-13 16:14:14 -05:00
commit 94e29b7cf3
12 changed files with 276 additions and 115 deletions

34
.gitignore vendored Normal file
View File

@ -0,0 +1,34 @@
syntax: glob
.DS_Store
*.orig
*~
build
bin
obj
release
ipch
src/host/scripts.c
Makefile
*.make
*.xcodeproj
*.swp
*.sdf
*.sln
*.suo
*.ncb
*.vcproj*
*.vcxproj*
*.opensdf
*.workspace
*.project
*.tags
*.bbprojectsettings
Scratchpad.txt
Unix Worksheet.worksheet
project.bbprojectdata
Premake4.tmproj

View File

@ -57,6 +57,9 @@ Sony NGP (in progress)
* Patch 3429777: Support for DragonFly BSD (Joachim de Groot)
* Patch 3445049: Build fix for FreeBSD (Konstantin Tokarev)
* Bug 3121217: Test suite fails on Linux x86_64: os.findlib broken
* Patch 3428348: Add .gitignore file (Konstantin Tokarev)
* Patch 3430158: Reorder LINKCMD for Gmake (rjmyst3)
* Patch 3451212: Fix Visual Studio MFC with StaticRuntime
-------

View File

@ -197,9 +197,11 @@
_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')
end
else
-- this was $(TARGET) $(LDFLAGS) $(OBJECTS) ... but was having trouble linking to certain
-- static libraries so $(OBJECTS) was moved up
_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == "C", "CC", "CXX"))
-- this was $(TARGET) $(LDFLAGS) $(OBJECTS)
-- but had trouble linking to certain static libs so $(OBJECTS) moved up
-- then $(LDFLAGS) moved to end
-- https://sourceforge.net/tracker/?func=detail&aid=3430158&group_id=71616&atid=531880
_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)', iif(cfg.language == "C", "CC", "CXX"))
end
_p(' define PREBUILDCMDS')

View File

@ -90,7 +90,7 @@
_p(3,'ConfigurationType="%s"', cfgtype)
if (cfg.flags.MFC) then
_p(3, 'UseOfMFC="2"')
_p(3, 'UseOfMFC="%d"', iif(cfg.flags.StaticRuntime, 1, 2))
end
_p(3,'CharacterSet="%s"', iif(cfg.flags.Unicode, 1, 2))
if cfg.flags.Managed then

View File

@ -66,25 +66,35 @@
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)
--
-- This property group describes a particular configuration: what
-- kind of binary it produces, and some global settings.
--
function vc2010.configurationPropertyGroup(cfg)
_p(1,'<PropertyGroup '..if_config_and_platform() ..' Label="Configuration">'
, premake.esc(cfginfo.name))
, premake.esc(cfg.name))
_p(2,'<ConfigurationType>%s</ConfigurationType>',vc2010.config_type(cfg))
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', iif(optimisation(cfg) == "Disabled","true","false"))
_p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,"Unicode","MultiByte"))
if cfg.flags.MFC then
_p(2,'<UseOfMfc>Dynamic</UseOfMfc>')
_p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, "Static", "Dynamic"))
end
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>'
,iif(optimisation(cfg) == "Disabled","true","false"))
if cfg.flags.Managed then
_p(2,'<CLRSupport>true</CLRSupport>')
end
_p(1,'</PropertyGroup>')
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)
vc2010.configurationPropertyGroup(cfg)
end
end
@ -561,7 +571,10 @@
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />')
config_type_block(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
vc2010.configurationPropertyGroup(cfg)
end
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />')

View File

@ -51,7 +51,7 @@
if os.is64bit() then
path = path .. ":/lib64:/usr/lib64/:usr/local/lib64"
end
path = ":/lib:/usr/lib:/usr/local/lib"
path = path .. ":/lib:/usr/lib:/usr/local/lib"
end
for _, fmt in ipairs(formats) do

View File

@ -142,9 +142,14 @@ void getversion(struct OsVersionInfo* info)
void getversion(struct OsVersionInfo* info)
{
Gestalt(gestaltSystemVersionMajor, &info->majorversion);
Gestalt(gestaltSystemVersionMinor, &info->minorversion);
Gestalt(gestaltSystemVersionBugFix, &info->revision);
SInt32 majorversion, minorversion, bugfix;
Gestalt(gestaltSystemVersionMajor, &majorversion);
Gestalt(gestaltSystemVersionMinor, &minorversion);
Gestalt(gestaltSystemVersionBugFix, &bugfix);
info->majorversion = majorversion;
info->minorversion = minorversion;
info->revision = bugfix;
info->description = "Mac OS X";
if (info->majorversion == 10)

View File

@ -235,27 +235,6 @@
end
--
-- Test the <Configuration> element
--
function suite.Configuration_OnMFCFlag()
flags { "MFC" }
prepare()
vc200x.Configuration("Debug|Win32", premake.getconfig(prj, "Debug"))
test.capture [[
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory="obj\Debug\MyProject"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2"
>
]]
end
--
-- Test multiple platforms
--

View File

@ -0,0 +1,64 @@
--
-- tests/actions/vstudio/vc200x/test_mfc.lua
-- Validate MFC support in Visual Studio 200x C/C++ projects.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
T.vstudio_vs200x_mfc = { }
local suite = T.vstudio_vs200x_mfc
local vc200x = premake.vstudio.vc200x
--
-- Setup
--
local sln, prj, cfg
function suite.setup()
_ACTION = "vs2008"
sln, prj = test.createsolution()
end
local function prepare(platform)
premake.bake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
cfg = premake.getconfig(prj, "Debug", platform)
vc200x.Configuration("Debug|Win32", cfg)
end
--
-- When MFC is enabled, it should match the runtime library linking
-- method (static or dynamic).
--
function suite.useOfMfc_isDynamic_onSharedRuntime()
flags { "MFC" }
prepare()
test.capture [[
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory="obj\Debug"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2"
>
]]
end
function suite.useOfMfc_isStatic_onStaticRuntime()
flags { "MFC", "StaticRuntime" }
prepare()
test.capture [[
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory="obj\Debug"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2"
>
]]
end

View File

@ -0,0 +1,60 @@
--
-- tests/actions/vstudio/vc2010/test_mfc.lua
-- Validate MFC support in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
T.vstudio_vs2010_mfc = { }
local suite = T.vstudio_vs2010_mfc
local vc2010 = premake.vstudio.vc2010
--
-- Setup
--
local sln, prj, cfg
function suite.setup()
_ACTION = "vs2010"
sln, prj = test.createsolution()
end
local function prepare(platform)
premake.bake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
cfg = premake.getconfig(prj, "Debug", platform)
vc2010.configurationPropertyGroup(cfg)
end
--
-- When MFC is enabled, it should match the runtime library linking
-- method (static or dynamic).
--
function suite.useOfMfc_isDynamic_onSharedRuntime()
flags { "MFC" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
]]
end
function suite.useOfMfc_isStatic_onStaticRuntime()
flags { "MFC", "StaticRuntime" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
]]
end

View File

@ -102,8 +102,8 @@
dofile("actions/vstudio/vc200x/header.lua")
dofile("actions/vstudio/vc200x/test_files.lua")
dofile("actions/vstudio/vc200x/test_filters.lua")
dofile("actions/vstudio/vc200x/header.lua")
dofile("actions/vstudio/vc200x/test_linker_block.lua")
dofile("actions/vstudio/vc200x/test_mfc.lua")
-- Visual Studio 2010 C/C++ projects
dofile("actions/vstudio/vc2010/test_compile_settings.lua")
@ -113,6 +113,7 @@
dofile("actions/vstudio/vc2010/test_filters.lua")
dofile("actions/vstudio/vc2010/test_link_settings.lua")
dofile("actions/vstudio/vc2010/test_links.lua")
dofile("actions/vstudio/vc2010/test_mfc.lua")
dofile("actions/vstudio/vc2010/test_pch.lua")
-- Makefile tests

View File

@ -85,7 +85,7 @@ ifeq ($(config),debug)
RESFLAGS += $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)
define PREBUILDCMDS
endef
define PRELINKCMDS
@ -119,7 +119,7 @@ ifeq ($(config),debugps3)
RESFLAGS += $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)
define PREBUILDCMDS
endef
define PRELINKCMDS
@ -150,7 +150,7 @@ ifeq ($(config),debug64)
RESFLAGS += $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)
define PREBUILDCMDS
endef
define PRELINKCMDS