diff options
| author | ruki <[email protected]> | 2024-04-09 09:37:46 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-09 09:37:46 +0800 |
| commit | c729be0bb01b41b2cdc67f5b5713da239c9ea9a6 (patch) | |
| tree | 0fde774547602aa4a9fd1ce3866c8cbed71f1854 /xmake/rules/c++ | |
| parent | 15af62b0406caefc71ad7fa01c41f29a017759bb (diff) | |
| parent | 19b67001ad77668b555a1213bc6d473bc35318aa (diff) | |
Merge pull request #4947 from xmake-io/runjobs
Improve runjobs
Diffstat (limited to 'xmake/rules/c++')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/builder.lua | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/xmake/rules/c++/modules/modules_support/builder.lua b/xmake/rules/c++/modules/modules_support/builder.lua index c56ac0731..f651e2b69 100644 --- a/xmake/rules/c++/modules/modules_support/builder.lua +++ b/xmake/rules/c++/modules/modules_support/builder.lua @@ -80,30 +80,29 @@ end -- check if flags are compatible for module reuse function _are_flags_compatible(target, other, cppfile) - local compinst1 = target:compiler("cxx") - local flags1 = compinst1:compflags({sourcefile = cppfile, target = target}) + local compinst1 = target:compiler("cxx") + local flags1 = compinst1:compflags({sourcefile = cppfile, target = target}) - local compinst2 = other:compiler("cxx") - local flags2 = compinst2:compflags({sourcefile = cppfile, target = other}) + local compinst2 = other:compiler("cxx") + local flags2 = compinst2:compflags({sourcefile = cppfile, target = other}) - -- strip unrelevent flags - flags1 = compiler_support.strip_flags(target, flags1) - flags2 = compiler_support.strip_flags(target, flags2) + -- strip unrelevent flags + flags1 = compiler_support.strip_flags(target, flags1) + flags2 = compiler_support.strip_flags(target, flags2) - if #flags1 ~= #flags2 then - return false - end - - table.sort(flags1) - table.sort(flags2) + if #flags1 ~= #flags2 then + return false + end - for i = 1, #flags1 do - if flags1[i] ~= flags2[i] then - return false - end - end + table.sort(flags1) + table.sort(flags2) - return true + for i = 1, #flags1 do + if flags1[i] ~= flags2[i] then + return false + end + end + return true end -- try to reuse modules from other target @@ -264,12 +263,18 @@ function build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, op opt.rootjob = batchjobs:group_leave() or opt.rootjob batchjobs:group_enter(target:name() .. "/build_modules", {rootjob = opt.rootjob}) - batchjobs:addjob(target:name() .. "_populate_module_map", function(_, _) - _try_reuse_modules(target, modules) - _builder(target).populate_module_map(target, modules) - end, {rootjob = opt.rootjob}) - + -- add populate module job local modulesjobs = {} + local populate_jobname = target:name() .. "_populate_module_map" + modulesjobs[populate_jobname] = { + name = populate_jobname, + job = batchjobs:newjob(populate_jobname, function(_, _) + _try_reuse_modules(target, modules) + _builder(target).populate_module_map(target, modules) + end) + } + + -- add module jobs _build_modules(target, sourcebatch, modules, table.join(opt, { build_module = function(deps, module, name, objectfile, cppfile) local job_name = name and target:name() .. name or cppfile |
