diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-01-28 21:00:10 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-01-28 21:00:10 (GMT) |
commit | 97cd3809706b78bd827204fe76bc91b70850c00b (patch) | |
tree | 6ae1a448c67e5ee7e280eae7591e462c30364355 | |
parent | 892a7c4fd929880d205a1e2cad05527494fc531f (diff) | |
download | CMake-97cd3809706b78bd827204fe76bc91b70850c00b.zip CMake-97cd3809706b78bd827204fe76bc91b70850c00b.tar.gz CMake-97cd3809706b78bd827204fe76bc91b70850c00b.tar.bz2 |
ENH: create mainGroup
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 33 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 7 |
2 files changed, 27 insertions, 13 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index da4a2e0..20385bf 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -100,16 +100,22 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateString(const char* s) obj->SetString(s); return obj; } +cmXCodeObject* cmGlobalXCodeGenerator::CreateObjectReference(cmXCodeObject* ref) +{ + cmXCodeObject* obj = this->CreateObject(cmXCodeObject::OBJECT_REF); + obj->SetObject(ref); + return obj; +} cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, - cmSourceFile* sf) + cmSourceFile* sf, + cmXCodeObject* mainGroupChildren) { cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); - cmXCodeObject* fileRefPtr = this->CreateObject(cmXCodeObject::OBJECT_REF); - fileRefPtr->SetObject(fileRef); + mainGroupChildren->AddObject(fileRef); cmXCodeObject* buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile); - buildFile->AddAttribute("fileRef", fileRefPtr); + buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef)); cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); buildFile->AddAttribute("settings", settings); fileRef->AddAttribute("fileEncoding", this->CreateString("4")); @@ -123,7 +129,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, - std::vector<cmXCodeObject*>& targets) + std::vector<cmXCodeObject*>& targets, + cmXCodeObject* mainGroupChildren) { cmTargets &tgts = gen->GetMakefile()->GetTargets(); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) @@ -139,7 +146,7 @@ void cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, for(std::vector<cmSourceFile*>::iterator i = classes.begin(); i != classes.end(); ++i) { - buildFiles->AddObject(this->CreateXCodeSourceFile(gen, *i)); + buildFiles->AddObject(this->CreateXCodeSourceFile(gen, *i, mainGroupChildren)); } // create header build phase cmXCodeObject* headerBuildPhase = this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); @@ -193,9 +200,7 @@ void cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, fileRef->AddAttribute("path", this->CreateString(l->first.c_str())); fileRef->AddAttribute("refType", this->CreateString("3")); fileRef->AddAttribute("sourceTree", this->CreateString("BUILT_PRODUCTS_DIR")); - cmXCodeObject* fileRefPtr = this->CreateObject(cmXCodeObject::OBJECT_REF); - fileRefPtr->SetObject(fileRef); - target->AddAttribute("productReference", fileRefPtr); + target->AddAttribute("productReference", this->CreateObjectReference(fileRef)); target->AddAttribute("productType", this->CreateString("\"com.apple.product-type.tool\"")); } else if (l->second.GetType() == cmTarget::UTILITY) @@ -229,9 +234,15 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* , listObjs->AddObject(developBuildStyle); listObjs->AddObject(deployBuildStyle); - + cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup); + cmXCodeObject* mainGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); + mainGroup->AddAttribute("children", mainGroupChildren); + mainGroup->AddAttribute("refType", this->CreateString("4")); + mainGroup->AddAttribute("sourceTree", this->CreateString("\"<group>\"")); + m_RootObject = this->CreateObject(cmXCodeObject::PBXProject); group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); + m_RootObject->AddAttribute("mainGroup", this->CreateObjectReference(mainGroup)); m_RootObject->AddAttribute("buildSettings", group); m_RootObject->AddAttribute("buildSyles", listObjs); m_RootObject->AddAttribute("hasScannedForEncodings", this->CreateString("0")); @@ -239,7 +250,7 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* , for(std::vector<cmLocalGenerator*>::iterator i = generators.begin(); i != generators.end(); ++i) { - this->CreateXCodeTargets(*i, targets); + this->CreateXCodeTargets(*i, targets, mainGroupChildren); } cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 9e477b5..73842c3 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -70,6 +70,7 @@ private: cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype); cmXCodeObject* CreateObject(cmXCodeObject::Type type); cmXCodeObject* CreateString(const char* s); + cmXCodeObject* CreateObjectReference(cmXCodeObject*); // delete all objects in the m_XCodeObjects vector. void ClearXCodeObjects(); @@ -80,8 +81,10 @@ private: void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); - cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmSourceFile* sf); - void CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&); + cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmSourceFile* sf, + cmXCodeObject* mainGroupChildren); + void CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&, + cmXCodeObject* mainGroupChildren); std::vector<cmXCodeObject*> m_XCodeObjects; cmXCodeObject* m_RootObject; |