summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx50
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);
}