summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-03 00:47:55 +0800
committerruki <[email protected]>2025-04-08 15:31:57 +0800
commit38695f0bf5875dc5db9ccaa8c9ddbf8ef46d4f5e (patch)
tree442f2c3d0b92ecb1fbfd900725144715d624b21d
parentf2100441c10d29f9932e379077b2b56a29f46389 (diff)
add target deps orders
-rw-r--r--xmake/actions/build/target_utils.lua7
-rw-r--r--xmake/modules/async/jobgraph.lua5
2 files changed, 12 insertions, 0 deletions
diff --git a/xmake/actions/build/target_utils.lua b/xmake/actions/build/target_utils.lua
index 3edf9f42b..9529fd490 100644
--- a/xmake/actions/build/target_utils.lua
+++ b/xmake/actions/build/target_utils.lua
@@ -287,9 +287,16 @@ function add_targetjobs_and_deps(jobgraph, target, targetrefs, opt)
if not targetrefs[targetname] then
targetrefs[targetname] = target
add_targetjobs(jobgraph, target, opt)
+
+ local linkjob = target:fullname() .. "/link_objects"
for _, depname in ipairs(target:get("deps")) do
local dep = project.target(depname, {namespace = target:namespace()})
add_targetjobs_and_deps(jobgraph, dep, targetrefs, opt)
+
+ local linkjob_dep = dep:fullname() .. "/link_objects"
+ if jobgraph:has(linkjob) and jobgraph:has(linkjob_dep) then
+ jobgraph:add_orders(linkjob_dep, linkjob)
+ end
end
end
end
diff --git a/xmake/modules/async/jobgraph.lua b/xmake/modules/async/jobgraph.lua
index 28126757f..612ff4882 100644
--- a/xmake/modules/async/jobgraph.lua
+++ b/xmake/modules/async/jobgraph.lua
@@ -107,6 +107,11 @@ function jobgraph:remove(name)
end
end
+-- has the given job or group?
+function jobgraph:has(name)
+ return self._jobs[name] or self._groups[name]
+end
+
-- enter group to add jobs
--
-- e.g.