Merge pull request #220 from LORgames/ssurtees/linksAlternateExtensions

The links API, for visual studio, no longer appends .lib if an extension already exists.
This commit is contained in:
Manu Evans 2015-08-25 00:05:01 +10:00
commit 1de083849a
3 changed files with 56 additions and 2 deletions

View File

@ -340,7 +340,13 @@
-- Then the system libraries, which come undecorated -- Then the system libraries, which come undecorated
local system = config.getlinks(cfg, "system", "fullpath") local system = config.getlinks(cfg, "system", "fullpath")
for i = 1, #system do for i = 1, #system do
table.insert(links, path.appendextension(system[i], ".lib")) -- Add extension if required
local link = system[i]
if not p.tools.msc.getLibraryExtensions()[link:match("[^.]+$")] then
link = path.appendextension(link, ".lib")
end
table.insert(links, link)
end end
return links return links

View File

@ -236,6 +236,17 @@
end end
--
-- Return a list of valid library extensions
--
function msc.getLibraryExtensions()
return {
["lib"] = true,
["obj"] = true,
}
end
-- --
-- Return the list of libraries to link, decorated with flags as needed. -- Return the list of libraries to link, decorated with flags as needed.
-- --
@ -243,7 +254,10 @@
function msc.getlinks(cfg) function msc.getlinks(cfg)
local links = config.getlinks(cfg, "system", "fullpath") local links = config.getlinks(cfg, "system", "fullpath")
for i = 1, #links do for i = 1, #links do
links[i] = path.appendextension(links[i], ".lib") -- Add extension if required
if not msc.getLibraryExtensions()[links[i]:match("[^.]+$")] then
links[i] = path.appendextension(links[i], ".lib")
end
end end
return links return links
end end

View File

@ -164,6 +164,40 @@
end end
--
-- Any system libraries specified in links() with valid extensions should
-- be listed with those extensions.
--
function suite.additionalDependencies_onSystemLinksExtensions()
links { "lua.obj", "zlib.lib" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>lua.obj;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
]]
end
--
-- Any system libraries specified in links() with multiple dots should
-- only have .lib appended to the end when no valid extension is found
--
function suite.additionalDependencies_onSystemLinksExtensionsMultipleDots()
links { "lua.5.3.lib", "lua.5.4" }
prepare()
test.capture [[
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>lua.5.3.lib;lua.5.4.lib;%(AdditionalDependencies)</AdditionalDependencies>
]]
end
-- --
-- Additional library directories should be specified, relative to the project. -- Additional library directories should be specified, relative to the project.
-- --