diff options
author | Nicolas Despres <nicolas.despres@gmail.com> | 2012-07-16 15:34:22 (GMT) |
---|---|---|
committer | Peter Kümmel <syntheticpp@gmx.net> | 2012-07-17 12:03:10 (GMT) |
commit | 5d885db416a4cec236ba6422868dc3db3d766bc4 (patch) | |
tree | d7d30b2df4e3c706c7598407b96c0abbdcba36ee /Source/cmNinjaTargetGenerator.cxx | |
parent | 3b2a01e80ef0faf626afd4c5031395c00e1c9ecd (diff) | |
download | CMake-5d885db416a4cec236ba6422868dc3db3d766bc4.zip CMake-5d885db416a4cec236ba6422868dc3db3d766bc4.tar.gz CMake-5d885db416a4cec236ba6422868dc3db3d766bc4.tar.bz2 |
Re-factor bundle content copying rules generation.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index f71cc60..2c7bffc 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -22,7 +22,6 @@ #include "cmComputeLinkInformation.h" #include "cmSourceFile.h" #include "cmCustomCommandGenerator.h" -#include "cmOSXBundleGenerator.h" #include <algorithm> @@ -58,6 +57,7 @@ cmNinjaTargetGenerator::New(cmTarget* target) cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmTarget* target) : + MacOSXContentGenerator(this), OSXBundleGenerator(0), MacContentFolders(), Target(target), @@ -432,9 +432,12 @@ cmNinjaTargetGenerator cmCustomCommand const* cc = (*si)->GetCustomCommand(); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); } - this->WriteMacOSXContentBuildStatements( - this->GeneratorTarget->HeaderSources); - this->WriteMacOSXContentBuildStatements(this->GeneratorTarget->ExtraSources); + this->OSXBundleGenerator->GenerateMacOSXContentStatements( + this->GeneratorTarget->HeaderSources, + &this->MacOSXContentGenerator); + this->OSXBundleGenerator->GenerateMacOSXContentStatements( + this->GeneratorTarget->ExtraSources, + &this->MacOSXContentGenerator); for(std::vector<cmSourceFile*>::const_iterator si = this->GeneratorTarget->ExternalObjects.begin(); si != this->GeneratorTarget->ExternalObjects.end(); ++si) @@ -643,35 +646,27 @@ cmNinjaTargetGenerator } //---------------------------------------------------------------------------- -// TODO: Re-factor with cmMakefileTargetGenerator::WriteMacOSXContentRules -void cmNinjaTargetGenerator::WriteMacOSXContentBuildStatements( - std::vector<cmSourceFile*> const& sources) +cmNinjaTargetGenerator::MacOSXContentGeneratorType:: +MacOSXContentGeneratorType(cmNinjaTargetGenerator* generator) + : cmOSXBundleGenerator::MacOSXContentGeneratorType() + , Generator(generator) { - for(std::vector<cmSourceFile*>::const_iterator - si = sources.begin(); si != sources.end(); ++si) - { - cmTarget::SourceFileFlags tsFlags = - this->Target->GetTargetSourceFileFlags(*si); - if(tsFlags.Type != cmTarget::SourceFileTypeNormal) - { - this->WriteMacOSXContentBuildStatement(**si, tsFlags.MacFolder); - } - } } //---------------------------------------------------------------------------- -// TODO: Re-factor with cmMakefileTargetGenerator::WriteMacOSXContentRules -void cmNinjaTargetGenerator::WriteMacOSXContentBuildStatement( +void +cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( cmSourceFile& source, const char* pkgloc) { // Skip OS X content when not building a Framework or Bundle. - if(this->OSXBundleGenerator->GetMacContentDirectory().empty()) + if(this->Generator->OSXBundleGenerator->GetMacContentDirectory().empty()) { return; } // Construct the full path to the content subdirectory. - std::string macdir = this->OSXBundleGenerator->GetMacContentDirectory(); + std::string macdir = + this->Generator->OSXBundleGenerator->GetMacContentDirectory(); macdir += pkgloc; cmSystemTools::MakeDirectory(macdir.c_str()); @@ -680,22 +675,25 @@ void cmNinjaTargetGenerator::WriteMacOSXContentBuildStatement( { std::string loc = pkgloc; loc = loc.substr(0, loc.find('/')); - this->MacContentFolders.insert(loc); + this->Generator->MacContentFolders.insert(loc); } // Get the input file location. std::string input = source.GetFullPath(); - input = this->GetLocalGenerator()->ConvertToNinjaPath(input.c_str()); + input = + this->Generator->GetLocalGenerator()->ConvertToNinjaPath(input.c_str()); // Get the output file location. std::string output = macdir; output += "/"; output += cmSystemTools::GetFilenameName(input); - output = this->GetLocalGenerator()->ConvertToNinjaPath(output.c_str()); + output = + this->Generator->GetLocalGenerator()->ConvertToNinjaPath(output.c_str()); // Write a build statement to copy the content into the bundle. - this->GetGlobalGenerator()->WriteMacOSXContentBuild(input, output); + this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input, + output); // Add as a dependency of all target so that it gets called. - this->GetGlobalGenerator()->AddDependencyToAll(output); + this->Generator->GetGlobalGenerator()->AddDependencyToAll(output); } |