summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Rendina <[email protected]>2025-04-16 11:54:52 +0200
committerChristian Rendina <[email protected]>2025-04-16 11:54:52 +0200
commit42371b9d4d7b3c397e620bfa29041614a8416041 (patch)
tree4b1bc87b99d5112667f72874485dc1aa887e76b2
parentc3d9be25a570d950f996ac347b55f3adf23d1fc9 (diff)
Use jobgraph rather than batchcmd
-rw-r--r--xmake/rules/platform/windows/idl/idl.lua80
-rw-r--r--xmake/rules/platform/windows/idl/xmake.lua7
2 files changed, 47 insertions, 40 deletions
diff --git a/xmake/rules/platform/windows/idl/idl.lua b/xmake/rules/platform/windows/idl/idl.lua
index f44611424..c6f65fc82 100644
--- a/xmake/rules/platform/windows/idl/idl.lua
+++ b/xmake/rules/platform/windows/idl/idl.lua
@@ -119,11 +119,19 @@ function configure(target)
end
end
+function gen_idl(target, jobgraph, sourcebatch, opt)
+ for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
+ local midljob = target:fullname() .. "/midl/generate/" .. sourcefile
+ jobgraph:add(midljob, function (index, total, opt)
+ generate_single(target, sourcefile, opt)
+ end)
+ end
+end
+
function build_idlfiles(target, jobgraph, sourcebatch, opt)
- local mysources = {}
local autogendir = path.join(target:autogendir(), "platform/windows/idl")
- local addsrc = function (sourcename, suffix)
+ local addsrc = function (sourcename, suffix, mysources)
local fullfile = path.join(autogendir, sourcename .. suffix)
if os.exists(fullfile) then
table.insert(mysources, fullfile)
@@ -131,43 +139,41 @@ function build_idlfiles(target, jobgraph, sourcebatch, opt)
end
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- local fileconfig = target:fileconfig(sourcefile)
- local enable_proxy = true
- if fileconfig then
- if fileconfig.proxy ~= nil then
- enable_proxy = fileconfig.proxy
+ local ccjob = target:fullname() .. "/midl/compile/" .. sourcefile
+ jobgraph:add(ccjob, function (index, total, opt)
+ local fileconfig = target:fileconfig(sourcefile)
+ local enable_proxy = true
+ if fileconfig then
+ if fileconfig.proxy ~= nil then
+ enable_proxy = fileconfig.proxy
+ end
end
- end
-
- generate_single(target, sourcefile, opt)
-
- local name = path.basename(sourcefile)
+ local name = path.basename(sourcefile)
+ local mysources = {}
- -- we don't have a way to detect which midl files are generated
-
- addsrc(name, "_i.c")
-
- if enable_proxy then
- addsrc(name, "_p.c")
- end
-
- addsrc(name, "_c.c")
- addsrc(name, "_s.c")
- end
+ -- we don't have a way to detect which midl files are generated
+ addsrc(name, "_i.c", mysources)
+ if enable_proxy then
+ addsrc(name, "_p.c", mysources)
+ end
+ addsrc(name, "_c.c", mysources)
+ addsrc(name, "_s.c", mysources)
- local batchcxx = {
- rulename = "c.build",
- sourcekind = "cc",
- sourcefiles = mysources,
- objectfiles = {},
- dependfiles = {}
- }
- for _, sourcefile in ipairs(batchcxx.sourcefiles) do
- local objfile = target:objectfile(sourcefile)
- local depfile = target:objectfile(objfile)
- table.insert(target:objectfiles(), objfile)
- table.insert(batchcxx.objectfiles, objfile)
- table.insert(batchcxx.dependfiles, depfile)
+ local batchcxx = {
+ rulename = "c.build",
+ sourcekind = "cc",
+ sourcefiles = mysources,
+ objectfiles = {},
+ dependfiles = {}
+ }
+ for _, sourcefile in ipairs(batchcxx.sourcefiles) do
+ local objfile = target:objectfile(sourcefile)
+ local depfile = target:objectfile(objfile)
+ table.insert(target:objectfiles(), objfile)
+ table.insert(batchcxx.objectfiles, objfile)
+ table.insert(batchcxx.dependfiles, depfile)
+ end
+ build_objectfiles(target, jobgraph, batchcxx, opt)
+ end)
end
- build_objectfiles(target, jobgraph, batchcxx, opt)
end
diff --git a/xmake/rules/platform/windows/idl/xmake.lua b/xmake/rules/platform/windows/idl/xmake.lua
index cd138eadc..f7a47b230 100644
--- a/xmake/rules/platform/windows/idl/xmake.lua
+++ b/xmake/rules/platform/windows/idl/xmake.lua
@@ -20,11 +20,12 @@
-- add *.idl for rc file
rule("platform.windows.idl")
set_extensions(".idl")
-
on_config("windows", "mingw", function (target)
import("idl").configure(target)
end)
-
+ before_build_files(function (target, jobgraph, sourcebatch, opt)
+ import("idl").gen_idl(target, jobgraph, sourcebatch, opt)
+ end, {jobgraph = true, batch = true})
on_build_files(function (target, jobgraph, sourcebatch, opt)
import("idl").build_idlfiles(target, jobgraph, sourcebatch, opt)
- end, { jobgraph = true, batch = true, distcc = true })
+ end, {jobgraph = true, batch = true, distcc = true})