add grouping by link mode
This commit is contained in:
parent
82473183a5
commit
196d46a412
@ -298,6 +298,9 @@
|
|||||||
|
|
||||||
-- The "-l" flag is fine for system libraries
|
-- The "-l" flag is fine for system libraries
|
||||||
local links = config.getlinks(cfg, "system", "fullpath")
|
local links = config.getlinks(cfg, "system", "fullpath")
|
||||||
|
local static_syslibs = {"-Wl,-Bstatic"}
|
||||||
|
local shared_syslibs = {}
|
||||||
|
|
||||||
for _, link in ipairs(links) do
|
for _, link in ipairs(links) do
|
||||||
if path.isframework(link) then
|
if path.isframework(link) then
|
||||||
table.insert(result, "-framework " .. path.getbasename(link))
|
table.insert(result, "-framework " .. path.getbasename(link))
|
||||||
@ -311,16 +314,26 @@
|
|||||||
-- Check link mode preference and set flags for linker accordingly
|
-- Check link mode preference and set flags for linker accordingly
|
||||||
if endswith(name, ":static") then
|
if endswith(name, ":static") then
|
||||||
name = string.sub(name, 0, -8)
|
name = string.sub(name, 0, -8)
|
||||||
table.insert(result, "-Wl,-Bstatic -l" .. name .. " -Wl,-Bdynamic")
|
table.insert(static_syslibs, "-l" .. name)
|
||||||
elseif endswith(name, ":shared") then
|
elseif endswith(name, ":shared") then
|
||||||
name = string.sub(name, 0, -8)
|
name = string.sub(name, 0, -8)
|
||||||
table.insert(result, "-Wl,-Bdynamic -l" .. name)
|
table.insert(shared_syslibs, "-l" .. name)
|
||||||
else
|
else
|
||||||
table.insert(result, "-l" .. name)
|
table.insert(shared_syslibs, "-l" .. name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local move = function(a1, a2)
|
||||||
|
local t = #a2
|
||||||
|
for i = 1, #a1 do a2[t + i] = a1[i] end
|
||||||
|
end
|
||||||
|
if #static_syslibs > 1 then
|
||||||
|
table.insert(static_syslibs, "-Wl,-Bdynamic")
|
||||||
|
move(static_syslibs, result)
|
||||||
|
end
|
||||||
|
move(shared_syslibs, result)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -518,17 +518,17 @@
|
|||||||
function suite.linksModePreference_onAllStatic()
|
function suite.linksModePreference_onAllStatic()
|
||||||
links { "fs_stub:static", "net_stub:static" }
|
links { "fs_stub:static", "net_stub:static" }
|
||||||
prepare()
|
prepare()
|
||||||
test.contains({ "-Wl,-Bstatic -lfs_stub -Wl,-Bdynamic", "-Wl,-Bstatic -lnet_stub -Wl,-Bdynamic" }, gcc.getlinks(cfg))
|
test.contains({ "-Wl,-Bstatic", "-lfs_stub", "-Wl,-Bdynamic", "-lnet_stub"}, gcc.getlinks(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.linksModePreference_onStaticThenShared()
|
function suite.linksModePreference_onStaticAndShared()
|
||||||
links { "fs_stub:static", "net_stub" }
|
links { "fs_stub:static", "net_stub" }
|
||||||
prepare()
|
prepare()
|
||||||
test.contains({ "-Wl,-Bstatic -lfs_stub -Wl,-Bdynamic", "-lnet_stub" }, gcc.getlinks(cfg))
|
test.contains({ "-Wl,-Bstatic", "-lfs_stub", "-Wl,-Bdynamic", "-lnet_stub"}, gcc.getlinks(cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.linksModePreference_onSharedThenStatic()
|
function suite.linksModePreference_onAllShared()
|
||||||
links { "fs_stub:shared", "net_stub:static" }
|
links { "fs_stub:shared", "net_stub:shared" }
|
||||||
prepare()
|
prepare()
|
||||||
test.contains({ "-Wl,-Bdynamic -lfs_stub", "-Wl,-Bstatic -lnet_stub -Wl,-Bdynamic" }, gcc.getlinks(cfg))
|
test.excludes({ "-Wl,-Bstatic" }, gcc.getlinks(cfg))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user