Commit fa61182d authored by David Cole's avatar David Cole

ENH: Improvements to the Xcode generator. Build frameworks using native Copy...

ENH: Improvements to the Xcode generator. Build frameworks using native Copy Headers and Copy Bundle Resources phases. Fix bugs: eliminate folders with no names, ensure source files show up in multiple targets, remove empty utility targets from Sources subtrees, ensure that fileRefs only show up once in each grouping folder.
parent f13c3eef
......@@ -17,6 +17,7 @@
#include "cmGlobalXCode21Generator.h"
#include "cmXCode21Object.h"
//----------------------------------------------------------------------------
cmGlobalXCode21Generator::cmGlobalXCode21Generator()
{
this->XcodeVersion = 21;
......
This diff is collapsed.
......@@ -65,9 +65,6 @@ public:
const char* config,
bool ignoreErrors,
bool fast);
// add extra build phases for a framework target
void AddFrameworkPhases(cmTarget*, cmXCodeObject* buildPhases);
/**
* Generate the all required files for building this project/tree. This
......@@ -101,9 +98,11 @@ private:
void CreateCustomCommands(cmXCodeObject* buildPhases,
cmXCodeObject* sourceBuildPhase,
cmXCodeObject* headerBuildPhase,
cmXCodeObject* resourceBuildPhase,
std::vector<cmXCodeObject*> contentBuildPhases,
cmXCodeObject* frameworkBuildPhase,
cmTarget& cmtarget);
void AddCommandsToBuildPhase(cmXCodeObject* buildphase,
cmTarget& target,
std::vector<cmCustomCommand>
......@@ -184,6 +183,7 @@ protected:
private:
cmXCodeObject* MainGroupChildren;
cmXCodeObject* SourcesGroupChildren;
cmXCodeObject* ResourcesGroupChildren;
cmMakefile* CurrentMakefile;
cmLocalGenerator* CurrentLocalGenerator;
std::vector<std::string> CurrentConfigurationTypes;
......@@ -193,9 +193,10 @@ private:
std::set<cmStdString> TargetDoneSet;
std::vector<std::string> CurrentOutputDirectoryComponents;
std::vector<std::string> ProjectOutputDirectoryComponents;
std::map<cmSourceFile*, cmXCodeObject* > GroupMap;
std::map<cmStdString, cmXCodeObject* > GroupMap;
std::map<cmStdString, cmXCodeObject* > GroupNameMap;
std::map<cmStdString, cmXCodeObject* > TargetGroup;
std::map<cmStdString, cmXCodeObject* > FileRefs;
std::vector<std::string> Architectures;
};
......
......@@ -1704,19 +1704,26 @@ cmLocalUnixMakefileGenerator3
target.GetExecutableNames(targetName, targetNameReal, targetNameImport,
targetNamePDB, this->ConfigurationName.c_str());
std::string obj;
// Construct the full path version of the names.
//
// If target is a MACOSX_BUNDLE target, then the package location is
// relative to "${targetDir}/${targetName}.app/Contents"... else it is
// relative to "${targetDir}"...
//
obj = target.GetDirectory();
obj += "/";
if ( target.GetPropertyAsBool("MACOSX_BUNDLE") )
{
// Construct the full path version of the names.
obj = target.GetDirectory();
obj += "/";
obj += targetName + ".app/Contents/";
obj += fileTargetDirectory;
}
else
{
// Framework not handled yet
abort();
// Emit warning here...? MACOSX_PACKAGE_LOCATION is "most useful" in a
// MACOSX_BUNDLE...
}
obj += fileTargetDirectory;
obj = cmSystemTools::RelativePath
(this->Makefile->GetHomeOutputDirectory(), obj.c_str());
obj += "/";
......
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "cmLocalXCodeGenerator.h"
#include "cmGlobalXCodeGenerator.h"
#include "cmSourceFile.h"
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator()
{
// the global generator does this, so do not
......@@ -9,10 +26,12 @@ cmLocalXCodeGenerator::cmLocalXCodeGenerator()
this->EmitUniversalBinaryFlags = false;
}
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::~cmLocalXCodeGenerator()
{
}
//----------------------------------------------------------------------------
std::string
cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const
{
......@@ -20,6 +39,7 @@ cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const
return "";
}
//----------------------------------------------------------------------------
void cmLocalXCodeGenerator::
GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
......
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "cmXCode21Object.h"
#include "cmSystemTools.h"
//----------------------------------------------------------------------------
cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
:cmXCodeObject(ptype, type)
{
......@@ -24,7 +41,7 @@ void cmXCode21Object::PrintComment(std::ostream& out)
out << " */";
}
//----------------------------------------------------------------------------
void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
std::ostream& out, PBXType t)
{
......@@ -56,6 +73,7 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
out << "/* End " << PBXTypeNames[t] << " section */\n";
}
//----------------------------------------------------------------------------
void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
std::ostream& out)
{
......
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef cmXCode21Object_h
#define cmXCode21Object_h
......
......@@ -17,6 +17,7 @@
#include "cmXCodeObject.h"
#include "cmSystemTools.h"
//----------------------------------------------------------------------------
const char* cmXCodeObject::PBXTypeNames[] = {
"PBXGroup", "PBXBuildStyle", "PBXProject", "PBXHeadersBuildPhase",
"PBXSourcesBuildPhase", "PBXFrameworksBuildPhase", "PBXNativeTarget",
......@@ -30,12 +31,12 @@ const char* cmXCodeObject::PBXTypeNames[] = {
"None"
};
//----------------------------------------------------------------------------
cmXCodeObject::~cmXCodeObject()
{
this->Version = 15;
}
//----------------------------------------------------------------------------
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
{
......@@ -143,7 +144,33 @@ void cmXCodeObject::Print(std::ostream& out)
object->ObjectAttributes.end(); ++j)
{
cmXCodeObject::Indent(4 *indentFactor, out);
out << j->first << " = " << j->second->String << ";";
if(j->second->TypeValue == STRING)
{
out << j->first << " = " << j->second->String << ";";
}
else if(j->second->TypeValue == OBJECT_LIST)
{
out << j->first << " = (";
for(unsigned int k = 0; k < j->second->List.size(); k++)
{
if(j->second->List[k]->TypeValue == STRING)
{
out << j->second->List[k]->String << ", ";
}
else
{
out << "List_" << k << "_TypeValue_IS_NOT_STRING, ";
}
}
out << ");";
}
else
{
out << j->first << " = error_unexpected_TypeValue_" <<
j->second->TypeValue << ";";
}
out << separator;
}
cmXCodeObject::Indent(3 *indentFactor, out);
......@@ -189,7 +216,7 @@ void cmXCodeObject::PrintList(std::vector<cmXCodeObject*> const& objs,
out << "};\n";
}
//----------------------------------------------------------------------------
void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
{
this->ObjectAttributes = copy->ObjectAttributes;
......@@ -198,6 +225,7 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
this->Object = copy->Object;
}
//----------------------------------------------------------------------------
void cmXCodeObject::SetString(const char* s)
{
std::string ss = s;
......
project(Framework)
add_library(foo SHARED foo.cxx foo.h)
add_library(foo SHARED
foo.cxx
foo.h
foo2.h
fooPublic.h
fooPrivate.h
fooNeither.h
fooBoth.h
test.lua
)
set_target_properties(foo PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_PUBLIC_HEADERS "foo.h;foo2.h"
FRAMEWORK_VERSION ver2
FRAMEWORK_RESOURCES "test.lua"
FRAMEWORK_VERSION ver3
)
# fooNeither.h is marked neither public nor private...
# fooBoth.h is marked both public and private... (private wins...)
set_source_files_properties(foo.h foo2.h fooPublic.h fooBoth.h PROPERTIES
FRAMEWORK_PUBLIC_HEADER TRUE
)
set_source_files_properties(fooPrivate.h fooBoth.h PROPERTIES
FRAMEWORK_PRIVATE_HEADER TRUE
)
set_source_files_properties(test.lua PROPERTIES
FRAMEWORK_RESOURCE TRUE
)
add_executable(bar bar.cxx)
target_link_libraries(bar foo)
......@@ -16,12 +34,19 @@ target_link_libraries(bar foo)
# a framework... The framework properties only apply when the library type
# is SHARED.
#
add_library(fooStatic STATIC foo.cxx foo.h)
add_library(fooStatic STATIC
foo.cxx
foo.h
foo2.h
fooPublic.h
fooPrivate.h
fooNeither.h
fooBoth.h
test.lua
)
set_target_properties(fooStatic PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_PUBLIC_HEADERS "foo.h;foo2.h"
FRAMEWORK_VERSION ver2
FRAMEWORK_RESOURCES "test.lua"
FRAMEWORK_VERSION none
)
add_executable(barStatic bar.cxx)
target_link_libraries(barStatic fooStatic)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment