Added NoRuntimeChecks flag to disable Visual Studio default checks
This commit is contained in:
parent
43cd668b98
commit
cb2435faf6
@ -24,6 +24,8 @@
|
||||
* Visual Studio C# projects now support architectures
|
||||
* Visual Studio C# projects now support pre- and post-build commands
|
||||
* Added NoImplicitLink flag to force explicit linking from Visual Studio
|
||||
* Decoupled VS2010 smaller type checks (/RTCc) from extra warnings (/W4)
|
||||
* Added NoRuntimeChecks flag to disable Visual Studio default checks
|
||||
|
||||
|
||||
-------
|
||||
|
@ -273,9 +273,7 @@
|
||||
_p(4,'MinimalRebuild="%s"', bool(true))
|
||||
end
|
||||
|
||||
if vc200x.optimization(cfg) == 0 and not cfg.flags.Managed then
|
||||
_p(4,'BasicRuntimeChecks="3"')
|
||||
end
|
||||
vc200x.BasicRuntimeChecks(cfg)
|
||||
|
||||
if vc200x.optimization(cfg) ~= 0 then
|
||||
_p(4,'StringPooling="%s"', bool(true))
|
||||
@ -379,6 +377,16 @@
|
||||
end
|
||||
|
||||
|
||||
function vc200x.BasicRuntimeChecks(cfg)
|
||||
if not premake.config.isoptimizedbuild(cfg)
|
||||
and not cfg.flags.Managed
|
||||
and not cfg.flags.NoRuntimeChecks
|
||||
then
|
||||
_p(4,'BasicRuntimeChecks="3"')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out the VCLinkerTool element.
|
||||
--
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
for cfg in project.eachconfig(prj) do
|
||||
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
|
||||
vc2010.clCompile(cfg)
|
||||
vc2010.ClCompile(cfg)
|
||||
vc2010.resourceCompile(cfg)
|
||||
vc2010.Link(cfg)
|
||||
vc2010.buildEvents(cfg)
|
||||
@ -221,7 +221,7 @@
|
||||
-- Write the the <ClCompile> compiler settings block.
|
||||
--
|
||||
|
||||
function vc2010.clCompile(cfg)
|
||||
function vc2010.ClCompile(cfg)
|
||||
_p(2,'<ClCompile>')
|
||||
|
||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||
@ -231,7 +231,10 @@
|
||||
_p(3,'<PrecompiledHeader>NotUsing</PrecompiledHeader>')
|
||||
end
|
||||
|
||||
vc2010.warnings(cfg)
|
||||
vc2010.WarningLevel(cfg)
|
||||
vc2010.TreatWarningAsError(cfg)
|
||||
vc2010.BasicRuntimeChecks(cfg)
|
||||
|
||||
vc2010.preprocessorDefinitions(cfg.defines)
|
||||
vc2010.additionalIncludeDirectories(cfg, cfg.includedirs)
|
||||
|
||||
@ -698,24 +701,29 @@
|
||||
|
||||
|
||||
--
|
||||
-- Convert Premake warning flags to Visual Studio equivalents.
|
||||
-- Handlers for individual project elements.
|
||||
--
|
||||
|
||||
function vc2010.warnings(cfg)
|
||||
local warnLevel = 3 -- default to normal warning level if there is not any warnings flags specified
|
||||
if cfg.flags.NoWarnings then
|
||||
warnLevel = 0
|
||||
elseif cfg.flags.ExtraWarnings then
|
||||
warnLevel = 4
|
||||
end
|
||||
_p(3,'<WarningLevel>Level%d</WarningLevel>', warnLevel)
|
||||
|
||||
-- Ohter warning blocks only when NoWarnings are not specified
|
||||
if cfg.flags.NoWarnings then
|
||||
return
|
||||
end
|
||||
|
||||
if cfg.flags.FatalWarnings then
|
||||
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
function vc2010.BasicRuntimeChecks(cfg)
|
||||
if cfg.flags.NoRuntimeChecks then
|
||||
_p(3,'<BasicRuntimeChecks>Default</BasicRuntimeChecks>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.TreatWarningAsError(cfg)
|
||||
if cfg.flags.FatalWarnings and not cfg.flags.NoWarnings then
|
||||
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.WarningLevel(cfg)
|
||||
local w = 3
|
||||
if cfg.flags.NoWarnings then
|
||||
w = 0
|
||||
elseif cfg.flags.ExtraWarnings then
|
||||
w = 4
|
||||
end
|
||||
_p(3,'<WarningLevel>Level%d</WarningLevel>', w)
|
||||
end
|
||||
|
@ -569,6 +569,7 @@
|
||||
"NoMinimalRebuild",
|
||||
"NoNativeWChar",
|
||||
"NoPCH",
|
||||
"NoRuntimeChecks",
|
||||
"NoRTTI",
|
||||
"NoWarnings",
|
||||
"Optimize",
|
||||
|
@ -462,3 +462,20 @@
|
||||
ForcedIncludeFiles="stdafx.h;include/sys.h"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify handling of the NoRuntimeChecks flag.
|
||||
--
|
||||
|
||||
function suite.onNoRuntimeChecks()
|
||||
flags { "NoRuntimeChecks" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
RuntimeLibrary="2"
|
||||
]]
|
||||
end
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
local function prepare(platform)
|
||||
cfg = project.getconfig(prj, "Debug", platform)
|
||||
vc2010.clCompile(cfg)
|
||||
vc2010.ClCompile(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
--
|
||||
-- Check the basic element structure with default settings.
|
||||
--
|
||||
|
||||
@ -555,3 +555,19 @@
|
||||
<ForcedIncludeFiles>stdafx.h;include/sys.h</ForcedIncludeFiles>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the NoRuntimeChecks flag.
|
||||
--
|
||||
|
||||
function suite.onNoRuntimeChecks()
|
||||
flags { "NoRuntimeChecks" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user