summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/build_modules/clang.lua
diff options
context:
space:
mode:
authorÂngelo Andrade Cirino <[email protected]>2022-01-17 15:49:50 -0300
committerÂngelo Andrade Cirino <[email protected]>2022-01-17 15:57:48 -0300
commit1b2a5da03aea8f9082204c345e852ee69bd6cec4 (patch)
treeb954e5f500119ca80b5a05b983cdbd2091ca72e1 /xmake/rules/c++/modules/build_modules/clang.lua
parent92978c6f56ab66e17e19776d2e35832fa8be6e97 (diff)
Solved building submodules with clang
Diffstat (limited to 'xmake/rules/c++/modules/build_modules/clang.lua')
-rw-r--r--xmake/rules/c++/modules/build_modules/clang.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/build_modules/clang.lua b/xmake/rules/c++/modules/build_modules/clang.lua
index 523c61ad9..49ae5b2de 100644
--- a/xmake/rules/c++/modules/build_modules/clang.lua
+++ b/xmake/rules/c++/modules/build_modules/clang.lua
@@ -89,7 +89,7 @@ function build_with_batchjobs(target, batchjobs, sourcebatch, opt)
local sourcefiles_total = #sourcebatch.sourcefiles
for i = 1, sourcefiles_total do
local sourcefile = sourcebatch.sourcefiles[i]
- local moduledep = assert(moduledeps_files[sourcefile], "moduledep(%s) not found!", sourcefile)
+ local moduledep = moduledeps_files[sourcefile] or {}
moduledep.job = batchjobs:newjob(sourcefile, function (index, total)
-- compile module files to *.pcm
@@ -100,6 +100,14 @@ function build_with_batchjobs(target, batchjobs, sourcebatch, opt)
opt2.objectfile = modulefiles[i]
opt2.dependfile = target:dependfile(opt2.objectfile)
opt2.sourcekind = assert(sourcebatch.sourcekind, "%s: sourcekind not found!", sourcefile)
+ if moduledep["deps"] then
+ for _, modulefile in ipairs(modulefiles) do
+ local found = modulefile:find(moduledep["name"])
+ if found == nil then
+ target:add("cxxflags", "-fmodule-file=" .. modulefile, {force = true})
+ end
+ end
+ end
objectbuilder.build_object(target, sourcefile, opt2)
-- compile *.pcm to object files
@@ -136,4 +144,3 @@ function build_with_batchjobs(target, batchjobs, sourcebatch, opt)
end
end
end
-