diff options
| author | Arthur LAURENT <[email protected]> | 2024-07-23 22:00:27 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-07-23 23:24:56 +0200 |
| commit | d84b42ace51b952a7433c2d966b5a3cc763717dc (patch) | |
| tree | 998a34315b52aef7860abf4606840c08d86dcbcc | |
| parent | ab6ee69bce2bd78596f4713ec4300301e025a56f (diff) | |
remove unnecessary code
culling is already done by dependency scanner
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/compiler_support.lua | 23 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/dependency_scanner.lua | 6 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 6 |
3 files changed, 3 insertions, 32 deletions
diff --git a/xmake/rules/c++/modules/modules_support/compiler_support.lua b/xmake/rules/c++/modules/modules_support/compiler_support.lua index 8e9cf7ab6..e6cd32bbc 100644 --- a/xmake/rules/c++/modules/modules_support/compiler_support.lua +++ b/xmake/rules/c++/modules/modules_support/compiler_support.lua @@ -83,29 +83,6 @@ function patch_sourcebatch(target, sourcebatch) end end --- cull sourcebatch objectfiles -function cull_objectfiles(target, modules, sourcebatch) - - sourcebatch.objectfiles = {} - for _, sourcefile in ipairs(sourcebatch.sourcefiles) do - local objectfile = target:objectfile(sourcefile) - local module = modules[objectfile] - local name, provide, _ = get_provided_module(module) - if provide then - local fileconfig = target:fileconfig(sourcefile) - local public = fileconfig and fileconfig.public - local external = fileconfig and fileconfig.external - local from_moduleonly = external and external.moduleonly - local dont_cull = fileconfig and fileconfig.cull ~= nil and not fileconfig.cull - if (provide and not external) or public or from_moduleonly or dont_cull then - table.insert(sourcebatch.objectfiles, objectfile) - end - else - table.insert(sourcebatch.objectfiles, objectfile) - end - end -end - -- get bmi extension function get_bmi_extension(target) return _compiler_support(target).get_bmi_extension() diff --git a/xmake/rules/c++/modules/modules_support/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/dependency_scanner.lua index c67e18a79..7db818cf4 100644 --- a/xmake/rules/c++/modules/modules_support/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/dependency_scanner.lua @@ -430,11 +430,11 @@ function sort_modules_by_dependencies(target, objectfiles, modules) local fileconfig = target:fileconfig(cppfile) local public = fileconfig and fileconfig.public local external = fileconfig and fileconfig.external - local from_moduleonly = external and external.moduleonly + local moduleonly = external and external.moduleonly local dont_cull = fileconfig and fileconfig.cull ~= nil and not fileconfig.cull - if not provide or public or from_moduleonly or dont_cull then + if not provide or public or moduleonly or dont_cull then table.insert(result, objectfile) - elseif not external then + else wprint("%s has been culled because it's not consumed by its target (%s) nor flagged as a public module (add_files(\"xxx.cppm\", {public = true}))", cppfile, target:name()) end else diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index 38d1bba4d..67a4a1497 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -114,9 +114,6 @@ rule("c++.build.modules.builder") -- build headerunits and we need to do it before building modules builder.build_headerunits_for_batchjobs(target, batchjobs, sourcebatch, modules, opt) - - -- cull external modules objectfile - compiler_support.cull_objectfiles(target, modules, sourcebatch) else sourcebatch.objectfiles = {} end @@ -175,9 +172,6 @@ rule("c++.build.modules.builder") -- build modules builder.build_modules_for_batchcmds(target, batchcmds, sourcebatch, modules, opt) - - -- cull external modules objectfile - compiler_support.cull_objectfiles(target, modules, sourcebatch) else -- avoid duplicate linking of object files of non-module programs sourcebatch.objectfiles = {} |
