From ef2f5c89450a9f7fc43bf053d611545a0ca71342 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 15 Mar 2016 14:48:33 -0400 Subject: [PATCH] Roll back PR #440; see discussion at https://github.com/premake/premake-core/pull/440 --- src/actions/vstudio/vs2010_vcxproj.lua | 72 ++++++++++++---------- tests/actions/vstudio/vc2010/test_link.lua | 56 ++++------------- 2 files changed, 49 insertions(+), 79 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index a8aa5d73..4f4e8c8f 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -371,17 +371,11 @@ -- m.elements.linker = function(cfg, explicit) - if cfg.kind == p.STATICLIB then - return { - m.lib, - m.linkLibraryDependencies, - } - else - return { - m.link, - m.linkLibraryDependencies, - } - end + return { + m.link, + m.lib, + m.linkLibraryDependencies, + } end function m.linker(cfg) @@ -392,22 +386,30 @@ m.elements.link = function(cfg, explicit) - return { - m.subSystem, - m.generateDebugInformation, - m.optimizeReferences, - m.additionalDependencies, - m.additionalLibraryDirectories, - m.importLibrary, - m.entryPointSymbol, - m.generateMapFile, - m.moduleDefinitionFile, - m.treatLinkerWarningAsErrors, - m.ignoreDefaultLibraries, - m.largeAddressAware, - m.targetMachine, - m.additionalLinkOptions, - } + if cfg.kind == p.STATICLIB then + return { + m.subSystem, + m.generateDebugInformation, + m.optimizeReferences, + } + else + return { + m.subSystem, + m.generateDebugInformation, + m.optimizeReferences, + m.additionalDependencies, + m.additionalLibraryDirectories, + m.importLibrary, + m.entryPointSymbol, + m.generateMapFile, + m.moduleDefinitionFile, + m.treatLinkerWarningAsErrors, + m.ignoreDefaultLibraries, + m.largeAddressAware, + m.targetMachine, + m.additionalLinkOptions, + } + end end function m.link(cfg, explicit) @@ -426,13 +428,15 @@ m.elements.lib = function(cfg, explicit) - return { - m.subSystem, - m.optimizeReferences, - m.treatLinkerWarningAsErrors, - m.targetMachine, - m.additionalLinkOptions, - } + if cfg.kind == p.STATICLIB then + return { + m.treatLinkerWarningAsErrors, + m.targetMachine, + m.additionalLinkOptions, + } + else + return {} + end end function m.lib(cfg, explicit) diff --git a/tests/actions/vstudio/vc2010/test_link.lua b/tests/actions/vstudio/vc2010/test_link.lua index 850eb84a..a61838c3 100644 --- a/tests/actions/vstudio/vc2010/test_link.lua +++ b/tests/actions/vstudio/vc2010/test_link.lua @@ -105,9 +105,10 @@ kind "StaticLib" prepare() test.capture [[ - + Windows - + false + ]] end @@ -268,55 +269,14 @@ libdirs { "../lib", "../lib64" } prepare() test.capture [[ - - Windows - - ]] - end - - --- --- Shared libraries do not use Lib tags in Visual Studio and --- we should not emit any options like this. --- - - function suite.sharedLibrariesLinkElement() - local real_link = premake.vstudio.vc2010.elements.lib - premake.vstudio.vc2010.elements.lib = function(cfg, explicit) - return { function(cfg) premake.vstudio.vc2010.element("Test", nil, "Testing") end } - end - prepare() - test.capture [[ Windows false - bin\Debug\MyProject.lib ]] - premake.vstudio.vc2010.elements.lib = real_link end --- --- Static libraries do not use Link tags in Visual Studio and --- we should not emit any options like this. --- - - function suite.staticLibrariesLinkElement() - kind "StaticLib" - local real_link = premake.vstudio.vc2010.elements.link - premake.vstudio.vc2010.elements.link = function(cfg, explicit) - return { function(cfg) premake.vstudio.vc2010.element("Test", nil, "Testing") end } - end - prepare() - test.capture [[ - - Windows - - ]] - premake.vstudio.vc2010.elements.link = real_link - end - -- -- Check handling of the import library settings. -- @@ -357,8 +317,11 @@ linkoptions { "/kupo" } prepare() test.capture [[ - + Windows + false + + /kupo %(AdditionalOptions) ]] @@ -470,8 +433,11 @@ flags { "FatalLinkWarnings" } prepare() test.capture [[ - + Windows + false + + true ]]