--
-- tests/actions/vstudio/vc200x/test_compiler_block.lua
-- Validate generation the VCCLCompiler element in Visual Studio 200x C/C++ projects.
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
--
T.vs200x_compiler_block = { }
local suite = T.vs200x_compiler_block
local vc200x = premake.vstudio.vc200x
--
-- Setup/teardown
--
local sln, prj, cfg
function suite.setup()
_ACTION = "vs2008"
sln, prj = test.createsolution()
end
local function prepare()
cfg = premake5.project.getconfig(prj, "Debug")
vc200x.VCCLCompilerTool_ng(cfg)
end
--
-- Verify the basic structure of the compiler block with no flags or settings.
--
function suite.looksGood_onDefaultSettings()
prepare()
test.capture [[
]]
end
--
-- If include directories are specified, the should be added.
--
function suite.additionalIncludeDirs_onIncludeDirs()
includedirs { "include/lua", "include/zlib" }
prepare()
test.capture [[
]]
end
--
-- Verify the handling of the Symbols in conjunction with the Optimize flag.
-- The release runtime library must be used.
--
function suite.looksGood_onSymbolsAndOptimizeFlags()
flags { "Symbols", "Optimize" }
prepare()
test.capture [[
]]
end
--
-- Verify the handling of the C7 debug information format.
--
function suite.looksGood_onC7DebugFormat()
flags "Symbols"
debugformat "C7"
prepare()
test.capture [[
]]
end
--
-- Verify the handling of precompiled headers.
--
function suite.compilerBlock_OnPCH()
pchheader "source/common.h"
pchsource "source/common.cpp"
prepare()
test.capture [[
]]
end
--
-- Floating point flag tests
--
function suite.compilerBlock_OnFpFast()
flags { "FloatFast" }
prepare()
test.capture [[
]]
end
function suite.compilerBlock_OnFpStrict()
flags { "FloatStrict" }
prepare()
test.capture [[
]]
end
--
-- Verify that the PDB file uses the target name if specified.
--
function suite.pdfUsesTargetName_onTargetName()
targetname "foob"
prepare()
test.capture [[
]]
end
--
-- Check that the "minimal rebuild" flag is applied correctly.
--
function suite.minimalRebuildFlagsSet_onMinimalRebuildAndSymbols()
flags { "Symbols", "NoMinimalRebuild" }
prepare()
test.capture [[
]]
end
--
-- Check that the CompileAs value is set correctly for C language projects.
--
function suite.compileAsSet_onC()
language "C"
prepare()
test.capture [[
]]
end
--
-- Verify the correct runtime library is used when symbols are enabled.
--
function suite.runtimeLibraryIsDebug_onSymbolsNoOptimize()
flags { "Symbols" }
prepare()
test.capture [[
]]
end
--
-- Xbox 360 uses the same structure, but changes the element name.
--
function suite.looksGood_onXbox360()
system "Xbox360"
prepare()
test.capture [[
]]
end