diff options
author | Brad King <brad.king@kitware.com> | 2020-01-27 15:06:45 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-27 15:06:53 (GMT) |
commit | f624b44524cdb3df0e85bd70679682169c55f1e5 (patch) | |
tree | da49ecf68cb4cb23d54a3ca41e55fcc415b21532 /Source | |
parent | 306328ace87376dddb2a42bf33c6338aac5d09ad (diff) | |
parent | 63c9cd2088cc1287e4d4cd858bbdb8ca88dd8313 (diff) | |
download | CMake-f624b44524cdb3df0e85bd70679682169c55f1e5.zip CMake-f624b44524cdb3df0e85bd70679682169c55f1e5.tar.gz CMake-f624b44524cdb3df0e85bd70679682169c55f1e5.tar.bz2 |
Merge topic 'fix-ninja-multi-framework-header'
63c9cd2088 Ninja Multi-Config: Fix bug with MacOS frameworks
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4279
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.h | 8 |
2 files changed, 26 insertions, 8 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 455d809..4ebdd24 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,12 +58,14 @@ std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New( cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) : cmCommonTargetGenerator(target) - , MacOSXContentGenerator(nullptr) , OSXBundleGenerator(nullptr) , LocalGenerator( static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())) { - MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this); + for (auto const& fileConfig : target->Makefile->GetGeneratorConfigs()) { + this->Configs[fileConfig].MacOSXContentGenerator = + cm::make_unique<MacOSXContentGeneratorType>(this, fileConfig); + } } cmNinjaTargetGenerator::~cmNinjaTargetGenerator() = default; @@ -837,13 +839,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( std::vector<cmSourceFile const*> headerSources; this->GeneratorTarget->GetHeaderSources(headerSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - headerSources, this->MacOSXContentGenerator.get(), config); + headerSources, this->Configs[fileConfig].MacOSXContentGenerator.get(), + config); } { std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - extraSources, this->MacOSXContentGenerator.get(), config); + extraSources, this->Configs[fileConfig].MacOSXContentGenerator.get(), + config); } if (firstForConfig) { const char* pchExtension = @@ -1452,6 +1456,16 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc, config); + // Reject files that collide with files from the Ninja file's native config. + if (config != this->FileConfig) { + std::string nativeMacdir = + this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory( + pkgloc, this->FileConfig); + if (macdir == nativeMacdir) { + return; + } + } + // Get the input file location. std::string input = source.GetFullPath(); input = this->Generator->GetGlobalGenerator()->ConvertToNinjaPath(input); @@ -1462,8 +1476,8 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( output = this->Generator->GetGlobalGenerator()->ConvertToNinjaPath(output); // Write a build statement to copy the content into the bundle. - this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input, output, - config); + this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild( + input, output, this->FileConfig); // Add as a dependency to the target so that it gets called. this->Generator->Configs[config].ExtraFiles.push_back(std::move(output)); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index bca12b1..8678dc3 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -9,6 +9,7 @@ #include <memory> #include <set> #include <string> +#include <utility> #include <vector> #include "cm_jsoncpp_value.h" @@ -173,8 +174,10 @@ protected: struct MacOSXContentGeneratorType : cmOSXBundleGenerator::MacOSXContentGeneratorType { - MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) + MacOSXContentGeneratorType(cmNinjaTargetGenerator* g, + std::string fileConfig) : Generator(g) + , FileConfig(std::move(fileConfig)) { } @@ -183,10 +186,10 @@ protected: private: cmNinjaTargetGenerator* Generator; + std::string FileConfig; }; friend struct MacOSXContentGeneratorType; - std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator; // Properly initialized by sub-classes. std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator; std::set<std::string> MacContentFolders; @@ -209,6 +212,7 @@ private: Json::Value SwiftOutputMap; std::vector<cmCustomCommand const*> CustomCommands; cmNinjaDeps ExtraFiles; + std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator; }; std::map<std::string, ByConfig> Configs; |