summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-07-24 21:03:46 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-07-24 21:03:46 (GMT)
commita51e1529e79ef46c8f7f346328c788a4e630e474 (patch)
tree7fed8476e05fe1278f09a130cdf2080c12762c42 /Source/cmNinjaNormalTargetGenerator.cxx
parentc1bbdbff57651a24fd8d7d5abe67dd24e7e6ed27 (diff)
parent1fc8df9ca22c23f42afa94a949918cda008b07ce (diff)
downloadCMake-a51e1529e79ef46c8f7f346328c788a4e630e474.zip
CMake-a51e1529e79ef46c8f7f346328c788a4e630e474.tar.gz
CMake-a51e1529e79ef46c8f7f346328c788a4e630e474.tar.bz2
Merge topic 'ninja-fix-macosx'
1fc8df9 Add missing this->. 7a3ecf5 Fix memory leak in Makefile generator. 9f7dc83 Ninja: also bootstrap ninja files 5d365b2 Ninja: enable ninja support everywhere d569f3e Ninja: void function can't return a value 52160bf Ninja: enable ninja on Mac so all Mac CDash-builds are tested, cleanup later 56aeac6 Ninja: fixes for bcc 7a6bc9e Ninja: remove 'this' from member initializer list 44ba4cf Ninja: remove warnings 7751966 Ninja: remove 'friend' in ninja code c3988ee Re-factor OS X content generator start up. f8e0a51 Re-factor framework directory computation. f36c7b0 Re-factor Mac OS X content directory computation. 5d885db Re-factor bundle content copying rules generation. 3b2a01e Ninja: Use same echo message as makefiles. 7bb56c5 Re-factor CFBundle generation. ...
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx59
1 files changed, 48 insertions, 11 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 7805fe8..a923d60 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmSourceFile.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
+#include "cmOSXBundleGenerator.h"
#include <assert.h>
#include <algorithm>
@@ -33,7 +34,10 @@ cmNinjaNormalTargetGenerator(cmTarget* target)
, TargetNameReal()
, TargetNameImport()
, TargetNamePDB()
+ , TargetLinkLanguage(0)
{
+ cmOSXBundleGenerator::PrepareTargetProperties(target);
+
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmTarget::EXECUTABLE)
target->GetExecutableNames(this->TargetNameOut,
@@ -55,10 +59,16 @@ cmNinjaNormalTargetGenerator(cmTarget* target)
// ensure the directory exists (OutDir test)
EnsureDirectoryExists(target->GetDirectory(this->GetConfigName()));
}
+
+ this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
+ this->TargetNameOut,
+ this->GetConfigName());
+ this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator()
{
+ delete this->OSXBundleGenerator;
}
void cmNinjaNormalTargetGenerator::Generate()
@@ -115,7 +125,10 @@ const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
case cmTarget::SHARED_LIBRARY:
return "shared library";
case cmTarget::MODULE_LIBRARY:
- return "shared module";
+ if (this->GetTarget()->IsCFBundleOnApple())
+ return "CFBundle shared module";
+ else
+ return "shared module";
case cmTarget::EXECUTABLE:
return "executable";
default:
@@ -348,6 +361,40 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{
cmTarget::TargetType targetType = this->GetTarget()->GetType();
+ std::string targetOutput = ConvertToNinjaPath(
+ this->GetTarget()->GetFullPath(this->GetConfigName()).c_str());
+ std::string targetOutputReal = ConvertToNinjaPath(
+ this->GetTarget()->GetFullPath(this->GetConfigName(),
+ /*implib=*/false,
+ /*realpath=*/true).c_str());
+ std::string targetOutputImplib = ConvertToNinjaPath(
+ this->GetTarget()->GetFullPath(this->GetConfigName(),
+ /*implib=*/true).c_str());
+
+ if (this->GetTarget()->IsAppBundleOnApple())
+ {
+ // Create the app bundle
+ std::string outpath;
+ this->OSXBundleGenerator->CreateAppBundle(this->TargetNameOut, outpath);
+
+ // Calculate the output path
+ targetOutput = outpath + this->TargetNameOut;
+ targetOutput = this->ConvertToNinjaPath(targetOutput.c_str());
+ targetOutputReal = outpath + this->TargetNameReal;
+ targetOutputReal = this->ConvertToNinjaPath(targetOutputReal.c_str());
+ }
+ else if (this->GetTarget()->IsFrameworkOnApple())
+ {
+ // Create the library framework.
+ this->OSXBundleGenerator->CreateFramework(this->TargetNameOut);
+ }
+ else if(this->GetTarget()->IsCFBundleOnApple())
+ {
+ // Create the core foundation bundle.
+ std::string outpath;
+ this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, outpath);
+ }
+
// Write comments.
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
this->GetBuildFileStream()
@@ -360,16 +407,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmNinjaDeps emptyDeps;
cmNinjaVars vars;
- std::string targetOutput = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName()).c_str());
- std::string targetOutputReal = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName(),
- /*implib=*/false,
- /*realpath=*/true).c_str());
- std::string targetOutputImplib = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName(),
- /*implib=*/true).c_str());
-
// Compute the comment.
cmOStringStream comment;
comment << "Link the " << this->GetVisibleTypeName() << " "