summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/clang.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2023-09-20 01:22:42 +0200
committerArthur LAURENT <[email protected]>2023-09-20 01:24:12 +0200
commit230b40936fd30eeb9e78c3a64f71e3c680f518aa (patch)
tree6bab1896fef7310bec017025ae4979ea0381cbc6 /xmake/rules/c++/modules/modules_support/clang.lua
parent33bf796ef348496903f6c628d46acdf69f840e97 (diff)
fix recompilation of private .cpp
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/clang.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index 7f4b11a73..db9d974a6 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -270,6 +270,9 @@ function _build_modulefile(target, sourcefile, opt)
local bmiflags
if opt.provide then
bmifile = _get_bmi_path(opt.provide.bmifile)
+ if bmifile then
+ common.memcache():set2(bmifile, "compiling", true)
+ end
if moduleoutputflag then
compileflags = table.join("-x", "c++-module", moduleoutputflag .. bmifile, requiresflags)
else
@@ -664,9 +667,18 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
table.insert(cxxflags, flag)
end
end
- -- remove the objectfile to force rebuild because it's not handled automatically
- os.rm(target:objectfile(cppfile))
target:fileconfig_add(cppfile, {force = {cxxflags = cxxflags}})
+
+ local rebuild = false
+ for _, requiredfile in ipairs(requires) do
+ if common.memcache():get2(requiredfile, "compiling") == true then
+ rebuild = true
+ break
+ end
+ end
+ if rebuild then
+ os.rm(target:objectfile(cppfile))
+ end
end
end)})
modulesjobs[name or cppfile] = moduleinfo