summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-08 22:45:38 +0800
committerruki <[email protected]>2022-08-08 22:45:38 +0800
commite96c32a19877939a4e325bb3afccef873b47ce35 (patch)
treec0b23b4ff893b0345b38a17e826816eda974b424 /xmake/rules/c++/modules/modules_support
parent1fb045a19472a8d04d24cb41c49a3bf75b2767d2 (diff)
fix batchjobs for gcc/headerunits
Diffstat (limited to 'xmake/rules/c++/modules/modules_support')
-rw-r--r--xmake/rules/c++/modules/modules_support/common.lua3
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc.lua23
2 files changed, 19 insertions, 7 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua
index e9ef0fb62..52a428874 100644
--- a/xmake/rules/c++/modules/modules_support/common.lua
+++ b/xmake/rules/c++/modules/modules_support/common.lua
@@ -416,6 +416,7 @@ function get_module_dependencies(target, sourcebatch, opt)
local modules = _g.modules
if modules == nil then
modules = localcache():get("modules")
+ opt.progress = opt.progress or 0
local changed = modules_support(target).generate_dependencies(target, sourcebatch, opt)
if changed or modules == nil then
local moduleinfos = load_moduleinfos(target, sourcebatch)
@@ -470,7 +471,7 @@ end
-- build modules for batchjobs
function build_modules_for_batchjobs(target, batchjobs, sourcebatch, modules, opt)
local objectfiles = sort_modules_by_dependencies(sourcebatch.objectfiles, modules)
--- modules_support(target).build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, opt)
+ modules_support(target).build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, opt)
end
-- build modules for batchcmds
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua
index 663e4ea07..af328b0b2 100644
--- a/xmake/rules/c++/modules/modules_support/gcc.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc.lua
@@ -171,10 +171,10 @@ function generate_stl_headerunits_for_batchjobs(target, batchjobs, headerunits,
progress.show((index * 100) / total, "${color.build.object}generating.cxx.headerunit.bmi %s", headerunit.name)
local args = {"-c", "-x", "c++-system-header", headerunit.name}
os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args))
- _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, projectdir))
end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}})
end, {rootjob = opt.rootjob})
end
+ _add_module_to_mapper(mapper_file, headerunit.path, path.absolute(bmifile, projectdir))
end
end
@@ -213,6 +213,13 @@ function generate_user_headerunits_for_batchjobs(target, batchjobs, headerunits,
for _, headerunit in ipairs(headerunits) do
local bmifilename = path.basename(objectfile) .. get_bmi_extension()
local bmifile = (outputdir and path.join(outputdir, bmifilename) or bmifilename)
+ local headerunit_path
+ if headerunit.type == ":quote" then
+ headerunit_path = path.join(".", path.relative(headerunit.path, projectdir))
+ elseif headerunit.type == ":angle" then
+ -- if path is relative then its a subtarget path
+ headerunit_path = path.is_absolute(headerunit.path) and headerunit.path or path.join(".", headerunit.path)
+ end
batchjobs:addjob(headerunit.name, function (index, total)
depend.on_changed(function()
progress.show((index * 100) / total, "${color.build.object}generating.cxx.headerunit.bmi %s", headerunit.name)
@@ -234,20 +241,16 @@ function generate_user_headerunits_for_batchjobs(target, batchjobs, headerunits,
-- generate headerunit
local args = { "-c" }
- local headerunit_path
if headerunit.type == ":quote" then
table.join2(args, { "-I", path.directory(path.relative(headerunit.path, projectdir)), "-x", "c++-user-header", headerunit.name })
- headerunit_path = path.join(".", path.relative(headerunit.path, projectdir))
elseif headerunit.type == ":angle" then
table.join2(args, { "-x", "c++-system-header", headerunit.name })
- -- if path is relative then its a subtarget path
- headerunit_path = path.is_absolute(headerunit.path) and headerunit.path or path.join(".", headerunit.path)
end
os.vrunv(compinst:program(), table.join(compinst:compflags({target = target}), args))
- _add_module_to_mapper(mapper_file, headerunit_path, path.absolute(bmifile, projectdir))
end, {dependfile = target:dependfile(bmifile), files = {headerunit.path}})
end, {rootjob = opt.rootjob})
+ _add_module_to_mapper(mapper_file, headerunit_path, path.absolute(bmifile, projectdir))
end
end
@@ -296,6 +299,14 @@ function generate_user_headerunits_for_batchcmds(target, batchcmds, headerunits,
batchcmds:set_depmtime(depmtime)
end
+-- build module files for batchjobs
+function build_modules_for_batchjobs(target, batchjobs, objectfiles, modules, opt)
+ batchjobs:addjob("TODO", function (index, total)
+ -- TODO
+ raise("build modules not supported!")
+ end, {rootjob = opt.rootjob})
+end
+
-- build module files for batchcmds
function build_modules_for_batchcmds(target, batchcmds, objectfiles, modules, opt)
local compinst = target:compiler("cxx")