diff options
| author | Arthur Laurent <[email protected]> | 2023-01-08 15:55:56 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-01-08 15:55:56 +0100 |
| commit | 8749422a005d5150fccbfe807fbc618361a2afa1 (patch) | |
| tree | 51809e3b148bcf03bb4514e837f253ca5dc92808 /xmake/rules/c++/modules/xmake.lua | |
| parent | c394913eafbc3a24485a0c88b0d891e9954b302b (diff) | |
| parent | 476f1c3592aa55cd10a6986c045f1be834cf2a83 (diff) | |
Merge branch 'dev' into improve-clang-modules-support-with-libc++
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index 3a7c7129d..b62ec0f36 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.insert(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) @@ -147,19 +165,6 @@ rule("c++.build.modules.install") -- we cannot use target:data("cxx.has_modules"), -- because on_config will be not called when installing targets if common.contains_modules(target) then - local sourcebatch = target:sourcebatches()["c++.build.modules.install"] - if sourcebatch then - for _, sourcefile in sourcebatch.sourcefiles do - local prefixdir = "modules" - local fileconfig = target:fileconfig(sourcefile) - if fileconfig and fileconfig.prefixdir then - prefixdir = fileconfig.prefixdir - end - local install = (fileconfig and not fileconfig.install) and false or true - if install then - target:add("installfiles", sourcefile, {prefixdir = prefixdir}) - end - end - end + common.install_module_target(target) end end) |
