--
-- tests/actions/vstudio/vc2010/test_link_settings.lua
-- Validate linker settings in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
T.vstudio_vs2010_link_settings = { }
local suite = T.vstudio_vs2010_link_settings
local vc2010 = premake.vstudio.vc2010
--
-- Setup
--
local sln, prj, cfg
function suite.setup()
_ACTION = "vs2010"
sln, prj = test.createsolution()
end
local function prepare(platform)
premake.bake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
cfg = premake.getconfig(prj, "Debug", platform)
vc2010.link(cfg)
end
--
-- Check the basic element structure for a console application.
--
function suite.writesCorrectSubsystem_onConsoleApp()
kind "ConsoleApp"
prepare()
test.capture [[
Consolefalse$(OutDir)MyProject.exemainCRTStartup
]]
end
--
-- Check the basic element structure for a windowed application.
--
function suite.writesCorrectSubsystem_onWindowedApp()
kind "WindowedApp"
prepare()
test.capture [[
Windowsfalse$(OutDir)MyProject.exemainCRTStartup
]]
end
--
-- Check the basic element structure for a shared library.
--
function suite.writesCorrectSubsystem_onSharedLib()
kind "SharedLib"
prepare()
test.capture [[
Windowsfalse$(OutDir)MyProject.dllMyProject.lib
]]
end
--
-- Check the basic element structure for a static library.
--
function suite.writesCorrectSubsystem_onStaticLib()
kind "StaticLib"
prepare()
test.capture [[
Windowsfalse
]]
end
--
-- Check the structure of the additional library directories element.
--
function suite.additionalLibraryDirectories()
libdirs { "include/GL", "include/lua" }
prepare()
test.capture [[
Consolefalse$(OutDir)MyProject.exeinclude\GL;include\lua;%(AdditionalLibraryDirectories)mainCRTStartup
]]
end
--
-- Enable debug information if the Symbols flag is specified.
--
function suite.generateDebugInformation_onSymbolsFlag()
flags { "Symbols" }
prepare()
test.capture [[
Consoletrue$(OutDir)MyProject.exemainCRTStartup
]]
end
--
-- Enable reference optimizing if Optimize flag is specified.
--
function suite.optimizeReferences_onOptimizeFlag()
flags { "Optimize" }
prepare()
test.capture [[
Consolefalsetruetrue$(OutDir)MyProject.exemainCRTStartup
]]
end
--
-- Skip the entry point override if the WinMain flag is specified.
--
function suite.noEntryPointElement_onWinMainFlag()
flags { "WinMain" }
prepare()
test.capture [[
Consolefalse$(OutDir)MyProject.exe
]]
end
--
-- Use the x86 target for Premake's x32 platform.
--
function suite.writesCorrectTarget_onX32Platform()
platforms "x32"
prepare("x32")
test.capture [[
Consolefalse$(OutDir)MyProject.exemainCRTStartupMachineX86
]]
end
--
-- Use the x64 target for Premake's x64 platform.
--
function suite.writesCorrectTarget_onX64Platform()
platforms { "x64" }
prepare("x64")
test.capture [[
Consolefalse$(OutDir)MyProject.exemainCRTStartupMachineX64
]]
end
--
-- Correctly handle module definition (.def) files.
--
function suite.recognizesModuleDefinitionFile()
files { "hello.cpp", "hello.def" }
prepare()
test.capture [[
Consolefalse$(OutDir)MyProject.exemainCRTStartuphello.def
]]
end