2010-10-13 14:20:26 +00:00
|
|
|
--
|
|
|
|
-- tests/actions/vstudio/test_vs200x_vcproj_linker.lua
|
|
|
|
-- Automated tests for Visual Studio 2002-2008 C/C++ linker block.
|
2011-02-02 18:27:52 +00:00
|
|
|
-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
|
2010-10-13 14:20:26 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
T.vs200x_vcproj_linker = { }
|
|
|
|
local suite = T.vs200x_vcproj_linker
|
2011-02-02 18:27:52 +00:00
|
|
|
local vc200x = premake.vstudio.vc200x
|
2010-10-13 14:20:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup/Teardown
|
|
|
|
--
|
|
|
|
|
|
|
|
local sln, prj
|
|
|
|
function suite.setup()
|
|
|
|
_ACTION = "vs2005"
|
|
|
|
sln, prj = test.createsolution()
|
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare()
|
2011-05-18 21:32:04 +00:00
|
|
|
premake.bake.buildconfigs()
|
2010-10-13 14:20:26 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test default linker blocks for each target kind
|
|
|
|
-- (ConsoleApp, StaticLib, etc.)
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.DefaultLinkerBlock_OnConsoleApp()
|
|
|
|
kind "ConsoleApp"
|
|
|
|
prepare()
|
2011-02-02 18:27:52 +00:00
|
|
|
vc200x.VCLinkerTool(premake.getconfig(prj, "Debug"))
|
2010-10-13 14:20:26 +00:00
|
|
|
test.capture [[
|
|
|
|
<Tool
|
|
|
|
Name="VCLinkerTool"
|
|
|
|
OutputFile="$(OutDir)\MyProject.exe"
|
|
|
|
LinkIncremental="2"
|
|
|
|
AdditionalLibraryDirectories=""
|
|
|
|
GenerateDebugInformation="false"
|
|
|
|
SubSystem="1"
|
|
|
|
EntryPointSymbol="mainCRTStartup"
|
|
|
|
TargetMachine="1"
|
|
|
|
/>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.DefaultLinkerBlock_OnWindowedApp()
|
|
|
|
kind "WindowedApp"
|
|
|
|
prepare()
|
2011-02-02 18:27:52 +00:00
|
|
|
vc200x.VCLinkerTool(premake.getconfig(prj, "Debug"))
|
2010-10-13 14:20:26 +00:00
|
|
|
test.capture [[
|
|
|
|
<Tool
|
|
|
|
Name="VCLinkerTool"
|
|
|
|
OutputFile="$(OutDir)\MyProject.exe"
|
|
|
|
LinkIncremental="2"
|
|
|
|
AdditionalLibraryDirectories=""
|
|
|
|
GenerateDebugInformation="false"
|
|
|
|
SubSystem="2"
|
|
|
|
EntryPointSymbol="mainCRTStartup"
|
|
|
|
TargetMachine="1"
|
|
|
|
/>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.DefaultLinkerBlock_OnSharedLib()
|
|
|
|
kind "SharedLib"
|
|
|
|
prepare()
|
2011-02-02 18:27:52 +00:00
|
|
|
vc200x.VCLinkerTool(premake.getconfig(prj, "Debug"))
|
2010-10-13 14:20:26 +00:00
|
|
|
test.capture [[
|
|
|
|
<Tool
|
|
|
|
Name="VCLinkerTool"
|
|
|
|
OutputFile="$(OutDir)\MyProject.dll"
|
|
|
|
LinkIncremental="2"
|
|
|
|
AdditionalLibraryDirectories=""
|
|
|
|
GenerateDebugInformation="false"
|
|
|
|
SubSystem="2"
|
|
|
|
ImportLibrary="MyProject.lib"
|
|
|
|
TargetMachine="1"
|
|
|
|
/>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.DefaultLinkerBlock_OnStaticLib()
|
|
|
|
kind "StaticLib"
|
|
|
|
prepare()
|
2011-02-02 18:27:52 +00:00
|
|
|
vc200x.VCLinkerTool(premake.getconfig(prj, "Debug"))
|
2010-10-13 14:20:26 +00:00
|
|
|
test.capture [[
|
|
|
|
<Tool
|
|
|
|
Name="VCLibrarianTool"
|
|
|
|
OutputFile="$(OutDir)\MyProject.lib"
|
|
|
|
/>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- linkoptions tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.AdditionalOptions_OnStaticLib()
|
|
|
|
kind "StaticLib"
|
|
|
|
linkoptions { "/ltcg", "/lZ" }
|
|
|
|
prepare()
|
2011-02-02 18:27:52 +00:00
|
|
|
vc200x.VCLinkerTool(premake.getconfig(prj, "Debug"))
|
2010-10-13 14:20:26 +00:00
|
|
|
test.capture [[
|
|
|
|
<Tool
|
|
|
|
Name="VCLibrarianTool"
|
|
|
|
OutputFile="$(OutDir)\MyProject.lib"
|
|
|
|
AdditionalOptions="/ltcg /lZ"
|
|
|
|
/>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|