summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/gcc.lua
diff options
context:
space:
mode:
authorArthur Laurent <[email protected]>2023-01-08 15:55:56 +0100
committerGitHub <[email protected]>2023-01-08 15:55:56 +0100
commit8749422a005d5150fccbfe807fbc618361a2afa1 (patch)
tree51809e3b148bcf03bb4514e837f253ca5dc92808 /xmake/rules/c++/modules/modules_support/gcc.lua
parentc394913eafbc3a24485a0c88b0d891e9954b302b (diff)
parent476f1c3592aa55cd10a6986c045f1be834cf2a83 (diff)
Merge branch 'dev' into improve-clang-modules-support-with-libc++
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/gcc.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc.lua34
1 files changed, 29 insertions, 5 deletions
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua
index f178e550a..5d0f9182f 100644
--- a/xmake/rules/c++/modules/modules_support/gcc.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.json")
import("core.tool.compiler")
import("core.project.project")
import("core.project.depend")
@@ -424,6 +425,24 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
end
local moduleinfo = table.copy(provide) or {}
local dependfile = (provide and provide.bmi) and target:dependfile(provide.bmi) or target:dependfile(objectfile)
+
+ if provide then
+ local fileconfig = target:fileconfig(cppfile)
+ if fileconfig and fileconfig.install then
+ batchjobs:addjob(name .. "_metafile", function(index, total)
+ local cachedir = common.modules_cachedir(target)
+ local metafilepath = path.join(cachedir, path.filename(cppfile) .. ".meta-info")
+ depend.on_changed(function()
+ progress.show(opt.progress, "${color.build.object}generating.module.metadata %s", name)
+ local metadata = common.generate_meta_module_info(target, name, cppfile, module.requires)
+ json.savefile(metafilepath, metadata)
+
+ end, {dependfile = target:dependfile(metafilepath), files = {cppfile}})
+
+ end, {rootjob = opt.rootjob})
+ end
+ end
+
table.join2(moduleinfo, {
name = name or cppfile,
deps = table.keys(module.requires or {}),
@@ -445,11 +464,16 @@ function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, op
end
if provide or common.has_module_extension(cppfile) then
- _build_modulefile(target, cppfile, {
- objectfile = objectfile,
- dependfile = dependfile,
- name = name or cppfile,
- progress = (index * 100) / total})
+ if not common.memcache():get2(name or cppfile, "compiling") then
+ if name and module.external then
+ common.memcache():set2(name or cppfile, "compiling", true)
+ end
+ _build_modulefile(target, cppfile, {
+ objectfile = objectfile,
+ dependfile = dependfile,
+ name = name or cppfile,
+ progress = (index * 100) / total})
+ end
target:add("objectfiles", objectfile)
end
end)})