This commit is contained in:
Jason Perkins 2016-03-15 14:48:33 -04:00
parent c7bae391c7
commit ef2f5c8945
2 changed files with 49 additions and 79 deletions

View File

@ -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)

View File

@ -105,9 +105,10 @@
kind "StaticLib"
prepare()
test.capture [[
<Lib>
<Link>
<SubSystem>Windows</SubSystem>
</Lib>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
]]
end
@ -268,55 +269,14 @@
libdirs { "../lib", "../lib64" }
prepare()
test.capture [[
<Lib>
<SubSystem>Windows</SubSystem>
</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.
--
@ -357,8 +317,11 @@
linkoptions { "/kupo" }
prepare()
test.capture [[
<Lib>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
</Lib>
]]
@ -470,8 +433,11 @@
flags { "FatalLinkWarnings" }
prepare()
test.capture [[
<Lib>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
<Lib>
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
</Lib>
]]