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:
-rw-r--r--CHANGES.txt1
-rw-r--r--src/actions/vstudio/vs200x_vcproj.lua2
-rw-r--r--src/actions/vstudio/vs2010_vcxproj.lua45
-rw-r--r--tests/actions/vstudio/test_vs200x_vcproj.lua21
-rw-r--r--tests/actions/vstudio/vc200x/test_mfc.lua64
-rw-r--r--tests/actions/vstudio/vc2010/test_mfc.lua60
-rw-r--r--tests/premake4.lua2
7 files changed, 157 insertions, 38 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index c975806..f54a99b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -49,6 +49,7 @@
* 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
-------
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index f90533a..2acf60b 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -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
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index 95f82bf..b805389 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -66,24 +66,34 @@
return result
end
+
+--
+-- 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(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>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, "Static", "Dynamic"))
+ end
+
+ 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)
- _p(1,'<PropertyGroup '..if_config_and_platform() ..' Label="Configuration">'
- , 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
- _p(1,'</PropertyGroup>')
+ vc2010.configurationPropertyGroup(cfg)
end
end
@@ -567,7 +577,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" />')
diff --git a/tests/actions/vstudio/test_vs200x_vcproj.lua b/tests/actions/vstudio/test_vs200x_vcproj.lua
index 1e0f1e6..5bc06af 100644
--- a/tests/actions/vstudio/test_vs200x_vcproj.lua
+++ b/tests/actions/vstudio/test_vs200x_vcproj.lua
@@ -236,27 +236,6 @@
--
--- 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
--
diff --git a/tests/actions/vstudio/vc200x/test_mfc.lua b/tests/actions/vstudio/vc200x/test_mfc.lua
new file mode 100644
index 0000000..ea0671e
--- /dev/null
+++ b/tests/actions/vstudio/vc200x/test_mfc.lua
@@ -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
diff --git a/tests/actions/vstudio/vc2010/test_mfc.lua b/tests/actions/vstudio/vc2010/test_mfc.lua
new file mode 100644
index 0000000..6a8555d
--- /dev/null
+++ b/tests/actions/vstudio/vc2010/test_mfc.lua
@@ -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
diff --git a/tests/premake4.lua b/tests/premake4.lua
index 8524d66..fa86e99 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -99,6 +99,7 @@
dofile("actions/vstudio/vc200x/header.lua")
dofile("actions/vstudio/vc200x/test_files.lua")
dofile("actions/vstudio/vc200x/test_filters.lua")
+ dofile("actions/vstudio/vc200x/test_mfc.lua")
-- Visual Studio 2010 C/C++ projects
dofile("actions/vstudio/vc2010/test_debugdir.lua")
@@ -107,6 +108,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