Re-factor bundle content copying rules generation.
This commit is contained in:
parent
3b2a01e80e
commit
5d885db416
|
@ -18,13 +18,11 @@
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmOSXBundleGenerator.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmMakefileExecutableTargetGenerator
|
cmMakefileExecutableTargetGenerator
|
||||||
::cmMakefileExecutableTargetGenerator(cmTarget* target):
|
::cmMakefileExecutableTargetGenerator(cmTarget* target):
|
||||||
cmMakefileTargetGenerator(target),
|
cmMakefileTargetGenerator(target)
|
||||||
OSXBundleGenerator(0)
|
|
||||||
{
|
{
|
||||||
this->CustomCommandDriver = OnDepends;
|
this->CustomCommandDriver = OnDepends;
|
||||||
this->Target->GetExecutableNames(
|
this->Target->GetExecutableNames(
|
||||||
|
@ -34,6 +32,7 @@ cmMakefileExecutableTargetGenerator
|
||||||
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target,
|
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target,
|
||||||
this->TargetNameOut,
|
this->TargetNameOut,
|
||||||
this->ConfigName);
|
this->ConfigName);
|
||||||
|
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||||
this->MacContentDirectory =
|
this->MacContentDirectory =
|
||||||
this->OSXBundleGenerator->GetMacContentDirectory();
|
this->OSXBundleGenerator->GetMacContentDirectory();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#include "cmMakefileTargetGenerator.h"
|
#include "cmMakefileTargetGenerator.h"
|
||||||
|
|
||||||
class cmOSXBundleGenerator;
|
|
||||||
|
|
||||||
class cmMakefileExecutableTargetGenerator: public cmMakefileTargetGenerator
|
class cmMakefileExecutableTargetGenerator: public cmMakefileTargetGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -28,9 +26,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void WriteExecutableRule(bool relink);
|
virtual void WriteExecutableRule(bool relink);
|
||||||
|
|
||||||
private:
|
|
||||||
cmOSXBundleGenerator* OSXBundleGenerator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,15 +18,13 @@
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmOSXBundleGenerator.h"
|
|
||||||
|
|
||||||
#include <memory> // auto_ptr
|
#include <memory> // auto_ptr
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmMakefileLibraryTargetGenerator
|
cmMakefileLibraryTargetGenerator
|
||||||
::cmMakefileLibraryTargetGenerator(cmTarget* target):
|
::cmMakefileLibraryTargetGenerator(cmTarget* target):
|
||||||
cmMakefileTargetGenerator(target),
|
cmMakefileTargetGenerator(target)
|
||||||
OSXBundleGenerator(0)
|
|
||||||
{
|
{
|
||||||
cmOSXBundleGenerator::PrepareTargetProperties(this->Target);
|
cmOSXBundleGenerator::PrepareTargetProperties(this->Target);
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#include "cmMakefileTargetGenerator.h"
|
#include "cmMakefileTargetGenerator.h"
|
||||||
|
|
||||||
class cmOSXBundleGenerator;
|
|
||||||
|
|
||||||
class cmMakefileLibraryTargetGenerator:
|
class cmMakefileLibraryTargetGenerator:
|
||||||
public cmMakefileTargetGenerator
|
public cmMakefileTargetGenerator
|
||||||
{
|
{
|
||||||
|
@ -42,9 +40,6 @@ protected:
|
||||||
|
|
||||||
void AppendOSXVerFlag(std::string& flags, const char* lang,
|
void AppendOSXVerFlag(std::string& flags, const char* lang,
|
||||||
const char* name, bool so);
|
const char* name, bool so);
|
||||||
|
|
||||||
private:
|
|
||||||
cmOSXBundleGenerator* OSXBundleGenerator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
|
|
||||||
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target)
|
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target)
|
||||||
|
: OSXBundleGenerator(0)
|
||||||
|
, MacOSXContentGenerator(this)
|
||||||
{
|
{
|
||||||
this->BuildFileStream = 0;
|
this->BuildFileStream = 0;
|
||||||
this->InfoFileStream = 0;
|
this->InfoFileStream = 0;
|
||||||
|
@ -153,8 +155,12 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->WriteMacOSXContentRules(this->GeneratorTarget->HeaderSources);
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
this->WriteMacOSXContentRules(this->GeneratorTarget->ExtraSources);
|
this->GeneratorTarget->HeaderSources,
|
||||||
|
&this->MacOSXContentGenerator);
|
||||||
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
|
this->GeneratorTarget->ExtraSources,
|
||||||
|
&this->MacOSXContentGenerator);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile*>::const_iterator
|
||||||
si = this->GeneratorTarget->ExternalObjects.begin();
|
si = this->GeneratorTarget->ExternalObjects.begin();
|
||||||
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
|
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
|
||||||
|
@ -173,7 +179,6 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||||
this->GeneratorTarget->UseObjectLibraries(this->ExternalObjects);
|
this->GeneratorTarget->UseObjectLibraries(this->ExternalObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
||||||
{
|
{
|
||||||
|
@ -344,33 +349,26 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator::WriteMacOSXContentRules(
|
cmMakefileTargetGenerator::MacOSXContentGeneratorType::
|
||||||
std::vector<cmSourceFile*> const& sources)
|
MacOSXContentGeneratorType(cmMakefileTargetGenerator* 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->WriteMacOSXContentRules(**si, tsFlags.MacFolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator::WriteMacOSXContentRules(cmSourceFile& source,
|
void
|
||||||
const char* pkgloc)
|
cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
|
||||||
|
(cmSourceFile& source, const char* pkgloc)
|
||||||
{
|
{
|
||||||
// Skip OS X content when not building a Framework or Bundle.
|
// Skip OS X content when not building a Framework or Bundle.
|
||||||
if(this->MacContentDirectory.empty())
|
if(this->Generator->MacContentDirectory.empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct the full path to the content subdirectory.
|
// Construct the full path to the content subdirectory.
|
||||||
std::string macdir = this->MacContentDirectory;
|
std::string macdir = this->Generator->MacContentDirectory;
|
||||||
macdir += pkgloc;
|
macdir += pkgloc;
|
||||||
cmSystemTools::MakeDirectory(macdir.c_str());
|
cmSystemTools::MakeDirectory(macdir.c_str());
|
||||||
|
|
||||||
|
@ -379,7 +377,7 @@ void cmMakefileTargetGenerator::WriteMacOSXContentRules(cmSourceFile& source,
|
||||||
{
|
{
|
||||||
std::string loc = pkgloc;
|
std::string loc = pkgloc;
|
||||||
loc = loc.substr(0, loc.find('/'));
|
loc = loc.substr(0, loc.find('/'));
|
||||||
this->MacContentFolders.insert(loc);
|
this->Generator->MacContentFolders.insert(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the input file location.
|
// Get the input file location.
|
||||||
|
@ -389,9 +387,11 @@ void cmMakefileTargetGenerator::WriteMacOSXContentRules(cmSourceFile& source,
|
||||||
std::string output = macdir;
|
std::string output = macdir;
|
||||||
output += "/";
|
output += "/";
|
||||||
output += cmSystemTools::GetFilenameName(input);
|
output += cmSystemTools::GetFilenameName(input);
|
||||||
this->CleanFiles.push_back(this->Convert(output.c_str(),
|
this->Generator->CleanFiles.push_back(
|
||||||
cmLocalGenerator::START_OUTPUT));
|
this->Generator->Convert(output.c_str(),
|
||||||
output = this->Convert(output.c_str(), cmLocalGenerator::HOME_OUTPUT);
|
cmLocalGenerator::START_OUTPUT));
|
||||||
|
output = this->Generator->Convert(output.c_str(),
|
||||||
|
cmLocalGenerator::HOME_OUTPUT);
|
||||||
|
|
||||||
// Create a rule to copy the content into the bundle.
|
// Create a rule to copy the content into the bundle.
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
|
@ -399,21 +399,23 @@ void cmMakefileTargetGenerator::WriteMacOSXContentRules(cmSourceFile& source,
|
||||||
depends.push_back(input);
|
depends.push_back(input);
|
||||||
std::string copyEcho = "Copying OS X content ";
|
std::string copyEcho = "Copying OS X content ";
|
||||||
copyEcho += output;
|
copyEcho += output;
|
||||||
this->LocalGenerator->AppendEcho(commands, copyEcho.c_str(),
|
this->Generator->LocalGenerator->AppendEcho(
|
||||||
cmLocalUnixMakefileGenerator3::EchoBuild);
|
commands, copyEcho.c_str(),
|
||||||
|
cmLocalUnixMakefileGenerator3::EchoBuild);
|
||||||
std::string copyCommand = "$(CMAKE_COMMAND) -E copy ";
|
std::string copyCommand = "$(CMAKE_COMMAND) -E copy ";
|
||||||
copyCommand += this->Convert(input.c_str(),
|
copyCommand += this->Generator->Convert(input.c_str(),
|
||||||
cmLocalGenerator::NONE,
|
cmLocalGenerator::NONE,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
copyCommand += " ";
|
copyCommand += " ";
|
||||||
copyCommand += this->Convert(output.c_str(),
|
copyCommand += this->Generator->Convert(output.c_str(),
|
||||||
cmLocalGenerator::NONE,
|
cmLocalGenerator::NONE,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
commands.push_back(copyCommand);
|
commands.push_back(copyCommand);
|
||||||
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
|
this->Generator->LocalGenerator->WriteMakeRule(
|
||||||
output.c_str(),
|
*this->Generator->BuildFileStream, 0,
|
||||||
depends, commands, false);
|
output.c_str(),
|
||||||
this->ExtraFiles.insert(output);
|
depends, commands, false);
|
||||||
|
this->Generator->ExtraFiles.insert(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define cmMakefileTargetGenerator_h
|
#define cmMakefileTargetGenerator_h
|
||||||
|
|
||||||
#include "cmLocalUnixMakefileGenerator3.h"
|
#include "cmLocalUnixMakefileGenerator3.h"
|
||||||
|
#include "cmOSXBundleGenerator.h"
|
||||||
|
|
||||||
class cmCustomCommand;
|
class cmCustomCommand;
|
||||||
class cmDependInformation;
|
class cmDependInformation;
|
||||||
|
@ -73,8 +74,17 @@ protected:
|
||||||
void WriteTargetDependRules();
|
void WriteTargetDependRules();
|
||||||
|
|
||||||
// write rules for Mac OS X Application Bundle content.
|
// write rules for Mac OS X Application Bundle content.
|
||||||
void WriteMacOSXContentRules(std::vector<cmSourceFile*> const& sources);
|
class MacOSXContentGeneratorType
|
||||||
void WriteMacOSXContentRules(cmSourceFile& source, const char* pkgloc);
|
: public cmOSXBundleGenerator::MacOSXContentGeneratorType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MacOSXContentGeneratorType(cmMakefileTargetGenerator* Generator);
|
||||||
|
virtual void operator()(cmSourceFile& source, const char* pkgloc);
|
||||||
|
|
||||||
|
private:
|
||||||
|
cmMakefileTargetGenerator* Generator;
|
||||||
|
};
|
||||||
|
friend class MacOSXContentGeneratorType;
|
||||||
|
|
||||||
// write the rules for an object
|
// write the rules for an object
|
||||||
void WriteObjectRuleFiles(cmSourceFile& source);
|
void WriteObjectRuleFiles(cmSourceFile& source);
|
||||||
|
@ -223,6 +233,8 @@ protected:
|
||||||
// Mac OS X content info.
|
// Mac OS X content info.
|
||||||
std::string MacContentDirectory;
|
std::string MacContentDirectory;
|
||||||
std::set<cmStdString> MacContentFolders;
|
std::set<cmStdString> MacContentFolders;
|
||||||
|
cmOSXBundleGenerator* OSXBundleGenerator;
|
||||||
|
MacOSXContentGeneratorType MacOSXContentGenerator;
|
||||||
|
|
||||||
typedef std::map<cmStdString, cmStdString> ByLanguageMap;
|
typedef std::map<cmStdString, cmStdString> ByLanguageMap;
|
||||||
std::string GetFlags(const std::string &l);
|
std::string GetFlags(const std::string &l);
|
||||||
|
|
|
@ -24,6 +24,12 @@ cmMakefileUtilityTargetGenerator
|
||||||
cmMakefileTargetGenerator(target)
|
cmMakefileTargetGenerator(target)
|
||||||
{
|
{
|
||||||
this->CustomCommandDriver = OnUtility;
|
this->CustomCommandDriver = OnUtility;
|
||||||
|
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target,
|
||||||
|
this->TargetNameOut,
|
||||||
|
this->ConfigName);
|
||||||
|
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||||
|
this->MacContentDirectory =
|
||||||
|
this->OSXBundleGenerator->GetMacContentDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "cmComputeLinkInformation.h"
|
#include "cmComputeLinkInformation.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmCustomCommandGenerator.h"
|
#include "cmCustomCommandGenerator.h"
|
||||||
#include "cmOSXBundleGenerator.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -58,6 +57,7 @@ cmNinjaTargetGenerator::New(cmTarget* target)
|
||||||
|
|
||||||
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmTarget* target)
|
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmTarget* target)
|
||||||
:
|
:
|
||||||
|
MacOSXContentGenerator(this),
|
||||||
OSXBundleGenerator(0),
|
OSXBundleGenerator(0),
|
||||||
MacContentFolders(),
|
MacContentFolders(),
|
||||||
Target(target),
|
Target(target),
|
||||||
|
@ -432,9 +432,12 @@ cmNinjaTargetGenerator
|
||||||
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
cmCustomCommand const* cc = (*si)->GetCustomCommand();
|
||||||
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
|
||||||
}
|
}
|
||||||
this->WriteMacOSXContentBuildStatements(
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
this->GeneratorTarget->HeaderSources);
|
this->GeneratorTarget->HeaderSources,
|
||||||
this->WriteMacOSXContentBuildStatements(this->GeneratorTarget->ExtraSources);
|
&this->MacOSXContentGenerator);
|
||||||
|
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||||
|
this->GeneratorTarget->ExtraSources,
|
||||||
|
&this->MacOSXContentGenerator);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile*>::const_iterator
|
||||||
si = this->GeneratorTarget->ExternalObjects.begin();
|
si = this->GeneratorTarget->ExternalObjects.begin();
|
||||||
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
|
si != this->GeneratorTarget->ExternalObjects.end(); ++si)
|
||||||
|
@ -643,35 +646,27 @@ cmNinjaTargetGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// TODO: Re-factor with cmMakefileTargetGenerator::WriteMacOSXContentRules
|
cmNinjaTargetGenerator::MacOSXContentGeneratorType::
|
||||||
void cmNinjaTargetGenerator::WriteMacOSXContentBuildStatements(
|
MacOSXContentGeneratorType(cmNinjaTargetGenerator* generator)
|
||||||
std::vector<cmSourceFile*> const& sources)
|
: 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
|
||||||
void cmNinjaTargetGenerator::WriteMacOSXContentBuildStatement(
|
cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
|
||||||
cmSourceFile& source, const char* pkgloc)
|
cmSourceFile& source, const char* pkgloc)
|
||||||
{
|
{
|
||||||
// Skip OS X content when not building a Framework or Bundle.
|
// Skip OS X content when not building a Framework or Bundle.
|
||||||
if(this->OSXBundleGenerator->GetMacContentDirectory().empty())
|
if(this->Generator->OSXBundleGenerator->GetMacContentDirectory().empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct the full path to the content subdirectory.
|
// Construct the full path to the content subdirectory.
|
||||||
std::string macdir = this->OSXBundleGenerator->GetMacContentDirectory();
|
std::string macdir =
|
||||||
|
this->Generator->OSXBundleGenerator->GetMacContentDirectory();
|
||||||
macdir += pkgloc;
|
macdir += pkgloc;
|
||||||
cmSystemTools::MakeDirectory(macdir.c_str());
|
cmSystemTools::MakeDirectory(macdir.c_str());
|
||||||
|
|
||||||
|
@ -680,22 +675,25 @@ void cmNinjaTargetGenerator::WriteMacOSXContentBuildStatement(
|
||||||
{
|
{
|
||||||
std::string loc = pkgloc;
|
std::string loc = pkgloc;
|
||||||
loc = loc.substr(0, loc.find('/'));
|
loc = loc.substr(0, loc.find('/'));
|
||||||
this->MacContentFolders.insert(loc);
|
this->Generator->MacContentFolders.insert(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the input file location.
|
// Get the input file location.
|
||||||
std::string input = source.GetFullPath();
|
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.
|
// Get the output file location.
|
||||||
std::string output = macdir;
|
std::string output = macdir;
|
||||||
output += "/";
|
output += "/";
|
||||||
output += cmSystemTools::GetFilenameName(input);
|
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.
|
// 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.
|
// Add as a dependency of all target so that it gets called.
|
||||||
this->GetGlobalGenerator()->AddDependencyToAll(output);
|
this->Generator->GetGlobalGenerator()->AddDependencyToAll(output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmNinjaTypes.h"
|
#include "cmNinjaTypes.h"
|
||||||
#include "cmLocalNinjaGenerator.h"
|
#include "cmLocalNinjaGenerator.h"
|
||||||
|
#include "cmOSXBundleGenerator.h"
|
||||||
|
|
||||||
class cmTarget;
|
class cmTarget;
|
||||||
class cmGlobalNinjaGenerator;
|
class cmGlobalNinjaGenerator;
|
||||||
|
@ -24,7 +25,6 @@ class cmGeneratorTarget;
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmSourceFile;
|
class cmSourceFile;
|
||||||
class cmCustomCommand;
|
class cmCustomCommand;
|
||||||
class cmOSXBundleGenerator;
|
|
||||||
|
|
||||||
class cmNinjaTargetGenerator
|
class cmNinjaTargetGenerator
|
||||||
{
|
{
|
||||||
|
@ -115,12 +115,21 @@ protected:
|
||||||
void EnsureDirectoryExists(const std::string& dir);
|
void EnsureDirectoryExists(const std::string& dir);
|
||||||
void EnsureParentDirectoryExists(const std::string& path);
|
void EnsureParentDirectoryExists(const std::string& path);
|
||||||
|
|
||||||
void WriteMacOSXContentBuildStatements(
|
// write rules for Mac OS X Application Bundle content.
|
||||||
std::vector<cmSourceFile*> const& sources);
|
class MacOSXContentGeneratorType
|
||||||
void WriteMacOSXContentBuildStatement(cmSourceFile& source,
|
: public cmOSXBundleGenerator::MacOSXContentGeneratorType
|
||||||
const char* pkgloc);
|
{
|
||||||
|
public:
|
||||||
|
MacOSXContentGeneratorType(cmNinjaTargetGenerator* Generator);
|
||||||
|
virtual void operator()(cmSourceFile& source, const char* pkgloc);
|
||||||
|
|
||||||
|
private:
|
||||||
|
cmNinjaTargetGenerator* Generator;
|
||||||
|
};
|
||||||
|
friend class MacOSXContentGeneratorType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
MacOSXContentGeneratorType MacOSXContentGenerator;
|
||||||
// Properly initialized by sub-classes.
|
// Properly initialized by sub-classes.
|
||||||
cmOSXBundleGenerator* OSXBundleGenerator;
|
cmOSXBundleGenerator* OSXBundleGenerator;
|
||||||
std::set<cmStdString> MacContentFolders;
|
std::set<cmStdString> MacContentFolders;
|
||||||
|
|
|
@ -200,3 +200,21 @@ void cmOSXBundleGenerator::CreateCFBundle(std::string& targetName,
|
||||||
plist.c_str());
|
plist.c_str());
|
||||||
this->Makefile->AddCMakeOutputFile(plist.c_str());
|
this->Makefile->AddCMakeOutputFile(plist.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void
|
||||||
|
cmOSXBundleGenerator::
|
||||||
|
GenerateMacOSXContentStatements(std::vector<cmSourceFile*> const& sources,
|
||||||
|
MacOSXContentGeneratorType* 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)
|
||||||
|
{
|
||||||
|
(*generator)(**si, tsFlags.MacFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define cmOSXBundleGenerator_h
|
#define cmOSXBundleGenerator_h
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
|
#include "cmSourceFile.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -34,6 +35,16 @@ public:
|
||||||
void CreateFramework(std::string const& targetName);
|
void CreateFramework(std::string const& targetName);
|
||||||
void CreateCFBundle(std::string& targetName, std::string& outpath);
|
void CreateCFBundle(std::string& targetName, std::string& outpath);
|
||||||
|
|
||||||
|
class MacOSXContentGeneratorType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void GenerateMacOSXContentStatements(
|
||||||
|
std::vector<cmSourceFile*> const& sources,
|
||||||
|
MacOSXContentGeneratorType* generator);
|
||||||
|
|
||||||
std::string GetMacContentDirectory() const
|
std::string GetMacContentDirectory() const
|
||||||
{ return this->MacContentDirectory; }
|
{ return this->MacContentDirectory; }
|
||||||
std::string GetFrameworkVersion() const
|
std::string GetFrameworkVersion() const
|
||||||
|
|
Loading…
Reference in New Issue