summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/xmake.lua
diff options
context:
space:
mode:
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)