mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 15:32:10 +08:00
cmScanDepFormat: Remove Fortran-specific compiled-module-path logic
Read and write the `compiled-module-path` field only when explicitly known. Move the assumption that the `compiled-module-path` can be derived from the logical module name from the scandep parser to the `cmake_ninja_dyndep` helper.
This commit is contained in:
@@ -2448,7 +2448,6 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
|
|||||||
for (std::string const& provide : finfo.Provides) {
|
for (std::string const& provide : finfo.Provides) {
|
||||||
cmSourceReqInfo src_info;
|
cmSourceReqInfo src_info;
|
||||||
src_info.LogicalName = provide;
|
src_info.LogicalName = provide;
|
||||||
src_info.CompiledModulePath = provide;
|
|
||||||
info->ScanDep.Provides.emplace_back(src_info);
|
info->ScanDep.Provides.emplace_back(src_info);
|
||||||
}
|
}
|
||||||
for (std::string const& require : finfo.Requires) {
|
for (std::string const& require : finfo.Requires) {
|
||||||
@@ -2458,7 +2457,6 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
|
|||||||
}
|
}
|
||||||
cmSourceReqInfo src_info;
|
cmSourceReqInfo src_info;
|
||||||
src_info.LogicalName = require;
|
src_info.LogicalName = require;
|
||||||
src_info.CompiledModulePath = require;
|
|
||||||
info->ScanDep.Requires.emplace_back(src_info);
|
info->ScanDep.Requires.emplace_back(src_info);
|
||||||
}
|
}
|
||||||
for (std::string const& include : finfo.Includes) {
|
for (std::string const& include : finfo.Includes) {
|
||||||
@@ -2529,8 +2527,18 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
|
|||||||
Json::Value tm = Json::objectValue;
|
Json::Value tm = Json::objectValue;
|
||||||
for (cmScanDepInfo const& object : objects) {
|
for (cmScanDepInfo const& object : objects) {
|
||||||
for (auto const& p : object.Provides) {
|
for (auto const& p : object.Provides) {
|
||||||
std::string const mod = cmStrCat(
|
std::string mod;
|
||||||
module_dir, cmSystemTools::GetFilenameName(p.CompiledModulePath));
|
if (!p.CompiledModulePath.empty()) {
|
||||||
|
// The scanner provided the path to the module file.
|
||||||
|
mod = p.CompiledModulePath;
|
||||||
|
if (!cmSystemTools::FileIsFullPath(mod)) {
|
||||||
|
// Treat relative to work directory (top of build tree).
|
||||||
|
mod = cmSystemTools::CollapseFullPath(mod, dir_top_bld);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Assume the module file path matches the logical module name.
|
||||||
|
mod = cmStrCat(module_dir, p.LogicalName);
|
||||||
|
}
|
||||||
mod_files[p.LogicalName] = mod;
|
mod_files[p.LogicalName] = mod;
|
||||||
tm[p.LogicalName] = mod;
|
tm[p.LogicalName] = mod;
|
||||||
}
|
}
|
||||||
|
@@ -162,9 +162,6 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
|
|||||||
provide["compiled-module-path"];
|
provide["compiled-module-path"];
|
||||||
PARSE_FILENAME(compiled_module_path,
|
PARSE_FILENAME(compiled_module_path,
|
||||||
provide_info.CompiledModulePath);
|
provide_info.CompiledModulePath);
|
||||||
} else {
|
|
||||||
provide_info.CompiledModulePath =
|
|
||||||
cmStrCat(provide_info.LogicalName, ".mod");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provide.isMember("unique-on-source-path")) {
|
if (provide.isMember("unique-on-source-path")) {
|
||||||
@@ -299,9 +296,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
|
|||||||
Json::Value provide_obj(Json::objectValue);
|
Json::Value provide_obj(Json::objectValue);
|
||||||
auto const encoded = EncodeFilename(provide.LogicalName);
|
auto const encoded = EncodeFilename(provide.LogicalName);
|
||||||
provide_obj["logical-name"] = encoded;
|
provide_obj["logical-name"] = encoded;
|
||||||
if (provide.CompiledModulePath.empty()) {
|
if (!provide.CompiledModulePath.empty()) {
|
||||||
provide_obj["compiled-module-path"] = encoded;
|
|
||||||
} else {
|
|
||||||
provide_obj["compiled-module-path"] =
|
provide_obj["compiled-module-path"] =
|
||||||
EncodeFilename(provide.CompiledModulePath);
|
EncodeFilename(provide.CompiledModulePath);
|
||||||
}
|
}
|
||||||
@@ -321,9 +316,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
|
|||||||
Json::Value require_obj(Json::objectValue);
|
Json::Value require_obj(Json::objectValue);
|
||||||
auto const encoded = EncodeFilename(require.LogicalName);
|
auto const encoded = EncodeFilename(require.LogicalName);
|
||||||
require_obj["logical-name"] = encoded;
|
require_obj["logical-name"] = encoded;
|
||||||
if (require.CompiledModulePath.empty()) {
|
if (!require.CompiledModulePath.empty()) {
|
||||||
require_obj["compiled-module-path"] = encoded;
|
|
||||||
} else {
|
|
||||||
require_obj["compiled-module-path"] =
|
require_obj["compiled-module-path"] =
|
||||||
EncodeFilename(require.CompiledModulePath);
|
EncodeFilename(require.CompiledModulePath);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user