summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-06 23:42:54 +0800
committerruki <[email protected]>2025-08-06 23:42:54 +0800
commitbf2c52a5260bf1fe3a9333599e18c4320e352a6b (patch)
treee902139df8aef57925bd72b4a64a6a12faa803f8 /xmake
parenta1a488a62267c9318aa4258e3eeaf759b1783abd (diff)
merge linkgroups extraslinkgroups
Diffstat (limited to 'xmake')
-rw-r--r--xmake/core/project/project.lua2
-rw-r--r--xmake/core/tool/builder.lua21
2 files changed, 13 insertions, 10 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index cbcf8843d..86050ebec 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -566,8 +566,6 @@ function project._load_requires()
local info = {__requirestr = requirestr, __requireconfs = requireconfs}
instance = project_package.load_withinfo(name, info)
end
- print(instance:name())
- instance:dump()
-- add require info
requires[name] = instance
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 8336c8d71..cca77b7a9 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -580,10 +580,6 @@ function builder:_sort_links_of_items(items, opt)
linkitems = table.reverse(linkitems)
for _, item in ipairs(linkitems) do
local name = item.name
- if item.name == "linkgroups" then
- utils.dump(item)
- end
-
for _, value in ipairs(item.values) do
if name == "links" or name == "syslinks" then
if not linkgroups_set:has(value) then
@@ -601,6 +597,8 @@ function builder:_sort_links_of_items(items, opt)
if oldvalue == nil then
linkgroups_map[key] = value
else
+ -- merge linkgroups if multiple groups have same group name
+ -- @see https://github.com/xmake-io/xmake/issues/5806
local oldvalue_wrap_unlock = table.clone(oldvalue)
table.wrap_unlock(oldvalue_wrap_unlock)
local value_wrap_unlock = table.clone(value)
@@ -608,16 +606,23 @@ function builder:_sort_links_of_items(items, opt)
local newvalue = table.join(oldvalue_wrap_unlock, value_wrap_unlock)
table.wrap_lock(newvalue)
linkgroups_map[key] = newvalue
+
+ -- merge linkgroups extras
+ local extra_merged = {}
+ local group_name = extra.name
+ for k, v in pairs(extras) do
+ if v.name == group_name then
+ table.join2(extra_merged, v)
+ end
+ end
+ local newgroup_name = table.concat(newvalue, "_")
+ extras[newgroup_name] = extra_merged
end
- print(key, string.serialize(linkgroups_map[key]))
- print(key, string.serialize(extras))
end
end
end
-
links = table.reverse_unique(links)
end
- utils.dump(linkgroups_map)
-- sort sublinks
if sortlinks then