diff options
| author | Arthur LAURENT <[email protected]> | 2022-08-05 06:11:54 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2022-08-05 06:23:19 +0200 |
| commit | cf4a7193ea34e3f82d710114343c7fb1f00e261d (patch) | |
| tree | eb8940dc25c5feaf565705740f74fcd338d629fb /xmake/rules/c++/modules/modules_support/gcc.lua | |
| parent | 08bf176c09948d0a9662ca72b804e42e90ad341d (diff) | |
Assert on multiple provides
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/gcc.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/gcc.lua | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/xmake/rules/c++/modules/modules_support/gcc.lua b/xmake/rules/c++/modules/modules_support/gcc.lua index ee4013d3e..0da739a7a 100644 --- a/xmake/rules/c++/modules/modules_support/gcc.lua +++ b/xmake/rules/c++/modules/modules_support/gcc.lua @@ -236,25 +236,32 @@ function build_modules(target, batchcmds, objectfiles, modules, opt) local depmtime = 0 for _, objectfile in ipairs(objectfiles) do local m = modules[objectfile] - if m then - batchcmds:mkdir(path.directory(objectfile)) + if m and m.provides then + -- assume there that provides is only one, until we encounter the case + local length = 0 + local name, provide + for k, v in pairs(m.provides) do + length = length + 1 + name = k + provide = v + if length > 1 then + raise("multiple provides are not supported now!") + end + end + + local bmifile = provide.bmi + if _add_module_to_mapper(mapper_file, name, path.absolute(bmifile, projectdir)) then + local args = {"-o", objectfile, "-c", provide.sourcefile}) - local args = {"-o", objectfile} - for name, provide in pairs(m.provides) do 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, args)) - local bmifile = provide.bmi - if _add_module_to_mapper(mapper_file, name, path.absolute(bmifile, projectdir)) then - table.join2(args, {"-c", provide.sourcefile}) + batchcmds:add_depfiles(provide.sourcefile) + target:add("objectfiles", objectfile) - batchcmds:add_depfiles(provide.sourcefile) - end depmtime = math.max(depmtime, os.mtime(bmifile)) end - - batchcmds:vrunv(compinst:program(), table.join(compinst:compflags({target = target}), common_args, args)) - - target:add("objectfiles", objectfile) end end batchcmds:set_depmtime(depmtime) |
