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/msvc.lua | |
| parent | 08bf176c09948d0a9662ca72b804e42e90ad341d (diff) | |
Assert on multiple provides
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index f3437eeab..96997b5b9 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -227,30 +227,34 @@ 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)) - - local args = {"/c", "/Fo" .. objectfile} - local bmiflags = {} - for name, provide in pairs(m.provides) do - batchcmds:show_progress(opt.progress, "${color.build.object}generating.cxx.module.bmi %s", name) - - local bmifile = provide.bmi - table.join2(args, {interfaceflag, ifcoutputflag, bmifile, provide.sourcefile}) - - batchcmds:add_depfiles(provide.sourcefile) - - table.join2(bmiflags, {referenceflag, name .. "=" .. path.filename(bmifile)}) - depmtime = math.max(depmtime, os.mtime(bmifile)) + 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 + local args = {"/c", "/Fo" .. objectfile, interfaceflag, ifcoutputflag, bmifile, provide.sourcefile} + 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, bmi_args), {envs = vcvars}) + batchcmds:add_depfiles(provide.sourcefile) + + local bmiflags = {referenceflag, name .. "=" .. path.filename(bmifile)} target:add("cxxflags", bmiflags, {force = true, expand = false}) for _, f in ipairs(bmiflags) do target:data_add("cxx.modules.flags", f) end target:add("objectfiles", objectfile) + depmtime = math.max(depmtime, os.mtime(bmifile)) end end batchcmds:set_depmtime(depmtime) |
