diff options
author | Brad King <brad.king@kitware.com> | 2016-10-25 13:08:51 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-10-25 13:08:51 (GMT) |
commit | 9430125511865b65e2fa897c59c70414238fbf91 (patch) | |
tree | 695aa78b0eeed4daf5020cd81c4aff939dcdde27 /Source | |
parent | 9a399c27a8c6e9a264cbabf9bb3b091b2e74a71f (diff) | |
parent | 87cc9bfc3c6892c93e10f73421e2b0fdba06b8e9 (diff) | |
download | CMake-9430125511865b65e2fa897c59c70414238fbf91.zip CMake-9430125511865b65e2fa897c59c70414238fbf91.tar.gz CMake-9430125511865b65e2fa897c59c70414238fbf91.tar.bz2 |
Merge topic 'ninja-subdir-binary-dir'
87cc9bfc Merge branch 'backport-ninja-subdir-binary-dir' into ninja-subdir-binary-dir
e983bd32 Ninja: Use binary dir for `$subdir/all` targets
42db2ebc Ninja: Use binary dir for `$subdir/all` targets
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 44 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 1 |
2 files changed, 16 insertions, 29 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 182d7e4..ee594b0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -879,20 +879,6 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath( return convPath; } -std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule( - const std::string& path) -{ - cmLocalNinjaGenerator* ng = - static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]); - std::string convPath = ng->ConvertToRelativePath( - this->LocalGenerators[0]->GetState()->GetSourceDirectory(), path + "/all"); - convPath = this->NinjaOutputPath(convPath); -#ifdef _WIN32 - std::replace(convPath.begin(), convPath.end(), '/', '\\'); -#endif - return convPath; -} - void cmGlobalNinjaGenerator::AddCXXCompileCommand( const std::string& commandLine, const std::string& sourceFile) { @@ -1119,11 +1105,11 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) this->LocalGenerators.begin(); lgi != this->LocalGenerators.end(); ++lgi) { cmLocalGenerator const* lg = *lgi; - const std::string currentSourceFolder( - lg->GetStateSnapshot().GetDirectory().GetCurrentSource()); + const std::string currentBinaryFolder( + lg->GetStateSnapshot().GetDirectory().GetCurrentBinary()); // The directory-level rule should depend on the target-level rules // for all targets in the directory. - targetsPerFolder[currentSourceFolder] = cmNinjaDeps(); + targetsPerFolder[currentBinaryFolder] = cmNinjaDeps(); for (std::vector<cmGeneratorTarget*>::const_iterator ti = lg->GetGeneratorTargets().begin(); ti != lg->GetGeneratorTargets().end(); ++ti) { @@ -1136,7 +1122,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) type == cmStateEnums::OBJECT_LIBRARY || type == cmStateEnums::UTILITY) && !gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { - targetsPerFolder[currentSourceFolder].push_back(gt->GetName()); + targetsPerFolder[currentBinaryFolder].push_back(gt->GetName()); } } @@ -1147,28 +1133,30 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) for (std::vector<cmStateSnapshot>::const_iterator stateIt = children.begin(); stateIt != children.end(); ++stateIt) { - targetsPerFolder[currentSourceFolder].push_back( - this->ConvertToNinjaFolderRule( - stateIt->GetDirectory().GetCurrentSource())); + std::string const currentBinaryDir = + stateIt->GetDirectory().GetCurrentBinary(); + + targetsPerFolder[currentBinaryFolder].push_back( + this->ConvertToNinjaPath(currentBinaryDir + "/all")); } } - std::string const rootSourceDir = - this->LocalGenerators[0]->GetSourceDirectory(); + std::string const rootBinaryDir = + this->LocalGenerators[0]->GetBinaryDirectory(); for (std::map<std::string, cmNinjaDeps>::const_iterator it = targetsPerFolder.begin(); it != targetsPerFolder.end(); ++it) { cmGlobalNinjaGenerator::WriteDivider(os); - std::string const& currentSourceDir = it->first; + std::string const& currentBinaryDir = it->first; - // Do not generate a rule for the root source dir. - if (rootSourceDir.length() >= currentSourceDir.length()) { + // Do not generate a rule for the root binary dir. + if (rootBinaryDir.length() >= currentBinaryDir.length()) { continue; } - std::string const comment = "Folder: " + currentSourceDir; + std::string const comment = "Folder: " + currentBinaryDir; cmNinjaDeps output(1); - output.push_back(this->ConvertToNinjaFolderRule(currentSourceDir)); + output.push_back(this->ConvertToNinjaPath(currentBinaryDir + "/all")); this->WritePhonyBuild(os, comment, output, it->second); } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 1084469..81ec3eb 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -241,7 +241,6 @@ public: } std::string ConvertToNinjaPath(const std::string& path) const; - std::string ConvertToNinjaFolderRule(const std::string& path); struct MapToNinjaPathImpl { |