Merge pull request #440 from LORgames/ssurtees/vstudioLinkerCleanup
Cleaned up vstudio linker elements LGTM
This commit is contained in:
commit
745a135d5c
@ -371,11 +371,17 @@
|
||||
--
|
||||
|
||||
m.elements.linker = function(cfg, explicit)
|
||||
if cfg.kind == p.STATICLIB then
|
||||
return {
|
||||
m.link,
|
||||
m.lib,
|
||||
m.linkLibraryDependencies,
|
||||
}
|
||||
else
|
||||
return {
|
||||
m.link,
|
||||
m.linkLibraryDependencies,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function m.linker(cfg)
|
||||
@ -386,13 +392,6 @@
|
||||
|
||||
|
||||
m.elements.link = function(cfg, explicit)
|
||||
if cfg.kind == p.STATICLIB then
|
||||
return {
|
||||
m.subSystem,
|
||||
m.generateDebugInformation,
|
||||
m.optimizeReferences,
|
||||
}
|
||||
else
|
||||
return {
|
||||
m.subSystem,
|
||||
m.generateDebugInformation,
|
||||
@ -410,7 +409,6 @@
|
||||
m.additionalLinkOptions,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function m.link(cfg, explicit)
|
||||
local contents = p.capture(function ()
|
||||
@ -428,15 +426,13 @@
|
||||
|
||||
|
||||
m.elements.lib = function(cfg, explicit)
|
||||
if cfg.kind == p.STATICLIB then
|
||||
return {
|
||||
m.subSystem,
|
||||
m.optimizeReferences,
|
||||
m.treatLinkerWarningAsErrors,
|
||||
m.targetMachine,
|
||||
m.additionalLinkOptions,
|
||||
}
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function m.lib(cfg, explicit)
|
||||
|
@ -105,10 +105,9 @@
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<Lib>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
</Lib>
|
||||
]]
|
||||
end
|
||||
|
||||
@ -269,14 +268,55 @@
|
||||
libdirs { "../lib", "../lib64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<Lib>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
</Lib>
|
||||
]]
|
||||
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 [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
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 [[
|
||||
<Lib>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Lib>
|
||||
]]
|
||||
premake.vstudio.vc2010.elements.link = real_link
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of the import library settings.
|
||||
--
|
||||
@ -317,11 +357,8 @@
|
||||
linkoptions { "/kupo" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
|
||||
</Lib>
|
||||
]]
|
||||
@ -433,11 +470,8 @@
|
||||
flags { "FatalLinkWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
|
||||
</Lib>
|
||||
]]
|
||||
|
Loading…
Reference in New Issue
Block a user