Split VC 2010 link entries out for easier overriding

This commit is contained in:
Jason Perkins 2013-12-11 17:33:44 -05:00
parent c79f93665a
commit 7669651db0

View File

@ -338,41 +338,52 @@
-- Write out the linker tool block. -- Write out the linker tool block.
-- --
vc2010.elements.link = {
"subSystem",
"generateDebugInformation",
"optimizeReferences",
"linkDynamic",
}
vc2010.elements.linkDynamic = {
"additionalDependencies",
"additionalLibraryDirectories",
"importLibrary",
"entryPointSymbol",
"moduleDefinitionFile",
"additionalLinkOptions",
}
vc2010.elements.linkStatic = {
"additionalLinkOptions",
}
function vc2010.link(cfg) function vc2010.link(cfg)
local explicit = vstudio.needsExplicitLink(cfg)
_p(2,'<Link>') _p(2,'<Link>')
local explicit = vstudio.needsExplicitLink(cfg)
vc2010.subSystem(cfg) premake.callarray(vc2010, vc2010.elements.link, cfg, explicit)
vc2010.generateDebugInformation(cfg)
vc2010.optimizeReferences(cfg)
if cfg.kind ~= premake.STATICLIB then
vc2010.linkDynamic(cfg, explicit)
end
_p(2,'</Link>') _p(2,'</Link>')
if cfg.kind == premake.STATICLIB then if cfg.kind == premake.STATICLIB then
vc2010.linkStatic(cfg) vc2010.linkStatic(cfg, explicit)
end end
vc2010.linkLibraryDependencies(cfg, explicit) vc2010.linkLibraryDependencies(cfg, explicit)
end end
function vc2010.linkDynamic(cfg, explicit) function vc2010.linkDynamic(cfg, explicit)
vc2010.additionalDependencies(cfg, explicit) if cfg.kind ~= premake.STATICLIB then
vc2010.additionalLibraryDirectories(cfg) premake.callarray(vc2010, vc2010.elements.linkDynamic, cfg, explicit)
vc2010.importLibrary(cfg) end
vc2010.entryPointSymbol(cfg)
vc2010.moduleDefinitionFile(cfg)
vc2010.additionalLinkOptions(cfg)
end end
function vc2010.linkStatic(cfg) function vc2010.linkStatic(cfg, explicit)
if #cfg.linkoptions > 0 then local contents = io.capture(function ()
premake.callarray(vc2010, vc2010.elements.linkStatic, cfg, explicit)
end)
if #contents > 0 then
_p(2,'<Lib>') _p(2,'<Lib>')
vc2010.additionalLinkOptions(cfg) _p("%s", contents)
_p(2,'</Lib>') _p(2,'</Lib>')
end end
end end