summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-15 23:02:51 +0800
committerruki <[email protected]>2022-09-15 23:02:51 +0800
commit561bca38feb074c60caf7460967bf4256d486292 (patch)
treef8149b00ae30ccf161ecbf066d09310bae3c7d6e
parent223770ef1bbff5d14761f0a6425f62b50392198a (diff)
fix max depth
-rw-r--r--xmake/actions/build/kinds/object.lua13
-rw-r--r--xmake/rules/qt/moc/xmake.lua1
-rw-r--r--xmake/rules/qt/ui/xmake.lua1
3 files changed, 13 insertions, 2 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index e47fce1ac..7b77cd9b0 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -34,15 +34,19 @@ end
-- get max depth of rule
function _get_rule_max_depth(ruleinst, depth)
+ local max_depth = depth
for _, depname in ipairs(ruleinst:get("deps")) do
local dep = _get_rule(depname)
local dep_depth = depth
if ruleinst:extraconf("deps", depname, "order") then
dep_depth = dep_depth + 1
end
- return _get_rule_max_depth(dep, dep_depth)
+ local cur_depth = _get_rule_max_depth(dep, dep_depth)
+ if cur_depth > max_depth then
+ max_depth = cur_depth
+ end
end
- return depth
+ return max_depth
end
-- has scripts for the custom rule
@@ -231,6 +235,7 @@ function _build_sourcebatch_groups_for_rules(groups, target, sourcebatches)
local rulename = assert(sourcebatch.rulename, "unknown rule for sourcebatch!")
local ruleinst = _get_rule(rulename)
local depth = _get_rule_max_depth(ruleinst, 1)
+ print(rulename, depth)
local group = groups[depth]
if group == nil then
group = {}
@@ -254,6 +259,10 @@ function _build_sourcebatch_groups(target, sourcebatches)
if #groups > 0 then
groups = table.reverse(groups)
end
+ --[[
+ for idx, group in ipairs(groups) do
+ print(idx, table.keys(group))
+ end]]
return groups
end
diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua
index 2092ebe71..e4abbbb84 100644
--- a/xmake/rules/qt/moc/xmake.lua
+++ b/xmake/rules/qt/moc/xmake.lua
@@ -20,6 +20,7 @@
rule("qt.moc")
add_deps("qt.env")
+-- add_deps("qt.ui", {order = true})
set_extensions(".h", ".hpp")
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
diff --git a/xmake/rules/qt/ui/xmake.lua b/xmake/rules/qt/ui/xmake.lua
index 52e1a5228..87afdeb58 100644
--- a/xmake/rules/qt/ui/xmake.lua
+++ b/xmake/rules/qt/ui/xmake.lua
@@ -20,6 +20,7 @@
rule("qt.ui")
add_deps("qt.env")
+ add_deps("qt.moc", {order = true})
set_extensions(".ui")
on_load(function (target)