|
@@ -28,26 +28,16 @@ void cmOSXBundleGenerator::PrepareTargetProperties(cmTarget* target)
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
cmOSXBundleGenerator::
|
|
cmOSXBundleGenerator::
|
|
|
cmOSXBundleGenerator(cmTarget* target,
|
|
cmOSXBundleGenerator(cmTarget* target,
|
|
|
- std::string targetNameOut,
|
|
|
|
|
const char* configName)
|
|
const char* configName)
|
|
|
: Target(target)
|
|
: Target(target)
|
|
|
, Makefile(target->GetMakefile())
|
|
, Makefile(target->GetMakefile())
|
|
|
, LocalGenerator(Makefile->GetLocalGenerator())
|
|
, LocalGenerator(Makefile->GetLocalGenerator())
|
|
|
- , TargetNameOut(targetNameOut)
|
|
|
|
|
, ConfigName(configName)
|
|
, ConfigName(configName)
|
|
|
- , MacContentDirectory()
|
|
|
|
|
- , FrameworkVersion()
|
|
|
|
|
, MacContentFolders(0)
|
|
, MacContentFolders(0)
|
|
|
{
|
|
{
|
|
|
if (this->MustSkip())
|
|
if (this->MustSkip())
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
- this->MacContentDirectory =
|
|
|
|
|
- this->Target->GetMacContentDirectory(this->ConfigName,
|
|
|
|
|
- /*implib*/ false,
|
|
|
|
|
- /*includeMacOS*/ false);
|
|
|
|
|
- if(this->Target->IsFrameworkOnApple())
|
|
|
|
|
- this->FrameworkVersion = this->Target->GetFrameworkVersion();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
@@ -57,41 +47,60 @@ bool cmOSXBundleGenerator::MustSkip()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
-void cmOSXBundleGenerator::CreateAppBundle(std::string& targetName,
|
|
|
|
|
|
|
+void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
|
|
|
std::string& outpath)
|
|
std::string& outpath)
|
|
|
{
|
|
{
|
|
|
if (this->MustSkip())
|
|
if (this->MustSkip())
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
// Compute bundle directory names.
|
|
// Compute bundle directory names.
|
|
|
- outpath = this->MacContentDirectory;
|
|
|
|
|
- outpath += "MacOS";
|
|
|
|
|
- cmSystemTools::MakeDirectory(outpath.c_str());
|
|
|
|
|
- outpath += "/";
|
|
|
|
|
- this->Makefile->AddCMakeOutputFile(outpath.c_str());
|
|
|
|
|
|
|
+ std::string out = outpath;
|
|
|
|
|
+ out += "/";
|
|
|
|
|
+ out += this->Target->GetAppBundleDirectory(this->ConfigName, false);
|
|
|
|
|
+ cmSystemTools::MakeDirectory(out.c_str());
|
|
|
|
|
+ this->Makefile->AddCMakeOutputFile(out.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ std::string newoutpath = out;
|
|
|
|
|
|
|
|
// Configure the Info.plist file. Note that it needs the executable name
|
|
// Configure the Info.plist file. Note that it needs the executable name
|
|
|
// to be set.
|
|
// to be set.
|
|
|
- std::string plist = this->MacContentDirectory + "Info.plist";
|
|
|
|
|
|
|
+ std::string plist = outpath;
|
|
|
|
|
+ plist += "/";
|
|
|
|
|
+ plist += this->Target->GetAppBundleDirectory(this->ConfigName, true);
|
|
|
|
|
+ plist += "/Info.plist";
|
|
|
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
|
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
|
|
targetName.c_str(),
|
|
targetName.c_str(),
|
|
|
plist.c_str());
|
|
plist.c_str());
|
|
|
this->Makefile->AddCMakeOutputFile(plist.c_str());
|
|
this->Makefile->AddCMakeOutputFile(plist.c_str());
|
|
|
|
|
+ outpath = newoutpath;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
-void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
|
|
|
|
+void cmOSXBundleGenerator::CreateFramework(
|
|
|
|
|
+ const std::string& targetName, const std::string& outpath)
|
|
|
{
|
|
{
|
|
|
if (this->MustSkip())
|
|
if (this->MustSkip())
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
assert(this->MacContentFolders);
|
|
assert(this->MacContentFolders);
|
|
|
|
|
|
|
|
|
|
+ // Compute the location of the top-level foo.framework directory.
|
|
|
|
|
+ std::string contentdir = outpath + "/" +
|
|
|
|
|
+ this->Target->GetFrameworkDirectory(this->ConfigName, true);
|
|
|
|
|
+ contentdir += "/";
|
|
|
|
|
+
|
|
|
|
|
+ std::string newoutpath = outpath + "/" +
|
|
|
|
|
+ this->Target->GetFrameworkDirectory(this->ConfigName, false);
|
|
|
|
|
+
|
|
|
|
|
+ std::string frameworkVersion = this->Target->GetFrameworkVersion();
|
|
|
|
|
+
|
|
|
// Configure the Info.plist file into the Resources directory.
|
|
// Configure the Info.plist file into the Resources directory.
|
|
|
this->MacContentFolders->insert("Resources");
|
|
this->MacContentFolders->insert("Resources");
|
|
|
- std::string plist = this->MacContentDirectory + "Resources/Info.plist";
|
|
|
|
|
|
|
+ std::string plist = newoutpath;
|
|
|
|
|
+ plist += "/Resources/Info.plist";
|
|
|
|
|
+ std::string name = cmSystemTools::GetFilenameName(targetName);
|
|
|
this->LocalGenerator->GenerateFrameworkInfoPList(this->Target,
|
|
this->LocalGenerator->GenerateFrameworkInfoPList(this->Target,
|
|
|
- targetName.c_str(),
|
|
|
|
|
|
|
+ name.c_str(),
|
|
|
plist.c_str());
|
|
plist.c_str());
|
|
|
|
|
|
|
|
// TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
|
|
// TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
|
|
@@ -99,25 +108,17 @@ void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
std::string oldName;
|
|
std::string oldName;
|
|
|
std::string newName;
|
|
std::string newName;
|
|
|
|
|
|
|
|
- // Compute the location of the top-level foo.framework directory.
|
|
|
|
|
- std::string top = this->Target->GetDirectory(this->ConfigName);
|
|
|
|
|
- top += "/";
|
|
|
|
|
- top += this->TargetNameOut;
|
|
|
|
|
- top += ".framework/";
|
|
|
|
|
|
|
|
|
|
// Make foo.framework/Versions
|
|
// Make foo.framework/Versions
|
|
|
- std::string versions = top;
|
|
|
|
|
|
|
+ std::string versions = contentdir;
|
|
|
versions += "Versions";
|
|
versions += "Versions";
|
|
|
cmSystemTools::MakeDirectory(versions.c_str());
|
|
cmSystemTools::MakeDirectory(versions.c_str());
|
|
|
|
|
|
|
|
// Make foo.framework/Versions/version
|
|
// Make foo.framework/Versions/version
|
|
|
- std::string version = versions;
|
|
|
|
|
- version += "/";
|
|
|
|
|
- version += this->FrameworkVersion;
|
|
|
|
|
- cmSystemTools::MakeDirectory(version.c_str());
|
|
|
|
|
|
|
+ cmSystemTools::MakeDirectory(newoutpath.c_str());
|
|
|
|
|
|
|
|
// Current -> version
|
|
// Current -> version
|
|
|
- oldName = this->FrameworkVersion;
|
|
|
|
|
|
|
+ oldName = frameworkVersion;
|
|
|
newName = versions;
|
|
newName = versions;
|
|
|
newName += "/Current";
|
|
newName += "/Current";
|
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
@@ -126,9 +127,9 @@ void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
|
|
|
|
|
// foo -> Versions/Current/foo
|
|
// foo -> Versions/Current/foo
|
|
|
oldName = "Versions/Current/";
|
|
oldName = "Versions/Current/";
|
|
|
- oldName += this->TargetNameOut;
|
|
|
|
|
- newName = top;
|
|
|
|
|
- newName += this->TargetNameOut;
|
|
|
|
|
|
|
+ oldName += name;
|
|
|
|
|
+ newName = contentdir;
|
|
|
|
|
+ newName += name;
|
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
|
this->Makefile->AddCMakeOutputFile(newName.c_str());
|
|
this->Makefile->AddCMakeOutputFile(newName.c_str());
|
|
@@ -138,7 +139,7 @@ void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
this->MacContentFolders->end())
|
|
this->MacContentFolders->end())
|
|
|
{
|
|
{
|
|
|
oldName = "Versions/Current/Resources";
|
|
oldName = "Versions/Current/Resources";
|
|
|
- newName = top;
|
|
|
|
|
|
|
+ newName = contentdir;
|
|
|
newName += "Resources";
|
|
newName += "Resources";
|
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
@@ -150,7 +151,7 @@ void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
this->MacContentFolders->end())
|
|
this->MacContentFolders->end())
|
|
|
{
|
|
{
|
|
|
oldName = "Versions/Current/Headers";
|
|
oldName = "Versions/Current/Headers";
|
|
|
- newName = top;
|
|
|
|
|
|
|
+ newName = contentdir;
|
|
|
newName += "Headers";
|
|
newName += "Headers";
|
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
@@ -162,7 +163,7 @@ void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
this->MacContentFolders->end())
|
|
this->MacContentFolders->end())
|
|
|
{
|
|
{
|
|
|
oldName = "Versions/Current/PrivateHeaders";
|
|
oldName = "Versions/Current/PrivateHeaders";
|
|
|
- newName = top;
|
|
|
|
|
|
|
+ newName = contentdir;
|
|
|
newName += "PrivateHeaders";
|
|
newName += "PrivateHeaders";
|
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
cmSystemTools::RemoveFile(newName.c_str());
|
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
|
|
@@ -171,27 +172,32 @@ void cmOSXBundleGenerator::CreateFramework(std::string const& targetName)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
-void cmOSXBundleGenerator::CreateCFBundle(std::string& targetName,
|
|
|
|
|
|
|
+void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
|
|
|
std::string& outpath)
|
|
std::string& outpath)
|
|
|
{
|
|
{
|
|
|
if (this->MustSkip())
|
|
if (this->MustSkip())
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
// Compute bundle directory names.
|
|
// Compute bundle directory names.
|
|
|
- outpath = this->MacContentDirectory;
|
|
|
|
|
- outpath += "MacOS";
|
|
|
|
|
- cmSystemTools::MakeDirectory(outpath.c_str());
|
|
|
|
|
- outpath += "/";
|
|
|
|
|
- this->Makefile->AddCMakeOutputFile(outpath.c_str());
|
|
|
|
|
|
|
+ std::string out = outpath;
|
|
|
|
|
+ out += "/";
|
|
|
|
|
+ out += this->Target->GetCFBundleDirectory(this->ConfigName, true);
|
|
|
|
|
+ std::string top = out;
|
|
|
|
|
+ out += "/MacOS";
|
|
|
|
|
+ cmSystemTools::MakeDirectory(out.c_str());
|
|
|
|
|
+ this->Makefile->AddCMakeOutputFile(out.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ std::string newoutpath = out;
|
|
|
|
|
|
|
|
// Configure the Info.plist file. Note that it needs the executable name
|
|
// Configure the Info.plist file. Note that it needs the executable name
|
|
|
// to be set.
|
|
// to be set.
|
|
|
- std::string plist = this->MacContentDirectory;
|
|
|
|
|
- plist += "Info.plist";
|
|
|
|
|
|
|
+ std::string plist = top;
|
|
|
|
|
+ plist += "/Info.plist";
|
|
|
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
|
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
|
|
targetName.c_str(),
|
|
targetName.c_str(),
|
|
|
plist.c_str());
|
|
plist.c_str());
|
|
|
this->Makefile->AddCMakeOutputFile(plist.c_str());
|
|
this->Makefile->AddCMakeOutputFile(plist.c_str());
|
|
|
|
|
+ outpath = newoutpath;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
@@ -220,7 +226,11 @@ std::string
|
|
|
cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc)
|
|
cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc)
|
|
|
{
|
|
{
|
|
|
// 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->Target->GetMacContentDirectory(this->ConfigName,
|
|
|
|
|
+ /*implib*/ false);
|
|
|
|
|
+ macdir += "/";
|
|
|
macdir += pkgloc;
|
|
macdir += pkgloc;
|
|
|
cmSystemTools::MakeDirectory(macdir.c_str());
|
|
cmSystemTools::MakeDirectory(macdir.c_str());
|
|
|
|
|
|