1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 19:08:07 +08:00

Ninja: depend on language module information files directly

Now that `GetLinkedTargetDirectories` can get the exact dependencies,
use them to simplify the collation dependency graph.
This commit is contained in:
Ben Boeckel
2023-02-10 18:42:02 -05:00
parent 0ace6053e8
commit b6a5382217

View File

@@ -1146,6 +1146,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
cmNinjaBuild build(this->LanguageDyndepRule(language, config));
build.Outputs.push_back(this->GetDyndepFilePath(language, config));
build.ImplicitOuts.push_back(
cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/',
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
this->GetGlobalGenerator()->ConfigDirectory(config), '/',
language, "Modules.json"));
for (auto const& scanFiles : scanningFiles) {
if (!scanFiles.ScanningOutput.empty()) {
build.ExplicitDeps.push_back(scanFiles.ScanningOutput);
@@ -1157,17 +1162,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
this->WriteTargetDependInfo(language, config);
// Make sure dyndep files for all our dependencies have already
// been generated so that the '<LANG>Modules.json' files they
// produced as side-effects are available for us to read.
// Ideally we should depend on the '<LANG>Modules.json' files
// from our dependencies directly, but we don't know which of
// our dependencies produces them. Fixing this will require
// refactoring the Ninja generator to generate targets in
// dependency order so that we can collect the needed information.
this->GetLocalGenerator()->AppendTargetDepends(
this->GeneratorTarget, build.OrderOnlyDeps, config, fileConfig,
DependOnTargetArtifact);
for (std::string const& l :
this->GetLinkedTargetDirectories(language, config)) {
build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json"));
}
this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig),
build);