From c71d77375c51440a4a5a743709e4945c00859990 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Wed, 10 Sep 2025 22:22:04 +0200 Subject: feat(C++ modules) add build.c++.modules.non_cascading_changes policy to enable bmi hash comparison as incremental build optimisation for clang --- xmake/rules/c++/modules/builder.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'xmake/rules/c++/modules/builder.lua') diff --git a/xmake/rules/c++/modules/builder.lua b/xmake/rules/c++/modules/builder.lua index b84d5d23e..a1c93a35f 100644 --- a/xmake/rules/c++/modules/builder.lua +++ b/xmake/rules/c++/modules/builder.lua @@ -180,6 +180,15 @@ function should_build(target, module) local old_dependinfo = target:is_rebuilt() and {} or (depend.load(dependfile) or {}) old_dependinfo.files = {module.sourcefile} + -- need build this object? + local dryrun = option.get("dry-run") + if dryrun or depend.is_changed(old_dependinfo, dependinfo) then + depend.save(dependinfo, dependfile) + memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, true) + profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") + return true + end + -- force rebuild a module if any of its module dependency is rebuilt for dep_name, dep_module in table.orderpairs(module.deps) do local mapped_dep = mapper.get(target, dep_module.headerunit and dep_name .. dep_module.key or dep_name) @@ -188,18 +197,10 @@ function should_build(target, module) depend.save(dependinfo, dependfile) memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, true) profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") - return true + return true, true end end - -- need build this object? - local dryrun = option.get("dry-run") - if dryrun or depend.is_changed(old_dependinfo, dependinfo) then - depend.save(dependinfo, dependfile) - memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, true) - profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") - return true - end memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, false) profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") return false -- cgit v1.3.1