summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/clang.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-15 11:19:15 +0800
committerGitHub <[email protected]>2022-08-15 11:19:15 +0800
commit4e4559e121c1ea1387874809fb448548dc0dba80 (patch)
treea994abe7a9836df6afe1bd201cda2dd2864b9d99 /xmake/rules/c++/modules/modules_support/clang.lua
parent595a078ba33abd374cf900a07570222151caf605 (diff)
parentff971cdfeb55701078e894c380939ed7146b5638 (diff)
Merge pull request #2673 from xmake-io/generator
improve generator for cxxmodules
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/clang.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index bd4448ae7..fb3a2d1fa 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -210,7 +210,9 @@ function generate_stl_headerunits_for_batchcmds(target, batchcmds, headerunits,
-- don't build same header unit at the same time
if not common.memcache():get2(headerunit.name, "building") then
common.memcache():set2(headerunit.name, "building", true)
- local args = {modulecachepathflag .. stlcachedir, "-c", "-o", bmifile, "-x", "c++-system-header", headerunit.name}
+ local args = {
+ path(stlcachedir, function (p) return modulecachepathflag .. p end),
+ "-c", "-o", path(bmifile), "-x", "c++-system-header", headerunit.name}
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.headerunit.bmi %s", headerunit.name)
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args))
end
@@ -306,9 +308,9 @@ function generate_user_headerunits_for_batchcmds(target, batchcmds, headerunits,
local bmifile = (outputdir and path.join(outputdir, bmifilename) or bmifilename)
batchcmds:mkdir(path.directory(objectfile))
- local args = { modulecachepathflag .. cachedir, "-c", "-o", bmifile}
+ local args = {path(cachedir, function (p) return modulecachepathflag .. p end), "-c", "-o", path(bmifile)}
if headerunit.type == ":quote" then
- table.join2(args, {"-I", path.directory(headerunit.path), "-x", "c++-user-header", headerunit.path})
+ table.join2(args, {"-I", path(headerunit.path):directory(), "-x", "c++-user-header", path(headerunit.path)})
elseif headerunit.type == ":angle" then
table.join2(args, {"-x", "c++-system-header", headerunit.name})
end
@@ -421,7 +423,7 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op
-- build modules
local depmtime = 0
- local common_args = {modulecachepathflag .. cachedir}
+ local common_args = {path(cachedir, function (p) return modulecachepathflag .. p end)}
for _, objectfile in ipairs(objectfiles) do
local module = modules[objectfile]
if module then
@@ -433,7 +435,7 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op
break
end
local bmifile = provide.bmi
- local args = { "-c", "-x", "c++-module", "--precompile", provide.sourcefile, "-o", bmifile }
+ local args = {"-c", "-x", "c++-module", "--precompile", path(provide.sourcefile), "-o", path(bmifile)}
local requiresflags
if module.requires then
requiresflags = get_requiresflags(target, module.requires)
@@ -441,7 +443,7 @@ function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, op
batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.module.bmi %s", name)
batchcmds:mkdir(path.directory(objectfile))
batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, requiresflags or {}, args))
- batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, requiresflags or {}, {bmifile}, {"-c", "-o", objectfile}))
+ batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, requiresflags or {}, path(bmifile), {"-c", "-o", path(objectfile)}))
batchcmds:add_depfiles(provide.sourcefile)
_add_module_to_mapper(target, name, bmifile)
depmtime = math.max(depmtime, os.mtime(bmifile))