Skip to content

Commit 7105f57

Browse files
committed
Replace MFC flag with a dedicated API
1 parent 6f0cb4a commit 7105f57

File tree

5 files changed

+54
-9
lines changed

5 files changed

+54
-9
lines changed

modules/vstudio/tests/vc2010/test_config_props.lua

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
--
175175

176176
function suite.useOfMfc_onDynamicRuntime()
177-
flags "MFC"
177+
mfc "On"
178178
prepare()
179179
test.capture [[
180180
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -185,7 +185,7 @@
185185
end
186186

187187
function suite.useOfMfc_onStaticRuntime()
188-
flags { "MFC" }
188+
mfc "On"
189189
staticruntime "On"
190190
prepare()
191191
test.capture [[
@@ -196,6 +196,29 @@
196196
]]
197197
end
198198

199+
function suite.useOfMfc_forceStatic()
200+
mfc "Static"
201+
prepare()
202+
test.capture [[
203+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
204+
<ConfigurationType>Application</ConfigurationType>
205+
<UseDebugLibraries>false</UseDebugLibraries>
206+
<UseOfMfc>Static</UseOfMfc>
207+
]]
208+
end
209+
210+
function suite.useOfMfc_forceDynamic()
211+
mfc "Dynamic"
212+
staticruntime "On"
213+
prepare()
214+
test.capture [[
215+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
216+
<ConfigurationType>Application</ConfigurationType>
217+
<UseDebugLibraries>false</UseDebugLibraries>
218+
<UseOfMfc>Dynamic</UseOfMfc>
219+
]]
220+
end
221+
199222
--
200223
-- Check the support for building with ATL.
201224
--

modules/vstudio/vs200x_vcproj.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,8 +1539,12 @@
15391539

15401540

15411541
function m.useOfMFC(cfg)
1542-
if (cfg.flags.MFC) then
1542+
if (cfg.mfc == "On") then
15431543
p.w('UseOfMFC="%d"', iif(cfg.staticruntime == "On", 1, 2))
1544+
elseif (cfg.mfc == "Static") then
1545+
p.w('UseOfMFC="1"')
1546+
elseif (cfg.mfc == "Dynamic") then
1547+
p.w('UseOfMFC="2"')
15441548
end
15451549
end
15461550

modules/vstudio/vs2010_vcxproj.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3225,8 +3225,14 @@
32253225

32263226

32273227
function m.useOfMfc(cfg)
3228-
if cfg.flags.MFC then
3228+
if (cfg.mfc == "On") then
32293229
m.element("UseOfMfc", nil, iif(cfg.staticruntime == "On", "Static", "Dynamic"))
3230+
elseif (cfg.mfc == "Off") then
3231+
m.element("UseOfMfc", nil, "false")
3232+
elseif (cfg.mfc == "Static") then
3233+
m.element("UseOfMfc", nil, "Static")
3234+
elseif (cfg.mfc == "Dynamic") then
3235+
m.element("UseOfMfc", nil, "Dynamic")
32303236
end
32313237
end
32323238

src/_premake_init.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@
339339
"FatalLinkWarnings",
340340
"LinkTimeOptimization",
341341
"Maps",
342-
"MFC",
343342
"MultiProcessorCompile",
344343
"No64BitChecks",
345344
"NoCopyLocal",
@@ -1094,6 +1093,19 @@
10941093
externalincludedirs(value)
10951094
end)
10961095

1096+
api.register {
1097+
name = "mfc",
1098+
scope = "config",
1099+
kind = "string",
1100+
allowed = {
1101+
"Default",
1102+
"Off",
1103+
"On",
1104+
"Static",
1105+
"Dynamic",
1106+
}
1107+
}
1108+
10971109
-----------------------------------------------------------------------------
10981110
--
10991111
-- Field name aliases for backward compatibility

tests/base/test_configset.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@
177177
function suite.remove_onExactValueMatch()
178178
local f = field.get("flags")
179179

180-
local r, err = configset.store(cset, f, { "MFC", "MultiProcessorCompile", "NoPCH" })
180+
local r, err = configset.store(cset, f, { "WPF", "MultiProcessorCompile", "NoPCH" })
181181
test.isnil(err)
182182

183-
configset.remove(cset, f, { "MFC" })
183+
configset.remove(cset, f, { "WPF" })
184184

185185
local result = configset.fetch(cset, f)
186186
test.isequal({ "MultiProcessorCompile", "NoPCH" }, result)
@@ -190,10 +190,10 @@
190190
function suite.remove_onMultipleValues()
191191
local f = field.get("flags")
192192

193-
local r, err = configset.store(cset, f, { "Maps", "MFC", "MultiProcessorCompile", "NoPCH" })
193+
local r, err = configset.store(cset, f, { "Maps", "WPF", "MultiProcessorCompile", "NoPCH" })
194194
test.isnil(err)
195195

196-
configset.remove(cset, f, { "Maps", "MFC" })
196+
configset.remove(cset, f, { "Maps", "WPF" })
197197

198198
local result = configset.fetch(cset, f)
199199
test.isequal({ "MultiProcessorCompile", "NoPCH" }, result)

0 commit comments

Comments
 (0)