summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-06 22:11:00 +0800
committerruki <[email protected]>2025-04-08 15:31:58 +0800
commit6d8671865bbe9026305186c54b4ef82ebb80a4bc (patch)
treea8bcb3a568481afde09d18adeba764d3ef528dfa
parent43c3b8607775f7ee5b52e24a7f785b4c7a5ab292 (diff)
enable jobgraph for pch
-rw-r--r--xmake/modules/private/action/build/object.lua1
-rw-r--r--xmake/modules/private/action/build/pcheader.lua6
-rw-r--r--xmake/rules/c++/precompiled_header/xmake.lua12
3 files changed, 10 insertions, 9 deletions
diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua
index 0028b4b6f..a8b66aa54 100644
--- a/xmake/modules/private/action/build/object.lua
+++ b/xmake/modules/private/action/build/object.lua
@@ -174,6 +174,7 @@ function _add_jobgraph(target, jobgraph, sourcebatch, opt)
end
function main(target, jobgraph, sourcebatch, opt)
+ opt = opt or {}
if jobgraph.add_orders then
_add_jobgraph(target, jobgraph, sourcebatch, opt)
else
diff --git a/xmake/modules/private/action/build/pcheader.lua b/xmake/modules/private/action/build/pcheader.lua
index 20e857d7f..ec06c8fb8 100644
--- a/xmake/modules/private/action/build/pcheader.lua
+++ b/xmake/modules/private/action/build/pcheader.lua
@@ -20,7 +20,7 @@
-- imports
import("core.language.language")
-import("object")
+import("object", {alias = "build_objects"})
function config(target, langkind, opt)
local pcheaderfile = target:pcheaderfile(langkind)
@@ -55,7 +55,7 @@ function config(target, langkind, opt)
end
-- add batch jobs to build the precompiled header file
-function build(target, langkind, opt)
+function build(target, jobgraph, langkind, opt)
local pcheaderfile = target:pcheaderfile(langkind)
if pcheaderfile then
local sourcefile = pcheaderfile
@@ -63,6 +63,6 @@ function build(target, langkind, opt)
local dependfile = target:dependfile(objectfile)
local sourcekind = language.langkinds()[langkind]
local sourcebatch = {sourcekind = sourcekind, sourcefiles = {sourcefile}, objectfiles = {objectfile}, dependfiles = {dependfile}}
- object.build(target, sourcebatch, opt)
+ build_objects(target, jobgraph, sourcebatch, opt)
end
end
diff --git a/xmake/rules/c++/precompiled_header/xmake.lua b/xmake/rules/c++/precompiled_header/xmake.lua
index 3f30c1ea1..08ecf3fd7 100644
--- a/xmake/rules/c++/precompiled_header/xmake.lua
+++ b/xmake/rules/c++/precompiled_header/xmake.lua
@@ -23,16 +23,16 @@ rule("c.build.pcheader")
on_config(function (target, opt)
import("private.action.build.pcheader").config(target, "c", opt)
end)
- on_prepare(function (target, opt)
- import("private.action.build.pcheader").build(target, "c", opt)
- end)
+ on_prepare(function (target, jobgraph, opt)
+ import("private.action.build.pcheader").build(target, jobgraph, "c", opt)
+ end, {jobgraph = true})
rule("c++.build.pcheader")
add_orders("c++.build.pcheader", "c++.build.modules.builder")
on_config(function (target, opt)
import("private.action.build.pcheader").config(target, "cxx", opt)
end)
- on_prepare(function (target, opt)
- import("private.action.build.pcheader").build(target, "cxx", opt)
- end)
+ on_prepare(function (target, jobgraph, opt)
+ import("private.action.build.pcheader").build(target, jobgraph, "cxx", opt)
+ end, {jobgraph = true})