diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2019-02-20 06:39:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-25 15:06:20 (GMT) |
commit | 72f9bb29939f3765216e98e672197b3899d75f7d (patch) | |
tree | c2f564228c8c1d4632ca8d446aba3b16b1c4fc82 /Source/cmNinjaTargetGenerator.cxx | |
parent | 2dd0cb7aeb2d70dcc6e103c29ce2ce3a02bd381a (diff) | |
download | CMake-72f9bb29939f3765216e98e672197b3899d75f7d.zip CMake-72f9bb29939f3765216e98e672197b3899d75f7d.tar.gz CMake-72f9bb29939f3765216e98e672197b3899d75f7d.tar.bz2 |
ninja: make dyndep generation language aware
A target may have multiple languages with dyndep rules, separate `.dd`
files should be generated.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6013cd0..6a08d5c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -594,7 +594,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) ddCmds.push_back(cmake + " -E cmake_ninja_dyndep" " --tdi=" + - tdi + + tdi + " --lang=" + lang + " --dd=$out" " " + ddInput); @@ -868,24 +868,27 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() this->WriteObjectBuildStatement(sf); } - if (!this->DDIFiles.empty()) { + for (auto const& langDDIFiles : this->DDIFiles) { + std::string const& language = langDDIFiles.first; + cmNinjaDeps const& ddiFiles = langDDIFiles.second; + std::string const ddComment; - std::string const ddRule = this->LanguageDyndepRule("Fortran"); + std::string const ddRule = this->LanguageDyndepRule(language); cmNinjaDeps ddOutputs; cmNinjaDeps ddImplicitOuts; - cmNinjaDeps const& ddExplicitDeps = this->DDIFiles; + cmNinjaDeps const& ddExplicitDeps = ddiFiles; cmNinjaDeps ddImplicitDeps; cmNinjaDeps ddOrderOnlyDeps; cmNinjaVars ddVars; - this->WriteTargetDependInfo("Fortran"); + this->WriteTargetDependInfo(language); - ddOutputs.push_back(this->GetDyndepFilePath("Fortran")); + ddOutputs.push_back(this->GetDyndepFilePath(language)); // Make sure dyndep files for all our dependencies have already - // been generated so that the 'FortranModules.json' files they + // 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 'FortranModules.json' files + // 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 @@ -1099,7 +1102,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::string const ddiFile = ppFileName + ".ddi"; ppVars["DYNDEP_INTERMEDIATE_FILE"] = ddiFile; ppImplicitOuts.push_back(ddiFile); - this->DDIFiles.push_back(ddiFile); + this->DDIFiles[language].push_back(ddiFile); } this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(), |