msc Fix several flags.
- Link-time optimizations now sets cl and ld flags. - Run-Time selection now adheres to `runtime` setting. - Set Subsystem for WindowedApp
This commit is contained in:
parent
f51aad1cd0
commit
0163b86628
@ -28,6 +28,15 @@
|
|||||||
-- Returns list of C compiler flags for a configuration.
|
-- Returns list of C compiler flags for a configuration.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local function getRuntimeFlag(cfg, isstatic)
|
||||||
|
local rt = cfg.runtime
|
||||||
|
local flag = iif(isstatic, "/MT", "/MD")
|
||||||
|
if (rt == "Debug") or (rt == nil and config.isDebugBuild(cfg)) then
|
||||||
|
flag = flag .. "d"
|
||||||
|
end
|
||||||
|
return flag
|
||||||
|
end
|
||||||
|
|
||||||
msc.shared = {
|
msc.shared = {
|
||||||
clr = {
|
clr = {
|
||||||
On = "/clr",
|
On = "/clr",
|
||||||
@ -37,6 +46,7 @@
|
|||||||
},
|
},
|
||||||
flags = {
|
flags = {
|
||||||
FatalCompileWarnings = "/WX",
|
FatalCompileWarnings = "/WX",
|
||||||
|
LinkTimeOptimization = "/GL",
|
||||||
MultiProcessorCompile = "/MP",
|
MultiProcessorCompile = "/MP",
|
||||||
NoMinimalRebuild = "/Gm-",
|
NoMinimalRebuild = "/Gm-",
|
||||||
OmitDefaultLibrary = "/Zl"
|
OmitDefaultLibrary = "/Zl"
|
||||||
@ -87,11 +97,11 @@
|
|||||||
},
|
},
|
||||||
staticruntime = {
|
staticruntime = {
|
||||||
-- this option must always be emit (does it??)
|
-- this option must always be emit (does it??)
|
||||||
_ = function(cfg) return iif(config.isDebugBuild(cfg), "/MDd", "/MD") end,
|
_ = function(cfg) return getRuntimeFlag(cfg, false) end,
|
||||||
-- runtime defaults to dynamic in VS
|
-- runtime defaults to dynamic in VS
|
||||||
Default = function(cfg) return iif(config.isDebugBuild(cfg), "/MDd", "/MD") end,
|
Default = function(cfg) return getRuntimeFlag(cfg, false) end,
|
||||||
On = function(cfg) return iif(config.isDebugBuild(cfg), "/MTd", "/MT") end,
|
On = function(cfg) return getRuntimeFlag(cfg, true) end,
|
||||||
Off = function(cfg) return iif(config.isDebugBuild(cfg), "/MDd", "/MD") end,
|
Off = function(cfg) return getRuntimeFlag(cfg, false) end,
|
||||||
},
|
},
|
||||||
stringpooling = {
|
stringpooling = {
|
||||||
On = "/GF",
|
On = "/GF",
|
||||||
@ -239,13 +249,14 @@
|
|||||||
msc.linkerFlags = {
|
msc.linkerFlags = {
|
||||||
flags = {
|
flags = {
|
||||||
FatalLinkWarnings = "/WX",
|
FatalLinkWarnings = "/WX",
|
||||||
LinkTimeOptimization = "/GL",
|
LinkTimeOptimization = "/LTCG",
|
||||||
NoIncrementalLink = "/INCREMENTAL:NO",
|
NoIncrementalLink = "/INCREMENTAL:NO",
|
||||||
NoManifest = "/MANIFEST:NO",
|
NoManifest = "/MANIFEST:NO",
|
||||||
OmitDefaultLibrary = "/NODEFAULTLIB",
|
OmitDefaultLibrary = "/NODEFAULTLIB",
|
||||||
},
|
},
|
||||||
kind = {
|
kind = {
|
||||||
SharedLib = "/DLL",
|
SharedLib = "/DLL",
|
||||||
|
WindowedApp = "/SUBSYSTEM:WINDOWS"
|
||||||
},
|
},
|
||||||
symbols = {
|
symbols = {
|
||||||
On = "/DEBUG"
|
On = "/DEBUG"
|
||||||
|
@ -84,10 +84,16 @@
|
|||||||
test.excludes("/Oy", msc.getcflags(cfg))
|
test.excludes("/Oy", msc.getcflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onLinkTimeOptimizations()
|
||||||
|
flags "LinkTimeOptimization"
|
||||||
|
prepare()
|
||||||
|
test.contains("/GL", msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
function suite.ldflags_onLinkTimeOptimizations()
|
function suite.ldflags_onLinkTimeOptimizations()
|
||||||
flags "LinkTimeOptimization"
|
flags "LinkTimeOptimization"
|
||||||
prepare()
|
prepare()
|
||||||
test.contains("/GL", msc.getldflags(cfg))
|
test.contains("/LTCG", msc.getldflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.cflags_onStringPoolingOn()
|
function suite.cflags_onStringPoolingOn()
|
||||||
@ -512,3 +518,56 @@
|
|||||||
prepare()
|
prepare()
|
||||||
test.isequal({ "/WX", "/MD", "/EHsc" }, msc.getcxxflags(cfg))
|
test.isequal({ "/WX", "/MD", "/EHsc" }, msc.getcxxflags(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check handling of Run-Time Library flags.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.cflags_onStaticRuntime()
|
||||||
|
staticruntime "On"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MT" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onDynamicRuntime()
|
||||||
|
staticruntime "Off"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MD" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onStaticRuntimeAndDebug()
|
||||||
|
staticruntime "On"
|
||||||
|
runtime "Debug"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MTd" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onDynamicRuntimeAndDebug()
|
||||||
|
staticruntime "Off"
|
||||||
|
runtime "Debug"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MDd" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onStaticRuntimeAndSymbols()
|
||||||
|
staticruntime "On"
|
||||||
|
symbols "On"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MTd", "/Z7" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onDynamicRuntimeAndSymbols()
|
||||||
|
staticruntime "Off"
|
||||||
|
symbols "On"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MDd", "/Z7" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.cflags_onDynamicRuntimeAndReleaseAndSymbols()
|
||||||
|
staticruntime "Off"
|
||||||
|
runtime "Release"
|
||||||
|
symbols "On"
|
||||||
|
prepare()
|
||||||
|
test.isequal({ "/MD", "/Z7" }, msc.getcflags(cfg))
|
||||||
|
end
|
||||||
|
Reference in New Issue
Block a user