diff options
| author | Arthur LAURENT <[email protected]> | 2022-12-01 15:57:04 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2022-12-01 15:57:04 +0100 |
| commit | 6479822a2179db58dab05e0f1b60aa4cf6c48b98 (patch) | |
| tree | fe4dcf5d7839808afd6680a920da7be975288b32 /xmake/rules/c++/modules/modules_support | |
| parent | e2c6eb2208f05cba0fe499656e2d8de1b70c9410 (diff) | |
fix msvc.lua
Diffstat (limited to 'xmake/rules/c++/modules/modules_support')
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/common.lua | 5 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/msvc.lua | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 45a1cac2f..b21613f61 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -446,10 +446,10 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess sourcecode = sourcecode:gsub("/%*.-%*/", "") for _, line in ipairs(sourcecode:split("\n", {plain = true})) do if not module_name_export then - module_name_export = line:match("export%s+module%s+(.+)%s*;") + module_name_export = line:match("export%s+module%s+(.+)%s*;") or line:match("export%s+__preprocessed_module%s+(.+)%s*;") end if not module_name_private then - module_name_private = line:match("module%s+(.+)%s*;") + module_name_private = line:match("module%s+(.+)%s*;") or line:match("__preprocessed_module%s+(.+)%s*;") end local module_depname = line:match("import%s+(.+)%s*;") -- we need parse module interface dep in cxx/impl_unit.cpp, e.g. hello.mpp and hello_impl.cpp @@ -487,6 +487,7 @@ function fallback_generate_dependencies(target, jsonfile, sourcefile, preprocess local provide = {} provide["logical-name"] = module_name_export provide["source-path"] = path.absolute(sourcefile, project.directory()) + provide["is-interface"] = true rule.provides = {} table.insert(rule.provides, provide) diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua index d153bc2d2..91b7afbc5 100644 --- a/xmake/rules/c++/modules/modules_support/msvc.lua +++ b/xmake/rules/c++/modules/modules_support/msvc.lua @@ -172,7 +172,7 @@ end -- generate dependency files function generate_dependencies(target, sourcebatch, opt) local toolchain = target:toolchain("msvc") - local vcvars = toolchain:config("vcvars") + local scandependenciesflag = nil -- get_scandependenciesflag(target) local scandependenciesflag = get_scandependenciesflag(target) local common_flags = {"-TP", scandependenciesflag} local cachedir = common.modules_cachedir(target) @@ -200,7 +200,7 @@ function generate_dependencies(target, sourcebatch, opt) table.insert(defines, "/D" .. define) end local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i")) - os.vrunv(compinst:program(), table.join(defines, {"/nologo", get_cppversionflag(target), "/P", file, "/Fi" .. ifile}), {envs = vcvars}) + os.vrunv(compinst:program(), table.join(defines, {"/nologo", get_cppversionflag(target), "/P", "-TP", file, "/Fi" .. ifile}), {envs = toolchain:runenvs()}) local content = io.readfile(ifile) os.rm(ifile) return content |
