-- -- tests/actions/vstudio/vc200x/test_compiler_block.lua -- Validate generation the VCCLCompiler element in Visual Studio 200x C/C++ projects. -- Copyright (c) 2011-2013 Jason Perkins and the Premake project -- local suite = test.declare("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.pdbUsesTargetName_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 -- -- Verify the correct warnings settings are used when ExtraWarnings are enabled. -- function suite.runtimeLibraryIsDebug_onExtraWarnings() flags { "ExtraWarnings" } prepare() test.capture [[ ]] end -- -- Verify the correct warnings settings are used when FatalWarnings are enabled. -- function suite.runtimeLibraryIsDebug_onFatalWarnings() flags { "FatalWarnings" } prepare() test.capture [[ ]] end -- -- Verify the correct warnings settings are used when NoWarnings are enabled. -- function suite.runtimeLibraryIsDebug_onNoWarnings_whichDisablesAllOtherWarningsFlags() flags { "NoWarnings", "ExtraWarnings", "FatalWarnings" } prepare() test.capture [[ ]] end -- -- Verify the correct Detect64BitPortabilityProblems settings are used when _ACTION < "VS2008". -- function suite.runtimeLibraryIsDebug_onVS2005() _ACTION = "vs2005" prepare() test.capture [[ ]] end -- -- Verify the correct warnings settings are used when NoWarnings are enabled. -- function suite.runtimeLibraryIsDebug_onVS2005_NoWarnings() _ACTION = "vs2005" flags { "NoWarnings" } 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 -- -- Check handling of forced includes. -- function suite.forcedIncludeFiles() forceincludes { "stdafx.h", "include/sys.h" } prepare() test.capture [[