diff options
| author | Arthur LAURENT <[email protected]> | 2025-05-16 15:06:02 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2025-05-16 15:06:02 +0200 |
| commit | afa8d329edd2dda64ed15f29ce1498f7943b32db (patch) | |
| tree | 942b60b899291df2809da397e0df284d00fcf4b9 /xmake/rules/c++/modules/builder.lua | |
| parent | 8fe7c166f84ee0460c79a63f5dc19d4ca77dade1 (diff) | |
(C++ modules support) fix unitybuild, pch and c++ modules objectfiles conflicts
Diffstat (limited to 'xmake/rules/c++/modules/builder.lua')
| -rw-r--r-- | xmake/rules/c++/modules/builder.lua | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/xmake/rules/c++/modules/builder.lua b/xmake/rules/c++/modules/builder.lua index 44da4d622..151c3ed9e 100644 --- a/xmake/rules/c++/modules/builder.lua +++ b/xmake/rules/c++/modules/builder.lua @@ -191,11 +191,11 @@ function build_modules_for_jobgraph(target, jobgraph, built_modules) local jobdeps = {} local buildfilejobs = {} - -- if two phase supported only build interface and implementation named modules bmi + -- get named modules local _built_modules = {} for _, sourcefile in ipairs(built_modules) do local module = mapper.get(target, sourcefile) - if module.interface or module.implementation then + if module.name then table.insert(_built_modules, sourcefile) else if not support.is_bmionly(target, sourcefile) then @@ -209,7 +209,6 @@ function build_modules_for_jobgraph(target, jobgraph, built_modules) end end end - -- add module jobs local moduletype = has_two_phase_compilation_support and "bmi" or "onephase" local buildgroup = _get_module_buildgroup_for(target, moduletype) @@ -221,7 +220,7 @@ function build_modules_for_jobgraph(target, jobgraph, built_modules) table.insert(buildfilejobs, buildfilejob) jobgraph:add(buildfilejob, function(_, _, jobopt) -- build bmi if named job - jobopt.bmi = module.interface or module.implementation + jobopt.bmi = module.name -- build objectfile here if two phase compilation is not supported jobopt.objectfile = not has_two_phase_compilation_support and not bmionly builder.make_module_job(target, module, jobopt) @@ -261,7 +260,7 @@ function build_objectfiles_for_jobgraph(target, jobgraph, built_modules) else for _, sourcefile in ipairs(built_modules) do local module = mapper.get(target, sourcefile) - if not module.interface and not module.implementation then + if not module.name then table.insert(_built_modules, sourcefile) end end @@ -295,11 +294,11 @@ function build_modules_for_batchjobs(target, batchjobs, built_modules, opt) local builder = _builder(target) local has_two_phase_compilation_support = support.has_two_phase_compilation_support(target) - -- if two phase supported only build interface and implementation named modules bmi + -- if two phase supported only build named modules bmi local _built_modules = {} for _, sourcefile in ipairs(built_modules) do local module = mapper.get(target, sourcefile) - if module.interface or module.implementation then + if module.name then table.insert(_built_modules, sourcefile) end end @@ -339,7 +338,7 @@ function build_modules_for_batchjobs(target, batchjobs, built_modules, opt) sourcefile = module.sourcefile, job = batchjobs:newjob(buildfilejob, function(_, _, jobopt) -- build bmi if named job - jobopt.bmi = module.interface or module.implementation + jobopt.bmi = module.name -- build objectfile here if two phase compilation is not supported jobopt.objectfile = not has_two_phase_compilation_support and not bmionly builder.make_module_job(target, module, jobopt) @@ -362,7 +361,7 @@ function build_objectfiles_for_batchjobs(target, batchjobs, built_modules, opt) else for _, sourcefile in ipairs(built_modules) do local module = mapper.get(target, sourcefile) - if not module.interface and not module.implementation then + if not module.name then table.insert(_built_modules, sourcefile) end end @@ -399,7 +398,7 @@ function build_modules_for_batchcmds(target, batchcmds, built_modules, opt) local _built_modules = {} for _, sourcefile in ipairs(built_modules) do local module = mapper.get(target, sourcefile) - if module.interface or module.implementation then + if module.name then table.insert(_built_modules, sourcefile) end end @@ -408,7 +407,7 @@ function build_modules_for_batchcmds(target, batchcmds, built_modules, opt) local bmionly = support.is_bmionly(target, sourcefile) local module = mapper.get(target, sourcefile) local jobopt = {} - jobopt.bmi = module.interface or module.implementation + jobopt.bmi = module.name jobopt.objectfile = not has_two_phase_compilation_support and not bmionly jobopt.progress = opt.progress depmtime = math.max(depmtime, builder.make_module_buildcmds(target, batchcmds, module, jobopt)) @@ -429,8 +428,8 @@ function build_objectfiles_for_batchcmds(target, batchcmds, built_modules, opt) else for _, sourcefile in ipairs(built_modules) do local module = mapper.get(target, sourcefile) - if not module.interface and not module.implementation then - table.insert(_built_modules, sourcefile) + if not module.name then + table.insert(_built_modules, sourcefile) end end end @@ -641,7 +640,7 @@ end function build_bmis(target, jobgraph, _, opt) opt = opt or {} if target:data("cxx.has_modules") then - if target:is_moduleonly() and not target:data("cxx.modules.reused") then + if target:is_moduleonly() and not target:data("cxx.modules.reused") or target:is_phony() then return end local modules = scanner.get_modules(target) @@ -686,7 +685,7 @@ end function build_objectfiles(target, jobgraph, _, opt) if target:data("cxx.has_modules") then - if target:is_moduleonly() and not target:data("cxx.modules.reused") then + if target:is_moduleonly() and not target:data("cxx.modules.reused") or target:is_phony() then return end local modules = scanner.get_modules(target) |
