summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/xmake.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-12-29 18:33:48 +0100
committerArthur LAURENT <[email protected]>2023-01-06 12:01:43 +0100
commite3aa97b577dac58da1588c096140f178e53256cd (patch)
tree793dff96c466b5a91dc016db8c1bfa1d8ef103dd /xmake/rules/c++/modules/xmake.lua
parent4b83826396c3bef99e138e2c6b13e2a6f818f017 (diff)
add support of importing module from packages
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
-rw-r--r--xmake/rules/c++/modules/xmake.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 2ccf27c5d..1d2852644 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -67,6 +67,24 @@ rule("c++.build.modules.builder")
common.patch_sourcebatch(target, sourcebatch, opt)
local modules = common.get_module_dependencies(target, sourcebatch, opt)
+ -- extract packages modules dependencies
+ local package_modules_data = common.get_all_package_modules(target, modules, opt)
+ if package_modules_data then
+ -- cull unused modules
+ package_modules_data = common.cull_unused_modules(target, modules, package_modules_data)
+ if package_modules_data then
+ -- append to sourcebatch
+ for name, package_module_data in pairs(package_modules_data) do
+ table.append(sourcebatch.sourcefiles, package_module_data.file)
+ end
+
+ -- we need to repatch and regenerate dependencies at this point
+ common.patch_sourcebatch(target, sourcebatch, opt)
+ opt.regenerate = true
+ modules = common.get_module_dependencies(target, sourcebatch, opt)
+ end
+ end
+
-- build modules
common.build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt)