From 4cec4f287fbd9c2aae38ac4b08bdb86ba482ef15 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 9 Apr 2024 00:53:24 +0800 Subject: format code --- .../rules/c++/modules/modules_support/builder.lua | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support') diff --git a/xmake/rules/c++/modules/modules_support/builder.lua b/xmake/rules/c++/modules/modules_support/builder.lua index c56ac0731..af79e8046 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 -- cgit v1.3.1 From 81f04b64d69772851c0b781c52a7f307a4be03b9 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 9 Apr 2024 00:58:29 +0800 Subject: fix modules --- xmake/rules/c++/modules/modules_support/builder.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'xmake/rules/c++/modules/modules_support') diff --git a/xmake/rules/c++/modules/modules_support/builder.lua b/xmake/rules/c++/modules/modules_support/builder.lua index af79e8046..f651e2b69 100644 --- a/xmake/rules/c++/modules/modules_support/builder.lua +++ b/xmake/rules/c++/modules/modules_support/builder.lua @@ -263,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 -- cgit v1.3.1