cmScanDepFormat: support P1689R5

This adds the `is-interface` key on provides fields.
This commit is contained in:
Ben Boeckel
2022-07-18 12:05:58 -04:00
parent b5a6648c4b
commit d7f5064ff7
4 changed files with 28 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ dependencies to the file specified by the ``<DYNDEP_FILE>`` placeholder. The
for scandep rules which use ``msvc``-style dependency reporting.
The module dependencies should be written in the format described
by the `P1689r4`_ paper.
by the `P1689r5`_ paper.
Compiler writers may try out their scanning functionality using
the `cxx-modules-sandbox`_ test project, modified to set variables
@@ -85,5 +85,5 @@ the GCC documentation, but the relevant section for the purposes of CMake is:
-- GCC module mapper documentation
.. _`D1483r1`: https://mathstuf.fedorapeople.org/fortran-modules/fortran-modules.html
.. _`P1689r4`: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1689r4.html
.. _`P1689r5`: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1689r5.html
.. _`cxx-modules-sandbox`: https://github.com/mathstuf/cxx-modules-sandbox

View File

@@ -0,0 +1,6 @@
p1689r5
-------
* C++ module scanning now supports the latest revision, `P1689R5`_.
.. _`P1689r5`: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1689r5.html

View File

@@ -188,6 +188,19 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
return false;
}
if (provide.isMember("is-interface")) {
Json::Value const& is_interface = provide["is-interface"];
if (!is_interface.isBool()) {
cmSystemTools::Error(
cmStrCat("-E cmake_ninja_dyndep failed to parse ", arg_pp,
": is-interface is not a boolean"));
return false;
}
provide_info.IsInterface = is_interface.asBool();
} else {
provide_info.IsInterface = true;
}
info->Provides.push_back(provide_info);
}
}
@@ -308,6 +321,8 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
provide_obj["source-path"] = EncodeFilename(provide.SourcePath);
}
provide_obj["is-interface"] = provide.IsInterface;
provides.append(provide_obj);
}

View File

@@ -18,6 +18,11 @@ struct cmSourceReqInfo
std::string SourcePath;
std::string CompiledModulePath;
bool UseSourcePath = false;
// Provides-only fields.
bool IsInterface = true;
// Requires-only fields.
LookupMethod Method = LookupMethod::ByName;
};