diff options
| author | ruki <[email protected]> | 2025-08-15 08:24:36 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-15 08:24:36 +0800 |
| commit | 7a7e2c584a94e5658ad5a6c1e971285aaa4fdf4c (patch) | |
| tree | 52c310d80a6f9453a1c91a588004ae08bda37a31 /xmake/rules/c++/modules/scanner.lua | |
| parent | c754e6c627bf3bef98e25db80d21d67f7fdad865 (diff) | |
| parent | af4abe5c6611ddf7a583673a9c531dbfdcee42d2 (diff) | |
Merge pull request #6713 from Arthapz/fix-sourcebatch-stealing
fix(c++ modules) fix non .cpp file stealed from c++.build sourcebatch
Diffstat (limited to 'xmake/rules/c++/modules/scanner.lua')
| -rw-r--r-- | xmake/rules/c++/modules/scanner.lua | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/scanner.lua b/xmake/rules/c++/modules/scanner.lua index 41770223d..9cf015502 100644 --- a/xmake/rules/c++/modules/scanner.lua +++ b/xmake/rules/c++/modules/scanner.lua @@ -460,6 +460,7 @@ function _do_computedag(target, modules, sourcebatch) local localcache = support.localcache() local memcache = support.memcache() local changed = memcache:get2(target:fullname(), "modules.changed") + if changed then localcache:set2(target:fullname(), "c++.modules", modules) mapper.feed(target, modules, sourcebatch.sourcefiles) @@ -485,17 +486,19 @@ function _do_computedag(target, modules, sourcebatch) cxx_sourcebatch.dependfiles = {} cxx_sourcebatch.objectfiles = {} for _, sourcefile in ipairs(sourcebatch.sourcefiles) do - local module = modules[sourcefile] - local insert = true - if module then - insert = not module.name - end + if not support.has_module_extension(sourcefile) then + local module = modules[sourcefile] + local insert = true + if module then + insert = not module.name + end - if insert then - table.insert(cxx_sourcebatch.sourcefiles, sourcefile) - local objectfile = target:objectfile(sourcefile) - table.insert(cxx_sourcebatch.dependfiles, target:dependfile(objectfile)) - table.insert(cxx_sourcebatch.objectfiles, objectfile) + if insert then + table.insert(cxx_sourcebatch.sourcefiles, sourcefile) + local objectfile = target:objectfile(sourcefile) + table.insert(cxx_sourcebatch.dependfiles, target:dependfile(objectfile)) + table.insert(cxx_sourcebatch.objectfiles, objectfile) + end end end localcache:set2(target:fullname(), "c++.build.sourcebatch", cxx_sourcebatch) |
