From 43c3b8607775f7ee5b52e24a7f785b4c7a5ab292 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 6 Apr 2025 22:03:58 +0800 Subject: add modules with pch test --- xmake/rules/c++/precompiled_header/xmake.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xmake/rules/c++/precompiled_header/xmake.lua') diff --git a/xmake/rules/c++/precompiled_header/xmake.lua b/xmake/rules/c++/precompiled_header/xmake.lua index 7216a1f13..3f30c1ea1 100644 --- a/xmake/rules/c++/precompiled_header/xmake.lua +++ b/xmake/rules/c++/precompiled_header/xmake.lua @@ -19,18 +19,20 @@ -- 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, "c", opt) end) - before_build(function (target, opt) + on_prepare(function (target, opt) import("private.action.build.pcheader").build(target, "c", opt) end) 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) - before_build(function (target, opt) + on_prepare(function (target, opt) import("private.action.build.pcheader").build(target, "cxx", opt) end) -- cgit v1.3.1 From 6d8671865bbe9026305186c54b4ef82ebb80a4bc Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 6 Apr 2025 22:11:00 +0800 Subject: enable jobgraph for pch --- xmake/modules/private/action/build/object.lua | 1 + xmake/modules/private/action/build/pcheader.lua | 6 +++--- xmake/rules/c++/precompiled_header/xmake.lua | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'xmake/rules/c++/precompiled_header/xmake.lua') 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}) -- cgit v1.3.1 From d88716e932f28b3546b90a71e79ca9d8d5fb6551 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 6 Apr 2025 22:37:25 +0800 Subject: fix pch --- xmake/rules/c++/precompiled_header/xmake.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xmake/rules/c++/precompiled_header/xmake.lua') diff --git a/xmake/rules/c++/precompiled_header/xmake.lua b/xmake/rules/c++/precompiled_header/xmake.lua index 08ecf3fd7..c5fbd15a7 100644 --- a/xmake/rules/c++/precompiled_header/xmake.lua +++ b/xmake/rules/c++/precompiled_header/xmake.lua @@ -23,7 +23,7 @@ rule("c.build.pcheader") on_config(function (target, opt) import("private.action.build.pcheader").config(target, "c", opt) end) - on_prepare(function (target, jobgraph, opt) + before_prepare(function (target, jobgraph, opt) import("private.action.build.pcheader").build(target, jobgraph, "c", opt) end, {jobgraph = true}) @@ -32,7 +32,7 @@ rule("c++.build.pcheader") on_config(function (target, opt) import("private.action.build.pcheader").config(target, "cxx", opt) end) - on_prepare(function (target, jobgraph, opt) + before_prepare(function (target, jobgraph, opt) import("private.action.build.pcheader").build(target, jobgraph, "cxx", opt) end, {jobgraph = true}) -- cgit v1.3.1 From 162f55410e2a1ed2a81dddfc4189bb85158f2525 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 6 Apr 2025 22:44:20 +0800 Subject: fix pcheader for objc --- xmake/rules/c++/precompiled_header/xmake.lua | 1 - xmake/rules/objc++/precompiled_header/xmake.lua | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'xmake/rules/c++/precompiled_header/xmake.lua') diff --git a/xmake/rules/c++/precompiled_header/xmake.lua b/xmake/rules/c++/precompiled_header/xmake.lua index c5fbd15a7..30ab31106 100644 --- a/xmake/rules/c++/precompiled_header/xmake.lua +++ b/xmake/rules/c++/precompiled_header/xmake.lua @@ -19,7 +19,6 @@ -- 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, "c", opt) end) diff --git a/xmake/rules/objc++/precompiled_header/xmake.lua b/xmake/rules/objc++/precompiled_header/xmake.lua index db2d9f036..9f2b21ade 100644 --- a/xmake/rules/objc++/precompiled_header/xmake.lua +++ b/xmake/rules/objc++/precompiled_header/xmake.lua @@ -22,15 +22,16 @@ rule("objc.build.pcheader") on_config(function (target, opt) import("private.action.build.pcheader").config(target, "m", opt) end) - before_build(function (target, opt) - import("private.action.build.pcheader").build(target, "m", opt) - end) + before_prepare(function (target, jobgraph, opt) + import("private.action.build.pcheader").build(target, jobgraph, "m", opt) + end, {jobgraph = true}) rule("objc++.build.pcheader") + add_orders("objc++.build.pcheader", "c++.build.modules.builder") on_config(function (target, opt) import("private.action.build.pcheader").config(target, "mxx", opt) end) - before_build(function (target, opt) - import("private.action.build.pcheader").build(target, "mxx", opt) - end) + before_prepare(function (target, jobgraph, opt) + import("private.action.build.pcheader").build(target, jobgraph, "mxx", opt) + end, {jobgraph = true}) -- cgit v1.3.1