summaryrefslogtreecommitdiff
path: root/xmake/core/tool/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-09-27 23:47:50 +0800
committerruki <[email protected]>2023-09-27 23:47:50 +0800
commitd53b673e631873b21b07665498a142cc31059c81 (patch)
tree34d8a2a80aa7b925888968f70747d8ac3ac87540 /xmake/core/tool/builder.lua
parent524b0a1dc0c70e924c21637edd85ae9dd4139527 (diff)
get linkgroups
Diffstat (limited to 'xmake/core/tool/builder.lua')
-rw-r--r--xmake/core/tool/builder.lua26
1 files changed, 20 insertions, 6 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 03be08c34..afee76583 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -439,13 +439,22 @@ end
-- sort links of items
function builder:_sort_links_of_items(target, items)
+ local sortlinks = false
+ local makegroups = false
local linkorders = target:get("linkorders")
if linkorders and type(linkorders) == "table" and #linkorders > 1 then
+ sortlinks = true
+ end
+ local linkgroups = target:get("linkgroups")
+ if linkgroups and type(linkgroups) == "table" and #linkgroups > 1 then
+ makegroups = true
+ end
- -- get all links
- local links = {}
- local link_mapper
- local framework_mapper
+ -- get all links
+ local links = {}
+ local link_mapper
+ local framework_mapper
+ if sortlinks or makegroups then
table.remove_if(items, function (_, item)
local name = item.name
local removed = false
@@ -463,8 +472,10 @@ function builder:_sort_links_of_items(target, items)
return removed
end)
links = table.reverse_unique(links)
+ end
- -- sort sublinks
+ -- sort sublinks
+ if sortlinks then
local linkorders_set = hashset.from(linkorders)
local sublinks = {}
for _, link in ipairs(links) do
@@ -488,7 +499,10 @@ function builder:_sort_links_of_items(target, items)
end
end
end
- -- re-generate links to items list
+ end
+
+ -- re-generate links to items list
+ if sortlinks or makegroups then
for _, link in ipairs(links) do
if link:startswith("framework::") then
link = link:sub(12)