A bit of consistency cleanup on the prior pull request

This commit is contained in:
Jason Perkins 2012-04-16 18:24:35 -04:00
parent 1e29737cd7
commit 2cbab56592
3 changed files with 57 additions and 45 deletions

View File

@ -14,6 +14,7 @@
* The include() function will now include each file only once
* The include() function can now include specific files
* path.translate() now defaults to Windows-style backslashes
* Added NoWarnings flag for Visual Studio (xpol)
-------

View File

@ -179,24 +179,6 @@
end
local function warningsblocks(cfg)
-- if NoWarnings flags specified just disable warnings, and return.
if cfg.flags.NoWarnings then
_p(4,'WarningLevel="0"')
return
end
-- else setup all warning blocks as needed.
_p(4,'WarningLevel="%d"', iif(cfg.flags.ExtraWarnings, 4, 3))
if cfg.flags.FatalWarnings then
_p(4,'WarnAsError="%s"', bool(true))
end
if _ACTION < "vs2008" and not cfg.flags.Managed then
_p(4,'Detect64BitPortabilityProblems="%s"', bool(not cfg.flags.No64BitChecks))
end
end
--
-- Write out the VCCLCompilerTool element.
--
@ -304,7 +286,7 @@
_p(4,'UsePrecompiledHeader="%s"', iif(_ACTION > "vs2003" or cfg.flags.NoPCH, 0, 2))
end
warningsblocks(cfg)
vc200x.warnings(cfg)
_x(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', config.gettargetinfo(cfg).basename)
@ -957,6 +939,31 @@
end
--
-- Convert Premake warning flags to Visual Studio equivalents.
--
function vc200x.warnings(cfg)
-- if NoWarnings flags specified just disable warnings, and return.
if cfg.flags.NoWarnings then
_p(4,'WarningLevel="0"')
return
end
-- else setup all warning blocks as needed.
_p(4,'WarningLevel="%d"', iif(cfg.flags.ExtraWarnings, 4, 3))
if cfg.flags.FatalWarnings then
_p(4,'WarnAsError="%s"', bool(true))
end
if _ACTION < "vs2008" and not cfg.flags.Managed then
_p(4,'Detect64BitPortabilityProblems="%s"', bool(not cfg.flags.No64BitChecks))
end
end
-----------------------------------------------------------------------------
-- Everything below this point is a candidate for deprecation
@ -1212,7 +1219,7 @@
_p(4,'UsePrecompiledHeader="%s"', iif(_ACTION > "vs2003" or cfg.flags.NoPCH, 0, 2))
end
warningsblocks(cfg)
vc200x.warnings(cfg)
_p(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', path.getbasename(cfg.buildtarget.name))
_p(4,'DebugInformationFormat="%s"', vc200x.symbols(cfg))

View File

@ -188,29 +188,6 @@
end
function vc2010.warningBlocks(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 premake.config.isdebugbuild(cfg) and cfg.flags.ExtraWarnings then
_p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')
end
if cfg.flags.FatalWarnings then
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
end
end
--
-- Write the the <ClCompile> compiler settings block.
--
@ -225,7 +202,7 @@
_p(3,'<PrecompiledHeader>NotUsing</PrecompiledHeader>')
end
vc2010.warningBlocks(cfg)
vc2010.warnings(cfg)
vc2010.preprocessorDefinitions(cfg.defines)
vc2010.additionalIncludeDirectories(cfg, cfg.includedirs)
vc2010.debuginfo(cfg)
@ -664,6 +641,33 @@
end
--
-- Convert Premake warning flags to Visual Studio equivalents.
--
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 premake.config.isdebugbuild(cfg) and cfg.flags.ExtraWarnings then
_p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')
end
if cfg.flags.FatalWarnings then
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
end
end
-----------------------------------------------------------------------------
-- Everything below this point is a candidate for deprecation
@ -932,7 +936,7 @@
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
precompiled_header(cfg)
vc2010.warningBlocks(cfg)
vc2010.warnings(cfg)
exceptions(cfg)
rtti(cfg)
wchar_t_buildin(cfg)