summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/xmake.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-08-03 03:32:16 +0200
committerArthur LAURENT <[email protected]>2022-08-03 03:32:16 +0200
commita9ed54fd3af64a04bb7d617a51dde689d23c80de (patch)
treea5780c757033473999cbce31580b37fbe9b58a19 /xmake/rules/c++/modules/xmake.lua
parente40e8ba4cb7c7b83fa9ef1a5fbdffe7708a8de02 (diff)
[C++20 Modules] Move contains_modules function into common.lua
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
-rw-r--r--xmake/rules/c++/modules/xmake.lua17
1 files changed, 2 insertions, 15 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index be87a7eb0..436d7c5e2 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -28,20 +28,9 @@ rule("c++.build.modules")
on_config(function (target)
-- we disable to build across targets in parallel, because the source files may depend on other target modules
-- @see https://github.com/xmake-io/xmake/issues/1858
+ local common = import("modules_support.common")
- function contains_modules(target)
- local target_with_modules
- for _, dep in ipairs(target:orderdeps()) do
- local sourcebatches = dep:sourcebatches()
- if sourcebatches and sourcebatches["c++.build.modules"] then
- target_with_modules = true
- break
- end
- end
- return target_with_modules
- end
-
- local target_with_modules = target:sourcebatches()["c++.build.modules"] and contains_modules(target) or false
+ local target_with_modules = target:sourcebatches()["c++.build.modules"] and common.contains_modules(target) or false
if target_with_modules then
-- @note this will cause cross-parallel builds to be disabled for all sub-dependent targets,
-- even if some sub-targets do not contain C++ modules.
@@ -49,7 +38,6 @@ rule("c++.build.modules")
-- maybe we will have a more fine-grained configuration strategy to disable it in the future.
target:set("policy", "build.across_targets_in_parallel", false)
- local common = import("modules_support.common")
local modules_support = common.modules_support(target)
-- check C++20 module support
@@ -148,7 +136,6 @@ rule("c++.build.modules.install")
before_install(function (target)
local sourcebatch = target:sourcebatches()["c++.build.modules.install"]
-
if sourcebatch then
target:add("installfiles", sourcebatch.sourcefiles, {prefixdir = "include"})
end