summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-15 22:56:04 +0800
committerruki <[email protected]>2021-10-15 22:56:04 +0800
commit031626f8266e7bcced4d0f1f8f7a7cc5c45ba00a (patch)
tree67273fb662a15bf6913d3b280136f6bff55baa7d /xmake/rules/c++/modules
parent4db6d4b4eab1d11a93cd48778c9dc19699d605ce (diff)
add generate moduledeps stub
Diffstat (limited to 'xmake/rules/c++/modules')
-rw-r--r--xmake/rules/c++/modules/moduledeps.lua24
-rw-r--r--xmake/rules/c++/modules/xmake.lua9
2 files changed, 33 insertions, 0 deletions
diff --git a/xmake/rules/c++/modules/moduledeps.lua b/xmake/rules/c++/modules/moduledeps.lua
new file mode 100644
index 000000000..25842c9f7
--- /dev/null
+++ b/xmake/rules/c++/modules/moduledeps.lua
@@ -0,0 +1,24 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file moduledeps.lua
+--
+
+-- generate module deps
+function generate(target, sourcebatch, opt)
+end
+
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 53a7899d0..0e1e99d5d 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -21,6 +21,15 @@
-- define rule: c++.build.modules
rule("c++.build.modules")
set_extensions(".mpp", ".mxx", ".cppm", ".ixx")
+ before_build(function (target, opt)
+ local sourcebatches = target:sourcebatches()
+ if sourcebatches then
+ local sourcebatch = sourcebatches["c++.build.modules"]
+ if sourcebatch then
+ import("moduledeps").generate(target, sourcebatch, opt)
+ end
+ end
+ end)
before_build_files(function (target, batchjobs, sourcebatch, opt)
-- we disable to build across targets in parallel, because the source files may depend on other target modules
-- @note we cannot set it in on_load, because it will affect all c++ projects