diff options
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | src/actions/vstudio/vs200x_vcproj.lua | 4 | ||||
-rwxr-xr-x | tests/actions/vstudio/test_vs200x_vcproj_linker.lua | 117 | ||||
-rw-r--r-- | tests/premake4.lua | 1 |
4 files changed, 123 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 94b7080..9c11098 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -22,6 +22,7 @@ * Implemented StaticRuntime flag for Xcode (William Burnson) * Improved portability of Mac OS X binaries (William Burnson) * Bug 3035545: The pattern { "./folder/*.c" } matches no files +* Bug 3034222: StaticLib projects ignore linkoptions ------- diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index ab24f13..06dba6d 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -260,6 +260,10 @@ local vcproj = premake.vstudio.vcproj if #cfg.libdirs > 0 then _p(4,'AdditionalLibraryDirectories="%s"', premake.esc(path.translate(table.concat(cfg.libdirs , ";")))) end + + if #cfg.linkoptions > 0 then + _p(4,'AdditionalOptions="%s"', table.concat(premake.esc(cfg.linkoptions), " ")) + end end _p(3,'/>') diff --git a/tests/actions/vstudio/test_vs200x_vcproj_linker.lua b/tests/actions/vstudio/test_vs200x_vcproj_linker.lua new file mode 100755 index 0000000..1ff5836 --- /dev/null +++ b/tests/actions/vstudio/test_vs200x_vcproj_linker.lua @@ -0,0 +1,117 @@ +-- +-- tests/actions/vstudio/test_vs200x_vcproj_linker.lua +-- Automated tests for Visual Studio 2002-2008 C/C++ linker block. +-- Copyright (c) 2009, 2010 Jason Perkins and the Premake project +-- + + T.vs200x_vcproj_linker = { } + local suite = T.vs200x_vcproj_linker + local vcproj = premake.vstudio.vcproj + + +-- +-- Setup/Teardown +-- + + local sln, prj + function suite.setup() + _ACTION = "vs2005" + sln, prj = test.createsolution() + end + + local function prepare() + io.capture() + premake.buildconfigs() + end + + +-- +-- Test default linker blocks for each target kind +-- (ConsoleApp, StaticLib, etc.) +-- + + function suite.DefaultLinkerBlock_OnConsoleApp() + kind "ConsoleApp" + prepare() + premake.vs200x_vcproj_VCLinkerTool(premake.getconfig(prj, "Debug")) + 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() + premake.vs200x_vcproj_VCLinkerTool(premake.getconfig(prj, "Debug")) + 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() + premake.vs200x_vcproj_VCLinkerTool(premake.getconfig(prj, "Debug")) + 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() + premake.vs200x_vcproj_VCLinkerTool(premake.getconfig(prj, "Debug")) + test.capture [[ + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\MyProject.lib" + /> + ]] + end + + +-- +-- linkoptions tests +-- + + function suite.AdditionalOptions_OnStaticLib() + kind "StaticLib" + linkoptions { "/ltcg", "/lZ" } + prepare() + premake.vs200x_vcproj_VCLinkerTool(premake.getconfig(prj, "Debug")) + test.capture [[ + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\MyProject.lib" + AdditionalOptions="/ltcg /lZ" + /> + ]] + end + diff --git a/tests/premake4.lua b/tests/premake4.lua index 237f9ea..9a91cd7 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -67,6 +67,7 @@ dofile("test_vs2010_sln.lua") dofile("actions/vstudio/test_vs2005_csproj.lua") dofile("actions/vstudio/test_vs200x_vcproj.lua") + dofile("actions/vstudio/test_vs200x_vcproj_linker.lua") dofile("actions/vstudio/test_vs2010_vcxproj.lua") dofile("actions/vstudio/test_vs2010_flags.lua") dofile("actions/vstudio/test_vs2010_links.lua") |