Commit a51e1529 authored by David Cole's avatar David Cole Committed by Kitware Robot

Merge topic 'ninja-fix-macosx'

1fc8df9c Add missing this->.
7a3ecf5e Fix memory leak in Makefile generator.
9f7dc839 Ninja: also bootstrap ninja files
5d365b26 Ninja: enable ninja support everywhere
d569f3ef Ninja: void function can't return a value
52160bf6 Ninja: enable ninja on Mac so all Mac CDash-builds are tested, cleanup later
56aeac6e Ninja: fixes for bcc
7a6bc9e9 Ninja: remove 'this' from member initializer list
44ba4cfd Ninja: remove warnings
77519662 Ninja: remove 'friend' in ninja code
c3988ee8 Re-factor OS X content generator start up.
f8e0a510 Re-factor framework directory computation.
f36c7b0b Re-factor Mac OS X content directory computation.
5d885db4 Re-factor bundle content copying rules generation.
3b2a01e8 Ninja: Use same echo message as makefiles.
7bb56c51 Re-factor CFBundle generation.
...
parents c1bbdbff 1fc8df9c
......@@ -219,6 +219,8 @@ SET(SRCS
cmMakefileExecutableTargetGenerator.cxx
cmMakefileLibraryTargetGenerator.cxx
cmMakefileUtilityTargetGenerator.cxx
cmOSXBundleGenerator.cxx
cmOSXBundleGenerator.h
cmNewLineStyle.h
cmNewLineStyle.cxx
cmOrderDirectories.cxx
......@@ -357,40 +359,25 @@ IF (WIN32)
ENDIF(NOT UNIX)
ENDIF (WIN32)
# Turn on Ninja by default, but disable it
# on platforms where it does not pass all tests.
# Enforce Ninja support by setting CMAKE_USE_NINJA
set(_CMAKE_DEFAULT_NINJA_VALUE TRUE)
if(APPLE)
SET(_CMAKE_DEFAULT_NINJA_VALUE FALSE)
endif()
SET(CMAKE_ENABLE_NINJA ${_CMAKE_DEFAULT_NINJA_VALUE} CACHE BOOL
"Enable the ninja generator for CMake. When enabled, some CMake tests still fail on OSX")
MARK_AS_ADVANCED(CMAKE_ENABLE_NINJA)
IF(CMAKE_ENABLE_NINJA)
MESSAGE(STATUS "Ninja generator enabled.")
SET(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx
cmGlobalNinjaGenerator.h
cmNinjaTypes.h
cmLocalNinjaGenerator.cxx
cmLocalNinjaGenerator.h
cmNinjaTargetGenerator.cxx
cmNinjaTargetGenerator.h
cmNinjaNormalTargetGenerator.cxx
cmNinjaNormalTargetGenerator.h
cmNinjaUtilityTargetGenerator.cxx
cmNinjaUtilityTargetGenerator.h
)
ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
IF(WIN32 AND NOT CYGWIN AND NOT BORLAND)
SET_SOURCE_FILES_PROPERTIES(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
ADD_EXECUTABLE(cmcldeps cmcldeps.cxx)
TARGET_LINK_LIBRARIES(cmcldeps CMakeLib)
INSTALL_TARGETS(/bin cmcldeps)
ENDIF()
ELSE()
MESSAGE(STATUS "Ninja generator disabled, enable it with -DCMAKE_ENABLE_NINJA=ON")
# Ninja support
SET(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx
cmGlobalNinjaGenerator.h
cmNinjaTypes.h
cmLocalNinjaGenerator.cxx
cmLocalNinjaGenerator.h
cmNinjaTargetGenerator.cxx
cmNinjaTargetGenerator.h
cmNinjaNormalTargetGenerator.cxx
cmNinjaNormalTargetGenerator.h
cmNinjaUtilityTargetGenerator.cxx
cmNinjaUtilityTargetGenerator.h
)
IF(WIN32 AND NOT CYGWIN AND NOT BORLAND)
SET_SOURCE_FILES_PROPERTIES(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
ADD_EXECUTABLE(cmcldeps cmcldeps.cxx)
TARGET_LINK_LIBRARIES(cmcldeps CMakeLib)
INSTALL_TARGETS(/bin cmcldeps)
ENDIF()
# create a library used by the command line and the GUI
......
......@@ -36,14 +36,14 @@ ELSE(NOT QT4_FOUND)
QMacInstallDialog.cxx
QMacInstallDialog.h
)
QT4_WRAP_UI(UI_SRCS
QT4_WRAP_UI(UI_SRCS
CMakeSetupDialog.ui
Compilers.ui
CrossCompiler.ui
AddCacheEntry.ui
MacInstallDialog.ui
)
QT4_WRAP_CPP(MOC_SRCS
QT4_WRAP_CPP(MOC_SRCS
AddCacheEntry.h
Compilers.h
CMakeSetupDialog.h
......@@ -76,7 +76,7 @@ ELSE(NOT QT4_FOUND)
SET_TARGET_PROPERTIES(cmake-gui PROPERTIES
OUTPUT_NAME ${CMAKE_BUNDLE_NAME})
ENDIF(APPLE)
SET(CMAKE_INSTALL_DESTINATION_ARGS
SET(CMAKE_INSTALL_DESTINATION_ARGS
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}")
ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
......@@ -112,11 +112,12 @@ ELSE(NOT QT4_FOUND)
endif(APPLE)
install(CODE "
include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
")
endif(APPLE OR WIN32)
CONFIGURE_FILE("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in"
"${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY)
"${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY)
ENDIF(NOT QT4_FOUND)
......@@ -60,9 +60,7 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
// disable until somebody actually tests it:
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
#ifdef CMAKE_USE_NINJA
this->SupportedGlobalGenerators.push_back("Ninja");
#endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
}
......
......@@ -34,9 +34,7 @@ cmExtraEclipseCDT4Generator
this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
#ifdef CMAKE_USE_NINJA
this->SupportedGlobalGenerators.push_back("Ninja");
#endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
this->SupportsVirtualFolders = true;
......
......@@ -252,6 +252,48 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
vars);
}
void
cmGlobalNinjaGenerator::AddMacOSXContentRule()
{
cmLocalGenerator *lg = this->LocalGenerators[0];
cmMakefile* mfRoot = lg->GetMakefile();
cmOStringStream cmd;
cmd << lg->ConvertToOutputFormat(
mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
cmLocalGenerator::SHELL)
<< " -E copy $in $out";
this->AddRule("COPY_OSX_CONTENT",
cmd.str(),
"Copying OS X Content $out",
"Rule for copying OS X bundle content file."
/*depfile*/ "",
/*rspfile*/ "");
}
void
cmGlobalNinjaGenerator::WriteMacOSXContentBuild(const std::string& input,
const std::string& output)
{
this->AddMacOSXContentRule();
cmNinjaDeps outputs;
outputs.push_back(output);
cmNinjaDeps deps;
deps.push_back(input);
cmNinjaVars vars;
cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,
"",
"COPY_OSX_CONTENT",
outputs,
deps,
cmNinjaDeps(),
cmNinjaDeps(),
cmNinjaVars());
}
void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
const std::string& name,
const std::string& command,
......@@ -781,6 +823,11 @@ void cmGlobalNinjaGenerator::AddDependencyToAll(cmTarget* target)
this->AppendTargetOutputs(target, this->AllDependencies);
}
void cmGlobalNinjaGenerator::AddDependencyToAll(const std::string& input)
{
this->AllDependencies.push_back(input);
}
void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
{
for (std::map<std::string, std::set<std::string> >::iterator
......
......@@ -103,6 +103,8 @@ public:
const cmNinjaDeps& outputs,
const cmNinjaDeps& deps = cmNinjaDeps(),
const cmNinjaDeps& orderOnlyDeps = cmNinjaDeps());
void WriteMacOSXContentBuild(const std::string& input,
const std::string& output);
/**
* Write a rule statement named @a name to @a os with the @a comment,
......@@ -151,6 +153,7 @@ public:
static bool IsMinGW() { return UsingMinGW; }
public:
/// Default constructor.
cmGlobalNinjaGenerator();
......@@ -214,12 +217,12 @@ public:
}
virtual const char* GetCleanTargetName() const { return "clean"; }
public:
cmGeneratedFileStream* GetBuildFileStream() const
{ return this->BuildFileStream; }
cmGeneratedFileStream* GetRulesFileStream() const
{ return this->RulesFileStream; }
cmGeneratedFileStream* GetBuildFileStream() const {
return this->BuildFileStream; }
cmGeneratedFileStream* GetRulesFileStream() const {
return this->RulesFileStream; }
void AddCXXCompileCommand(const std::string &commandLine,
const std::string &sourceFile);
......@@ -242,6 +245,52 @@ public:
bool HasRule(const std::string& name);
void AddCustomCommandRule();
void AddMacOSXContentRule();
bool HasCustomCommandOutput(const std::string &output) {
return this->CustomCommandOutputs.find(output) !=
this->CustomCommandOutputs.end();
}
/// Called when we have seen the given custom command. Returns true
/// if we has seen it before.
bool SeenCustomCommand(cmCustomCommand const *cc) {
return !this->CustomCommands.insert(cc).second;
}
/// Called when we have seen the given custom command output.
void SeenCustomCommandOutput(const std::string &output) {
this->CustomCommandOutputs.insert(output);
// We don't need the assumed dependencies anymore, because we have
// an output.
this->AssumedSourceDependencies.erase(output);
}
void AddAssumedSourceDependencies(const std::string &source,
const cmNinjaDeps &deps) {
std::set<std::string> &ASD = this->AssumedSourceDependencies[source];
// Because we may see the same source file multiple times (same source
// specified in multiple targets), compute the union of any assumed
// dependencies.
ASD.insert(deps.begin(), deps.end());
}
void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs);
void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs);
void AddDependencyToAll(cmTarget* target);
void AddDependencyToAll(const std::string& input);
const std::vector<cmLocalGenerator*>& GetLocalGenerators() const {
return LocalGenerators; }
bool IsExcluded(cmLocalGenerator* root, cmTarget& target) {
return cmGlobalGenerator::IsExcluded(root, target); }
int GetRuleCmdLength(const std::string& name) {
return RuleCmdLength[name]; }
void AddTargetAlias(const std::string& alias, cmTarget* target);
protected:
......@@ -249,21 +298,12 @@ protected:
/// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
private:
/// @see cmGlobalGenerator::ComputeTargetObjects
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
private:
// In order to access the AddDependencyToAll() functions and co.
friend class cmLocalNinjaGenerator;
// In order to access the SeenCustomCommand() function.
friend class cmNinjaTargetGenerator;
friend class cmNinjaNormalTargetGenerator;
friend class cmNinjaUtilityTargetGenerator;
private:
void OpenBuildFileStream();
void CloseBuildFileStream();
......@@ -275,14 +315,8 @@ private:
/// Write the common disclaimer text at the top of each build file.
void WriteDisclaimer(std::ostream& os);
void AddDependencyToAll(cmTarget* target);
void WriteAssumedSourceDependencies();
void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs);
void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs);
void AddTargetAlias(const std::string& alias, cmTarget* target);
void WriteTargetAliases(std::ostream& os);
void WriteBuiltinTargets(std::ostream& os);
......@@ -291,39 +325,9 @@ private:
void WriteTargetClean(std::ostream& os);
void WriteTargetHelp(std::ostream& os);
/// Called when we have seen the given custom command. Returns true
/// if we has seen it before.
bool SeenCustomCommand(cmCustomCommand const *cc) {
return !this->CustomCommands.insert(cc).second;
}
/// Called when we have seen the given custom command output.
void SeenCustomCommandOutput(const std::string &output) {
this->CustomCommandOutputs.insert(output);
// We don't need the assumed dependencies anymore, because we have
// an output.
this->AssumedSourceDependencies.erase(output);
}
bool HasCustomCommandOutput(const std::string &output) {
return this->CustomCommandOutputs.find(output) !=
this->CustomCommandOutputs.end();
}
void AddAssumedSourceDependencies(const std::string &source,
const cmNinjaDeps &deps) {
std::set<std::string> &ASD = this->AssumedSourceDependencies[source];
// Because we may see the same source file multiple times (same source
// specified in multiple targets), compute the union of any assumed
// dependencies.
ASD.insert(deps.begin(), deps.end());
}
std::string ninjaCmd() const;
int GetRuleCmdLength(const std::string& name) { return RuleCmdLength[name]; }
private:
/// The file containing the build statement. (the relation ship of the
/// compilation DAG).
cmGeneratedFileStream* BuildFileStream;
......
......@@ -61,7 +61,7 @@ void cmLocalNinjaGenerator::Generate()
tg->Generate();
// Add the target to "all" if required.
if (!this->GetGlobalNinjaGenerator()->IsExcluded(
this->GetGlobalNinjaGenerator()->LocalGenerators[0],
this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0],
t->second))
this->GetGlobalNinjaGenerator()->AddDependencyToAll(&t->second);
delete tg;
......
......@@ -45,7 +45,6 @@ public:
/// Overloaded methods. @see cmLocalGenerator::GetTargetDirectory()
virtual std::string GetTargetDirectory(cmTarget const& target) const;
public:
const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const;
cmGlobalNinjaGenerator* GetGlobalNinjaGenerator();
......@@ -67,33 +66,8 @@ public:
std::string GetHomeRelativeOutputPath() const
{ return this->HomeRelativeOutputPath; }
protected:
virtual std::string ConvertToLinkReference(std::string const& lib);
virtual std::string ConvertToIncludeReference(std::string const& path);
private:
friend class cmGlobalNinjaGenerator;
// In order to access to protected member of the local generator.
friend class cmNinjaTargetGenerator;
friend class cmNinjaNormalTargetGenerator;
friend class cmNinjaUtilityTargetGenerator;
private:
cmGeneratedFileStream& GetBuildFileStream() const;
cmGeneratedFileStream& GetRulesFileStream() const;
void WriteBuildFileTop();
void WriteProjectHeader(std::ostream& os);
void WriteNinjaFilesInclusion(std::ostream& os);
void WriteProcessedMakefile(std::ostream& os);
void SetConfigName();
std::string ConvertToNinjaPath(const char *path);
struct map_to_ninja_path;
friend struct map_to_ninja_path;
struct map_to_ninja_path {
cmLocalNinjaGenerator *LocalGenerator;
map_to_ninja_path(cmLocalNinjaGenerator *LocalGen)
......@@ -102,26 +76,52 @@ private:
return LocalGenerator->ConvertToNinjaPath(path.c_str());
}
};
map_to_ninja_path MapToNinjaPath() {
return map_to_ninja_path(this);
}
void ExpandRuleVariables(std::string& string,
const RuleVariables& replaceValues) {
cmLocalGenerator::ExpandRuleVariables(string, replaceValues);
}
std::string BuildCommandLine(const std::vector<std::string> &cmdLines);
void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs);
void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs);
void AppendCustomCommandDeps(const cmCustomCommand *cc,
cmNinjaDeps &ninjaDeps);
std::string BuildCommandLine(const std::vector<std::string> &cmdLines);
void AddCustomCommandTarget(cmCustomCommand const* cc, cmTarget* target);
void AppendCustomCommandLines(const cmCustomCommand *cc,
std::vector<std::string> &cmdLines);
void AppendCustomCommandDeps(const cmCustomCommand *cc,
cmNinjaDeps &ninjaDeps);
virtual std::string ConvertToLinkReference(std::string const& lib);
protected:
virtual std::string ConvertToIncludeReference(std::string const& path);
private:
cmGeneratedFileStream& GetBuildFileStream() const;
cmGeneratedFileStream& GetRulesFileStream() const;
void WriteBuildFileTop();
void WriteProjectHeader(std::ostream& os);
void WriteNinjaFilesInclusion(std::ostream& os);
void WriteProcessedMakefile(std::ostream& os);
void SetConfigName();
void WriteCustomCommandRule();
void WriteCustomCommandBuildStatement(cmCustomCommand const *cc,
const cmNinjaDeps& orderOnlyDeps);
void AddCustomCommandTarget(cmCustomCommand const* cc, cmTarget* target);
void WriteCustomCommandBuildStatements();
private:
std::string ConfigName;
std::string HomeRelativeOutputPath;
......
......@@ -29,13 +29,19 @@ cmMakefileExecutableTargetGenerator
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, this->ConfigName);
if(this->Target->IsAppBundleOnApple())
{
this->MacContentDirectory = this->Target->GetDirectory(this->ConfigName);
this->MacContentDirectory += "/";
this->MacContentDirectory += this->TargetNameOut;
this->MacContentDirectory += ".app/Contents/";
}
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target,
this->TargetNameOut,
this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
this->MacContentDirectory =
this->OSXBundleGenerator->GetMacContentDirectory();
}
//----------------------------------------------------------------------------
cmMakefileExecutableTargetGenerator
::~cmMakefileExecutableTargetGenerator()
{
delete this->OSXBundleGenerator;
}
//----------------------------------------------------------------------------
......@@ -100,7 +106,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
outpath += "/";
if(this->Target->IsAppBundleOnApple())
{
this->CreateAppBundle(targetName, outpath);
this->OSXBundleGenerator->CreateAppBundle(targetName, outpath);
}
std::string outpathImp;
if(relink)
......@@ -129,7 +135,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathPDB = outpath + targetNamePDB;
std::string targetFullPathImport = outpathImp + targetNameImport;
std::string targetOutPathPDB =
std::string targetOutPathPDB =
this->Convert(targetFullPathPDB.c_str(),
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
......@@ -440,24 +446,3 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
exeCleanFiles.begin(),
exeCleanFiles.end());
}
//----------------------------------------------------------------------------
void
cmMakefileExecutableTargetGenerator::CreateAppBundle(std::string& targetName,
std::string& outpath)
{
// Compute bundle directory names.
outpath = this->MacContentDirectory;
outpath += "MacOS";
cmSystemTools::MakeDirectory(outpath.c_str());
this->Makefile->AddCMakeOutputFile(outpath.c_str());
outpath += "/";
// Configure the Info.plist file. Note that it needs the executable name
// to be set.
std::string plist = this->MacContentDirectory + "Info.plist";
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
targetName.c_str(),
plist.c_str());
this->Makefile->AddCMakeOutputFile(plist.c_str());
}
......@@ -18,14 +18,14 @@ class cmMakefileExecutableTargetGenerator: public cmMakefileTargetGenerator
{
public:
cmMakefileExecutableTargetGenerator(cmTarget* target);
virtual ~cmMakefileExecutableTargetGenerator();
/* the main entry point for this class. Writes the Makefiles associated
with this target */
virtual void WriteRuleFiles();
protected:
virtual void WriteExecutableRule(bool relink);
void CreateAppBundle(std::string& targetName, std::string& outpath);
};
#endif
......@@ -26,41 +26,26 @@ cmMakefileLibraryTargetGenerator
::cmMakefileLibraryTargetGenerator(cmTarget* target):
cmMakefileTargetGenerator(target)
{
if(this->Target->IsCFBundleOnApple())
{
target->SetProperty("PREFIX", "");
target->SetProperty("SUFFIX", "");
}
cmOSXBundleGenerator::PrepareTargetProperties(this->Target);
this->CustomCommandDriver = OnDepends;
this->Target->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
if(this->Target->IsFrameworkOnApple())
{
this->FrameworkVersion = this->Target->GetFrameworkVersion();
this->MacContentDirectory = this->Target->GetDirectory(this->ConfigName);
this->MacContentDirectory += "/";
this->MacContentDirectory += this->TargetNameOut;
this->MacContentDirectory += ".framework/Versions/";
this->MacContentDirectory += this->FrameworkVersion;
this->MacContentDirectory += "/";
}
else if(this->Target->IsCFBundleOnApple())
{
this->MacContentDirectory = this->Target->GetDirectory(this->ConfigName);
this->MacContentDirectory += "/";
this->MacContentDirectory += this->TargetNameOut;
this->MacContentDirectory += ".";
const char *ext = this->Target->GetProperty("BUNDLE_EXTENSION");
if (!ext)
{
ext = "bundle";
}
this->MacContentDirectory += ext;
this->MacContentDirectory += "/Contents/";
}
this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target,
this->TargetNameOut,
this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
this->MacContentDirectory =
this->OSXBundleGenerator->GetMacContentDirectory();
}
//----------------------------------------------------------------------------
cmMakefileLibraryTargetGenerator
::~cmMakefileLibraryTargetGenerator()
{
delete this->OSXBundleGenerator;
}
//----------------------------------------------------------------------------
......@@ -199,7 +184,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
this->LocalGenerator->AddConfigVariableFlags
(extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
this->AddModuleDefinitionFlag(extraFlags);
......@@ -220,7 +205,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
linkRuleVar += "_CREATE_SHARED_MODULE";
std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags,
this->LocalGenerator->AppendFlags(extraFlags,
this->Target->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
......@@ -246,7 +231,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
linkRuleVar += "_CREATE_MACOSX_FRAMEWORK";
std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags,
this->LocalGenerator->AppendFlags(extraFlags,
this->Target->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
......@@ -258,115 +243,6 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
}
//----------------------------------------------------------------------------
void
cmMakefileLibraryTargetGenerator
::CreateFramework(std::string const& targetName)
{
// Configure the Info.plist file into the Resources directory.
this->MacContentFolders.insert("Resources");
std::string plist = this->MacContentDirectory + "Resources/Info.plist";
this->LocalGenerator->GenerateFrameworkInfoPList(this->Target,
targetName.c_str(),
plist.c_str());
// TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
// drive rules to create these files at build time.
std::string oldName;
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
std::string versions = top;
versions += "Versions";
cmSystemTools::MakeDirectory(versions.c_str());
// Make foo.framework/Versions/version
std::string version = versions;
version += "/";
version += this->FrameworkVersion;
cmSystemTools::MakeDirectory(version.c_str());
// Current -> version
oldName = this->FrameworkVersion;
newName = versions;
newName += "/Current";
cmSystemTools::RemoveFile(newName.c_str());
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
this->Makefile->AddCMakeOutputFile(newName.c_str());
// foo -> Versions/Current/foo
oldName = "Versions/Current/";
oldName += this->TargetNameOut;
newName = top;
newName += this->TargetNameOut;
cmSystemTools::RemoveFile(newName.c_str());
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
this->Makefile->AddCMakeOutputFile(newName.c_str());
// Resources -> Versions/Current/Resources
if(this->MacContentFolders.find("Resources") !=
this->MacContentFolders.end())
{
oldName = "Versions/Current/Resources";
newName = top;
newName += "Resources";
cmSystemTools::RemoveFile(newName.c_str());
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
this->Makefile->AddCMakeOutputFile(newName.c_str());
}
// Headers -> Versions/Current/Headers
if(this->MacContentFolders.find("Headers") !=
this->MacContentFolders.end())
{
oldName = "Versions/Current/Headers";
newName = top;
newName += "Headers";
cmSystemTools::RemoveFile(newName.c_str());
cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str());
this->Makefile->AddCMakeOutputFile(newName.c_str());
}
// PrivateHeaders -> Versions/Current/PrivateHeaders
if(this->MacContentFolders.find("PrivateHeaders") !=
this->MacContentFolders.end<