ENH: add initial non-working XCode stuff

This commit is contained in:
Bill Hoffman 2005-01-25 15:26:57 -05:00
parent e07af61e51
commit 96daa417cb
6 changed files with 44 additions and 23 deletions

View File

@ -43,6 +43,9 @@ SET(SRCS
cmVersion.h
cmXMLParser.cxx
cmXMLParser.h
cmXCodeObject.cxx
cmLocalXCodeGenerator.cxx
cmGlobalXCodeGenerator.cxx
cmake.cxx
cmake.h
cmakewizard.cxx

View File

@ -86,6 +86,14 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype
return obj;
}
cmXCodeObject* cmGlobalXCodeGenerator::CreateString(const char* s)
{
cmXCodeObject* obj = new cmXCodeObject(cmXCodeObject::None, cmXCodeObject::STRING);
m_XCodeObjects.push_back(obj);
obj->SetString(s);
return obj;
}
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
@ -94,17 +102,17 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
delete m_RootObject;
this->ClearXCodeObjects();
cmXCodeObject* group = this->CreateObject(cmXCodeObject::None, cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", "NO");
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
cmXCodeObject* developBuildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle,
cmXCodeObject::OBJECT);
developBuildStyle->AddAttribute("name", "Development");
developBuildStyle->AddAttribute("name", this->CreateString("Development"));
developBuildStyle->AddAttribute("buildSettings", group);
group = this->CreateObject(cmXCodeObject::None, cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", "YES");
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("YES"));
cmXCodeObject* deployBuildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle,
cmXCodeObject::OBJECT);
deployBuildStyle->AddAttribute("name", "Deployment");
deployBuildStyle->AddAttribute("name", this->CreateString("Deployment"));
deployBuildStyle->AddAttribute("buildSettings", group);
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::None,
@ -117,7 +125,7 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
group = this->CreateObject(cmXCodeObject::None, cmXCodeObject::ATTRIBUTE_GROUP);
m_RootObject->AddAttribute("buildSettings", group);
m_RootObject->AddAttribute("buildSyles", listObjs);
m_RootObject->AddAttribute("hasScannedForEncodings", "0");
m_RootObject->AddAttribute("hasScannedForEncodings", this->CreateString("0"));
}

View File

@ -64,7 +64,12 @@ public:
virtual void Generate();
private:
// create cmXCodeObject from these functions so that memory can be managed
// correctly. All objects created are stored in m_XCodeObjects.
cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype, cmXCodeObject::Type type);
cmXCodeObject* CreateString(const char* s);
// delete all objects in the m_XCodeObjects vector.
void ClearXCodeObjects();
void CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);

View File

@ -18,7 +18,7 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
m_Type = type;
if(m_Type == OBJECT)
{
this->AddAttribute("isa", PBXTypeNames[m_IsA]);
this->AddAttribute("isa", 0);
}
}
@ -40,10 +40,15 @@ void cmXCodeObject::Print(std::ostream& out)
std::map<cmStdString, cmXCodeObject*>::iterator i;
for(i = m_ObjectAttributes.begin(); i != m_ObjectAttributes.end(); ++i)
{
cmXCodeObject* object = i->second;
if(object->m_Type == OBJECT_LIST)
{
cmXCodeObject::Indent(3, out);
if(i->first == "isa")
{
out << i->first << " = " << PBXTypeNames[m_IsA] << ";\n";
}
else if(object->m_Type == OBJECT_LIST)
{
out << i->first << " = {\n";
for(unsigned int k = 0; k < i->second->m_List.size(); k++)
{
@ -55,29 +60,25 @@ void cmXCodeObject::Print(std::ostream& out)
}
else if(object->m_Type == ATTRIBUTE_GROUP)
{
std::map<cmStdString, cmStdString>::iterator j;
cmXCodeObject::Indent(3, out);
std::map<cmStdString, cmXCodeObject*>::iterator j;
out << i->first << " = {\n";
for(j = object->m_StringAttributes.begin(); j != object->m_StringAttributes.end(); ++j)
for(j = object->m_ObjectAttributes.begin(); j != object->m_ObjectAttributes.end(); ++j)
{
cmXCodeObject::Indent(4, out);
out << j->first << " = " << j->second << ";\n";
out << j->first << " = " << j->second->m_String << ";\n";
}
cmXCodeObject::Indent(3, out);
out << "}\n";
}
else if(object->m_Type == OBJECT_REF)
{
cmXCodeObject::Indent(3, out);
out << i->first << " = " << object->m_Object->m_Id << ";\n";
}
}
std::map<cmStdString, cmStdString>::iterator j;
for(j = m_StringAttributes.begin(); j != m_StringAttributes.end(); ++j)
else if(object->m_Type == STRING)
{
cmXCodeObject::Indent(3, out);
out << j->first << " = " << j->second << ";\n";
out << i->first << " = " << object->m_String << ";\n";
}
}
cmXCodeObject::Indent(2, out);
out << "};\n";

View File

@ -6,7 +6,7 @@
class cmXCodeObject
{
public:
enum Type { OBJECT_LIST, ATTRIBUTE_GROUP, OBJECT_REF, OBJECT };
enum Type { OBJECT_LIST, STRING, ATTRIBUTE_GROUP, OBJECT_REF, OBJECT };
enum PBXType { PBXGroup, PBXBuildStyle, PBXProject, PBXHeadersBuildPhase,
PBXSourcesBuildPhase, PBXFrameworksBuildPhase, PBXNativeTarget,
PBXFileReference, PBXBuildFile, PBXContainerItemProxy, PBXTargetDependency,
@ -17,10 +17,11 @@ public:
static const char* PBXTypeNames[];
cmXCodeObject(PBXType ptype, Type type);
void AddAttribute(const char* name, const char* value)
void SetString(const char* s)
{
m_StringAttributes[name] = value;
m_String = s;
}
void AddAttribute(const char* name, cmXCodeObject* value)
{
m_ObjectAttributes[name] = value;
@ -45,9 +46,9 @@ private:
Type m_Type;
cmStdString m_Id;
PBXType m_IsA;
cmStdString m_String;
cmXCodeObject* m_Object;
std::vector<cmXCodeObject*> m_List;
std::map<cmStdString, cmXCodeObject*> m_ObjectAttributes;
std::map<cmStdString, cmStdString> m_StringAttributes;
};
#endif

View File

@ -50,6 +50,7 @@
#else
#endif
#include "cmGlobalUnixMakefileGenerator.h"
#include "cmGlobalXCodeGenerator.h"
#ifdef CMAKE_USE_KDEVELOP
# include "cmGlobalKdevelopGenerator.h"
@ -1443,6 +1444,8 @@ void cmake::AddDefaultGenerators()
#endif
m_Generators[cmGlobalUnixMakefileGenerator::GetActualName()] =
&cmGlobalUnixMakefileGenerator::New;
m_Generators[cmGlobalXCodeGenerator::GetActualName()] =
&cmGlobalXCodeGenerator::New;
#ifdef CMAKE_USE_KDEVELOP
m_Generators[cmGlobalKdevelopGenerator::GetActualName()] =
&cmGlobalKdevelopGenerator::New;