ENH: fixes for xcode21 and build styles and comments in the generated project
This commit is contained in:
parent
7a1745b84b
commit
8b7091a0a6
@ -462,11 +462,20 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
|
|||||||
lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS"));
|
lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS"));
|
||||||
|
|
||||||
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
|
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
|
||||||
|
|
||||||
cmXCodeObject* group = m_GroupMap[sf];
|
cmXCodeObject* group = m_GroupMap[sf];
|
||||||
cmXCodeObject* children = group->GetObject("children");
|
cmXCodeObject* children = group->GetObject("children");
|
||||||
children->AddObject(fileRef);
|
children->AddObject(fileRef);
|
||||||
// m_SourcesGroupChildren->AddObject(fileRef);
|
|
||||||
cmXCodeObject* buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
|
cmXCodeObject* buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
|
||||||
|
std::string fname = sf->GetSourceName();
|
||||||
|
fname += ".";
|
||||||
|
fname += sf->GetSourceExtension();
|
||||||
|
std::string comment = fname;
|
||||||
|
comment += " in ";
|
||||||
|
std::string gname = group->GetObject("name")->GetString();
|
||||||
|
comment += gname.substr(1, gname.size()-2);
|
||||||
|
buildFile->SetComment(comment.c_str());
|
||||||
|
fileRef->SetComment(fname.c_str());
|
||||||
buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef));
|
buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef));
|
||||||
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
||||||
settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str()));
|
settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str()));
|
||||||
@ -518,7 +527,10 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
|
|||||||
|
|
||||||
fileRef->AddAttribute("name", this->CreateString(file.c_str()));
|
fileRef->AddAttribute("name", this->CreateString(file.c_str()));
|
||||||
fileRef->AddAttribute("path", this->CreateString(path.c_str()));
|
fileRef->AddAttribute("path", this->CreateString(path.c_str()));
|
||||||
fileRef->AddAttribute("refType", this->CreateString("4"));
|
if(m_XcodeVersion == 15)
|
||||||
|
{
|
||||||
|
fileRef->AddAttribute("refType", this->CreateString("4"));
|
||||||
|
}
|
||||||
if(path.size() > 1 && path[0] == '.' && path[1] == '.')
|
if(path.size() > 1 && path[0] == '.' && path[1] == '.')
|
||||||
{
|
{
|
||||||
fileRef->AddAttribute("sourceTree", this->CreateString("<group>"));
|
fileRef->AddAttribute("sourceTree", this->CreateString("<group>"));
|
||||||
@ -590,6 +602,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase);
|
this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase);
|
||||||
sourceBuildPhase->AddAttribute("buildActionMask",
|
sourceBuildPhase->AddAttribute("buildActionMask",
|
||||||
this->CreateString("2147483647"));
|
this->CreateString("2147483647"));
|
||||||
|
sourceBuildPhase->SetComment("Sources");
|
||||||
cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
sourceBuildPhase->AddAttribute("files", buildFiles);
|
sourceBuildPhase->AddAttribute("files", buildFiles);
|
||||||
sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
||||||
@ -621,6 +634,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
// create header build phase
|
// create header build phase
|
||||||
cmXCodeObject* headerBuildPhase =
|
cmXCodeObject* headerBuildPhase =
|
||||||
this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase);
|
this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase);
|
||||||
|
headerBuildPhase->SetComment("Headers");
|
||||||
headerBuildPhase->AddAttribute("buildActionMask",
|
headerBuildPhase->AddAttribute("buildActionMask",
|
||||||
this->CreateString("2147483647"));
|
this->CreateString("2147483647"));
|
||||||
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
@ -636,6 +650,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||||||
// create framework build phase
|
// create framework build phase
|
||||||
cmXCodeObject* frameworkBuildPhase =
|
cmXCodeObject* frameworkBuildPhase =
|
||||||
this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase);
|
this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase);
|
||||||
|
frameworkBuildPhase->SetComment("Frameworks");
|
||||||
frameworkBuildPhase->AddAttribute("buildActionMask",
|
frameworkBuildPhase->AddAttribute("buildActionMask",
|
||||||
this->CreateString("2147483647"));
|
this->CreateString("2147483647"));
|
||||||
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
@ -1235,6 +1250,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
|
|||||||
"# shell script goes here\nexit 0"));
|
"# shell script goes here\nexit 0"));
|
||||||
cmXCodeObject* target =
|
cmXCodeObject* target =
|
||||||
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
|
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
|
||||||
|
target->SetComment(cmtarget.GetName());
|
||||||
cmXCodeObject* buildPhases =
|
cmXCodeObject* buildPhases =
|
||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
this->CreateCustomCommands(buildPhases, 0, 0, 0, cmtarget);
|
this->CreateCustomCommands(buildPhases, 0, 0, 0, cmtarget);
|
||||||
@ -1269,11 +1285,16 @@ void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
|
|||||||
std::vector<std::string> configVector;
|
std::vector<std::string> configVector;
|
||||||
configVectorIn.push_back(configTypes);
|
configVectorIn.push_back(configTypes);
|
||||||
cmSystemTools::ExpandList(configVectorIn, configVector);
|
cmSystemTools::ExpandList(configVectorIn, configVector);
|
||||||
configVector.push_back("Default");
|
|
||||||
cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList);
|
cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList);
|
||||||
cmXCodeObject* buildConfigurations =
|
cmXCodeObject* buildConfigurations =
|
||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
configlist->AddAttribute("buildConfigurations", buildConfigurations);
|
configlist->AddAttribute("buildConfigurations", buildConfigurations);
|
||||||
|
std::string comment = "Build configuration list for ";
|
||||||
|
comment += cmXCodeObject::PBXTypeNames[target->GetIsA()];
|
||||||
|
comment += " \"";
|
||||||
|
comment += cmtarget.GetName();
|
||||||
|
comment += "\"";
|
||||||
|
configlist->SetComment(comment.c_str());
|
||||||
target->AddAttribute("buildConfigurationList",
|
target->AddAttribute("buildConfigurationList",
|
||||||
this->CreateObjectReference(configlist));
|
this->CreateObjectReference(configlist));
|
||||||
for(unsigned int i = 0; i < configVector.size(); ++i)
|
for(unsigned int i = 0; i < configVector.size(); ++i)
|
||||||
@ -1290,8 +1311,15 @@ void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
|
|||||||
buildSettings, fileTypeString,
|
buildSettings, fileTypeString,
|
||||||
productTypeString, productName, buildtype.c_str());
|
productTypeString, productName, buildtype.c_str());
|
||||||
config->AddAttribute("name", this->CreateString(configVector[i].c_str()));
|
config->AddAttribute("name", this->CreateString(configVector[i].c_str()));
|
||||||
|
config->SetComment(configVector[i].c_str());
|
||||||
config->AddAttribute("buildSettings", buildSettings);
|
config->AddAttribute("buildSettings", buildSettings);
|
||||||
}
|
}
|
||||||
|
if(configVector.size())
|
||||||
|
{
|
||||||
|
configlist->AddAttribute("defaultConfigurationName",
|
||||||
|
this->CreateString(configVector[0].c_str()));
|
||||||
|
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -1329,7 +1357,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
|
|||||||
fileRef->AddAttribute("refType", this->CreateString("0"));
|
fileRef->AddAttribute("refType", this->CreateString("0"));
|
||||||
fileRef->AddAttribute("sourceTree",
|
fileRef->AddAttribute("sourceTree",
|
||||||
this->CreateString("BUILT_PRODUCTS_DIR"));
|
this->CreateString("BUILT_PRODUCTS_DIR"));
|
||||||
|
fileRef->SetComment(cmtarget.GetName());
|
||||||
target->AddAttribute("productReference",
|
target->AddAttribute("productReference",
|
||||||
this->CreateObjectReference(fileRef));
|
this->CreateObjectReference(fileRef));
|
||||||
target->AddAttribute("productType",
|
target->AddAttribute("productType",
|
||||||
@ -1383,6 +1411,7 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
|
|||||||
{
|
{
|
||||||
cmXCodeObject* container =
|
cmXCodeObject* container =
|
||||||
this->CreateObject(cmXCodeObject::PBXContainerItemProxy);
|
this->CreateObject(cmXCodeObject::PBXContainerItemProxy);
|
||||||
|
container->SetComment("PBXContainerItemProxy");
|
||||||
container->AddAttribute("containerPortal",
|
container->AddAttribute("containerPortal",
|
||||||
this->CreateObjectReference(m_RootObject));
|
this->CreateObjectReference(m_RootObject));
|
||||||
container->AddAttribute("proxyType", this->CreateString("1"));
|
container->AddAttribute("proxyType", this->CreateString("1"));
|
||||||
@ -1393,6 +1422,7 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
|
|||||||
dependTarget->GetcmTarget()->GetName()));
|
dependTarget->GetcmTarget()->GetName()));
|
||||||
targetdep =
|
targetdep =
|
||||||
this->CreateObject(cmXCodeObject::PBXTargetDependency);
|
this->CreateObject(cmXCodeObject::PBXTargetDependency);
|
||||||
|
targetdep->SetComment("PBXTargetDependency");
|
||||||
targetdep->AddAttribute("target",
|
targetdep->AddAttribute("target",
|
||||||
this->CreateObjectReference(dependTarget));
|
this->CreateObjectReference(dependTarget));
|
||||||
targetdep->AddAttribute("targetProxy",
|
targetdep->AddAttribute("targetProxy",
|
||||||
@ -1713,7 +1743,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(cmTarget& cmtarget,
|
|||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
tgroup->AddAttribute("name", this->CreateString(cmtarget.GetName()));
|
tgroup->AddAttribute("name", this->CreateString(cmtarget.GetName()));
|
||||||
tgroup->AddAttribute("children", tgroupChildren);
|
tgroup->AddAttribute("children", tgroupChildren);
|
||||||
tgroup->AddAttribute("refType", this->CreateString("4"));
|
if(m_XcodeVersion == 15)
|
||||||
|
{
|
||||||
|
tgroup->AddAttribute("refType", this->CreateString("4"));
|
||||||
|
}
|
||||||
tgroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
tgroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
||||||
m_SourcesGroupChildren->AddObject(tgroup);
|
m_SourcesGroupChildren->AddObject(tgroup);
|
||||||
}
|
}
|
||||||
@ -1724,7 +1757,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(cmTarget& cmtarget,
|
|||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
group->AddAttribute("name", this->CreateString(sg->GetName()));
|
group->AddAttribute("name", this->CreateString(sg->GetName()));
|
||||||
group->AddAttribute("children", groupChildren);
|
group->AddAttribute("children", groupChildren);
|
||||||
group->AddAttribute("refType", this->CreateString("4"));
|
if(m_XcodeVersion == 15)
|
||||||
|
{
|
||||||
|
group->AddAttribute("refType", this->CreateString("4"));
|
||||||
|
}
|
||||||
group->AddAttribute("sourceTree", this->CreateString("<group>"));
|
group->AddAttribute("sourceTree", this->CreateString("<group>"));
|
||||||
tgroupChildren->AddObject(group);
|
tgroupChildren->AddObject(group);
|
||||||
m_GroupNameMap[s] = group;
|
m_GroupNameMap[s] = group;
|
||||||
@ -1752,6 +1788,7 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
developBuildStyle->AddAttribute("name", this->CreateString("Debug"));
|
developBuildStyle->AddAttribute("name", this->CreateString("Debug"));
|
||||||
|
developBuildStyle->SetComment("Debug");
|
||||||
}
|
}
|
||||||
developBuildStyle->AddAttribute("buildSettings", group);
|
developBuildStyle->AddAttribute("buildSettings", group);
|
||||||
|
|
||||||
@ -1766,6 +1803,7 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
deployBuildStyle->AddAttribute("name", this->CreateString("Release"));
|
deployBuildStyle->AddAttribute("name", this->CreateString("Release"));
|
||||||
|
deployBuildStyle->SetComment("Release");
|
||||||
}
|
}
|
||||||
|
|
||||||
deployBuildStyle->AddAttribute("buildSettings", group);
|
deployBuildStyle->AddAttribute("buildSettings", group);
|
||||||
@ -1773,12 +1811,14 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
|
|||||||
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
listObjs->AddObject(developBuildStyle);
|
listObjs->AddObject(developBuildStyle);
|
||||||
listObjs->AddObject(deployBuildStyle);
|
listObjs->AddObject(deployBuildStyle);
|
||||||
|
|
||||||
cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
||||||
m_MainGroupChildren =
|
m_MainGroupChildren =
|
||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
mainGroup->AddAttribute("children", m_MainGroupChildren);
|
mainGroup->AddAttribute("children", m_MainGroupChildren);
|
||||||
mainGroup->AddAttribute("refType", this->CreateString("4"));
|
if(m_XcodeVersion == 15)
|
||||||
|
{
|
||||||
|
mainGroup->AddAttribute("refType", this->CreateString("4"));
|
||||||
|
}
|
||||||
mainGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
mainGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
||||||
|
|
||||||
cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
||||||
@ -1786,7 +1826,10 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
|
|||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
sourcesGroup->AddAttribute("name", this->CreateString("Sources"));
|
sourcesGroup->AddAttribute("name", this->CreateString("Sources"));
|
||||||
sourcesGroup->AddAttribute("children", m_SourcesGroupChildren);
|
sourcesGroup->AddAttribute("children", m_SourcesGroupChildren);
|
||||||
sourcesGroup->AddAttribute("refType", this->CreateString("4"));
|
if(m_XcodeVersion == 15)
|
||||||
|
{
|
||||||
|
sourcesGroup->AddAttribute("refType", this->CreateString("4"));
|
||||||
|
}
|
||||||
sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
||||||
m_MainGroupChildren->AddObject(sourcesGroup);
|
m_MainGroupChildren->AddObject(sourcesGroup);
|
||||||
// now create the cmake groups
|
// now create the cmake groups
|
||||||
@ -1794,7 +1837,10 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
|
|||||||
|
|
||||||
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
||||||
productGroup->AddAttribute("name", this->CreateString("Products"));
|
productGroup->AddAttribute("name", this->CreateString("Products"));
|
||||||
productGroup->AddAttribute("refType", this->CreateString("4"));
|
if(m_XcodeVersion == 15)
|
||||||
|
{
|
||||||
|
productGroup->AddAttribute("refType", this->CreateString("4"));
|
||||||
|
}
|
||||||
productGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
productGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
|
||||||
cmXCodeObject* productGroupChildren =
|
cmXCodeObject* productGroupChildren =
|
||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
@ -1803,31 +1849,35 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
|
|||||||
|
|
||||||
|
|
||||||
m_RootObject = this->CreateObject(cmXCodeObject::PBXProject);
|
m_RootObject = this->CreateObject(cmXCodeObject::PBXProject);
|
||||||
|
m_RootObject->SetComment("Project object");
|
||||||
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
||||||
m_RootObject->AddAttribute("mainGroup",
|
m_RootObject->AddAttribute("mainGroup",
|
||||||
this->CreateObjectReference(mainGroup));
|
this->CreateObjectReference(mainGroup));
|
||||||
m_RootObject->AddAttribute("buildSettings", group);
|
m_RootObject->AddAttribute("buildSettings", group);
|
||||||
m_RootObject->AddAttribute("buildSyles", listObjs);
|
m_RootObject->AddAttribute("buildStyles", listObjs);
|
||||||
m_RootObject->AddAttribute("hasScannedForEncodings",
|
m_RootObject->AddAttribute("hasScannedForEncodings",
|
||||||
this->CreateString("0"));
|
this->CreateString("0"));
|
||||||
cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList);
|
cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList);
|
||||||
cmXCodeObject* configDebug = this->CreateObject(cmXCodeObject::XCBuildConfiguration);
|
cmXCodeObject* configDebug = this->CreateObject(cmXCodeObject::XCBuildConfiguration);
|
||||||
cmXCodeObject* configRelease = this->CreateObject(cmXCodeObject::XCBuildConfiguration);
|
cmXCodeObject* configRelease = this->CreateObject(cmXCodeObject::XCBuildConfiguration);
|
||||||
cmXCodeObject* configDefault = this->CreateObject(cmXCodeObject::XCBuildConfiguration);
|
|
||||||
cmXCodeObject* buildConfigurations =
|
cmXCodeObject* buildConfigurations =
|
||||||
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||||
buildConfigurations->AddObject(configDebug);
|
buildConfigurations->AddObject(configDebug);
|
||||||
buildConfigurations->AddObject(configRelease);
|
buildConfigurations->AddObject(configRelease);
|
||||||
buildConfigurations->AddObject(configDefault);
|
|
||||||
configlist->AddAttribute("buildConfigurations", buildConfigurations);
|
configlist->AddAttribute("buildConfigurations", buildConfigurations);
|
||||||
|
std::string comment = "Build configuration list for PBXProject ";
|
||||||
|
comment += " \"";
|
||||||
|
comment += m_CurrentProject;
|
||||||
|
comment += "\"";
|
||||||
|
configlist->SetComment(comment.c_str());
|
||||||
|
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0"));
|
||||||
|
configlist->AddAttribute("defaultConfigurationName", this->CreateString("Debug"));
|
||||||
cmXCodeObject* buildSettings =
|
cmXCodeObject* buildSettings =
|
||||||
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
||||||
configDebug->AddAttribute("name", this->CreateString("Debug"));
|
configDebug->AddAttribute("name", this->CreateString("Debug"));
|
||||||
configDebug->AddAttribute("buildSettings", buildSettings);
|
configDebug->AddAttribute("buildSettings", buildSettings);
|
||||||
configRelease->AddAttribute("name", this->CreateString("Release"));
|
configRelease->AddAttribute("name", this->CreateString("Release"));
|
||||||
configRelease->AddAttribute("buildSettings", buildSettings);
|
configRelease->AddAttribute("buildSettings", buildSettings);
|
||||||
configDefault->AddAttribute("name", this->CreateString("Default"));
|
|
||||||
configDefault->AddAttribute("buildSettings", buildSettings);
|
|
||||||
|
|
||||||
m_RootObject->AddAttribute("buildConfigurationList",
|
m_RootObject->AddAttribute("buildConfigurationList",
|
||||||
this->CreateObjectReference(configlist));
|
this->CreateObjectReference(configlist));
|
||||||
@ -1972,8 +2022,8 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
|
|||||||
xcodeDir += "proj";
|
xcodeDir += "proj";
|
||||||
}
|
}
|
||||||
cmSystemTools::MakeDirectory(xcodeDir.c_str());
|
cmSystemTools::MakeDirectory(xcodeDir.c_str());
|
||||||
xcodeDir += "/project.pbxproj";
|
std::string xcodeProjFile = xcodeDir + "/project.pbxproj";
|
||||||
cmGeneratedFileStream fout(xcodeDir.c_str());
|
cmGeneratedFileStream fout(xcodeProjFile.c_str());
|
||||||
fout.SetCopyIfDifferent(true);
|
fout.SetCopyIfDifferent(true);
|
||||||
if(!fout)
|
if(!fout)
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,27 @@
|
|||||||
#include "cmXCode21Object.h"
|
#include "cmXCode21Object.h"
|
||||||
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
|
cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
|
||||||
:cmXCodeObject(ptype, type)
|
:cmXCodeObject(ptype, type)
|
||||||
{
|
{
|
||||||
|
m_Version = 21;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmXCode21Object::PrintComment(std::ostream& out)
|
void cmXCode21Object::PrintComment(std::ostream& out)
|
||||||
{
|
{
|
||||||
out << "/* */";
|
if(m_Comment.size() == 0)
|
||||||
|
{
|
||||||
|
cmXCodeObject* n = this->GetObject("name");
|
||||||
|
if(n)
|
||||||
|
{
|
||||||
|
m_Comment = n->GetString();
|
||||||
|
cmSystemTools::ReplaceString(m_Comment, "\"", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out << "/* ";
|
||||||
|
out << m_Comment;
|
||||||
|
out << " */";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +42,7 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v, std::ostre
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
out << "/* Begin " << PBXTypeNames[t] << " section */\n";
|
out << "\n/* Begin " << PBXTypeNames[t] << " section */\n";
|
||||||
for(std::vector<cmXCodeObject*>::const_iterator i = v.begin();
|
for(std::vector<cmXCodeObject*>::const_iterator i = v.begin();
|
||||||
i != v.end(); ++i)
|
i != v.end(); ++i)
|
||||||
{
|
{
|
||||||
@ -56,9 +69,9 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v, std::ostre
|
|||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXHeadersBuildPhase);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXHeadersBuildPhase);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXNativeTarget);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXNativeTarget);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXProject);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXProject);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXSourcesBuildPhase);
|
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXShellScriptBuildPhase);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXShellScriptBuildPhase);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXResourcesBuildPhase);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXResourcesBuildPhase);
|
||||||
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXSourcesBuildPhase);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXApplicationReference);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXApplicationReference);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXExecutableFileReference);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXExecutableFileReference);
|
||||||
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXLibraryReference);
|
cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXLibraryReference);
|
||||||
|
@ -14,12 +14,14 @@ const char* cmXCodeObject::PBXTypeNames[] = {
|
|||||||
|
|
||||||
cmXCodeObject::~cmXCodeObject()
|
cmXCodeObject::~cmXCodeObject()
|
||||||
{
|
{
|
||||||
|
m_Version = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
|
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
|
||||||
{
|
{
|
||||||
|
m_Version = 15;
|
||||||
m_PBXTargetDependency = 0;
|
m_PBXTargetDependency = 0;
|
||||||
m_cmTarget = 0;
|
m_cmTarget = 0;
|
||||||
m_Object =0;
|
m_Object =0;
|
||||||
@ -67,56 +69,84 @@ void cmXCodeObject::Indent(int level, std::ostream& out)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmXCodeObject::Print(std::ostream& out)
|
void cmXCodeObject::Print(std::ostream& out)
|
||||||
{
|
{
|
||||||
cmXCodeObject::Indent(2, out);
|
std::string separator = "\n";
|
||||||
|
int indentFactor = 1;
|
||||||
|
if(m_Version > 15 && (m_IsA == PBXFileReference || m_IsA == PBXBuildFile))
|
||||||
|
{
|
||||||
|
separator = " ";
|
||||||
|
indentFactor = 0;
|
||||||
|
}
|
||||||
|
cmXCodeObject::Indent(2*indentFactor, out);
|
||||||
out << m_Id << " ";
|
out << m_Id << " ";
|
||||||
this->PrintComment(out);
|
if(!(this->m_IsA == PBXGroup && this->m_Comment.size() == 0))
|
||||||
out << " = {\n";
|
{
|
||||||
|
this->PrintComment(out);
|
||||||
|
}
|
||||||
|
out << " = {";
|
||||||
|
if(separator == "\n")
|
||||||
|
{
|
||||||
|
out << separator;
|
||||||
|
}
|
||||||
std::map<cmStdString, cmXCodeObject*>::iterator i;
|
std::map<cmStdString, cmXCodeObject*>::iterator i;
|
||||||
|
cmXCodeObject::Indent(3*indentFactor, out);
|
||||||
|
out << "isa = " << PBXTypeNames[m_IsA] << ";" << separator;
|
||||||
for(i = m_ObjectAttributes.begin(); i != m_ObjectAttributes.end(); ++i)
|
for(i = m_ObjectAttributes.begin(); i != m_ObjectAttributes.end(); ++i)
|
||||||
{
|
{
|
||||||
cmXCodeObject* object = i->second;
|
cmXCodeObject* object = i->second;
|
||||||
cmXCodeObject::Indent(3, out);
|
if(i->first != "isa")
|
||||||
if(i->first == "isa")
|
|
||||||
{
|
{
|
||||||
out << i->first << " = " << PBXTypeNames[m_IsA] << ";\n";
|
cmXCodeObject::Indent(3*indentFactor, out);
|
||||||
}
|
}
|
||||||
else if(object->m_Type == OBJECT_LIST)
|
else
|
||||||
{
|
{
|
||||||
out << i->first << " = (\n";
|
continue;
|
||||||
|
}
|
||||||
|
if(object->m_Type == OBJECT_LIST)
|
||||||
|
{
|
||||||
|
out << i->first << " = (" << separator;
|
||||||
for(unsigned int k = 0; k < i->second->m_List.size(); k++)
|
for(unsigned int k = 0; k < i->second->m_List.size(); k++)
|
||||||
{
|
{
|
||||||
cmXCodeObject::Indent(4, out);
|
cmXCodeObject::Indent(4*indentFactor, out);
|
||||||
out << i->second->m_List[k]->m_Id << ",\n";
|
out << i->second->m_List[k]->m_Id << " ";
|
||||||
|
i->second->m_List[k]->PrintComment(out);
|
||||||
|
out << "," << separator;
|
||||||
}
|
}
|
||||||
cmXCodeObject::Indent(3, out);
|
cmXCodeObject::Indent(3*indentFactor, out);
|
||||||
out << ");\n";
|
out << ");" << separator;
|
||||||
}
|
}
|
||||||
else if(object->m_Type == ATTRIBUTE_GROUP)
|
else if(object->m_Type == ATTRIBUTE_GROUP)
|
||||||
{
|
{
|
||||||
std::map<cmStdString, cmXCodeObject*>::iterator j;
|
std::map<cmStdString, cmXCodeObject*>::iterator j;
|
||||||
out << i->first << " = {\n";
|
out << i->first << " = {" << separator;
|
||||||
for(j = object->m_ObjectAttributes.begin(); j != object->m_ObjectAttributes.end(); ++j)
|
for(j = object->m_ObjectAttributes.begin(); j != object->m_ObjectAttributes.end(); ++j)
|
||||||
{
|
{
|
||||||
cmXCodeObject::Indent(4, out);
|
cmXCodeObject::Indent(4 *indentFactor, out);
|
||||||
out << j->first << " = " << j->second->m_String << ";\n";
|
out << j->first << " = " << j->second->m_String << ";";
|
||||||
|
out << separator;
|
||||||
}
|
}
|
||||||
cmXCodeObject::Indent(3, out);
|
cmXCodeObject::Indent(3 *indentFactor, out);
|
||||||
out << "};\n";
|
out << "};" << separator;
|
||||||
}
|
}
|
||||||
else if(object->m_Type == OBJECT_REF)
|
else if(object->m_Type == OBJECT_REF)
|
||||||
{
|
{
|
||||||
out << i->first << " = " << object->m_Object->m_Id << ";\n";
|
out << i->first << " = " << object->m_Object->m_Id;
|
||||||
|
if(object->m_Object->HasComment() && i->first != "remoteGlobalIDString")
|
||||||
|
{
|
||||||
|
out << " ";
|
||||||
|
object->m_Object->PrintComment(out);
|
||||||
|
}
|
||||||
|
out << ";" << separator;
|
||||||
}
|
}
|
||||||
else if(object->m_Type == STRING)
|
else if(object->m_Type == STRING)
|
||||||
{
|
{
|
||||||
out << i->first << " = " << object->m_String << ";\n";
|
out << i->first << " = " << object->m_String << ";" << separator;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "what is this?? " << i->first << "\n";
|
out << "what is this?? " << i->first << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmXCodeObject::Indent(2, out);
|
cmXCodeObject::Indent(2*indentFactor, out);
|
||||||
out << "};\n";
|
out << "};\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,3 +176,27 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
|
|||||||
this->m_Object = copy->m_Object;
|
this->m_Object = copy->m_Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmXCodeObject::SetString(const char* s)
|
||||||
|
{
|
||||||
|
std::string ss = s;
|
||||||
|
if(ss.size() == 0)
|
||||||
|
{
|
||||||
|
m_String = "\"\"";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool needQuote = false;
|
||||||
|
m_String = "";
|
||||||
|
if(ss.find_first_of(" <>.+") != ss.npos)
|
||||||
|
{
|
||||||
|
needQuote = true;
|
||||||
|
}
|
||||||
|
if(needQuote)
|
||||||
|
{
|
||||||
|
m_String = "\"";
|
||||||
|
}
|
||||||
|
m_String += s;
|
||||||
|
if(needQuote)
|
||||||
|
{
|
||||||
|
m_String += "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -24,12 +24,7 @@ public:
|
|||||||
Type GetType() { return m_Type;}
|
Type GetType() { return m_Type;}
|
||||||
PBXType GetIsA() { return m_IsA;}
|
PBXType GetIsA() { return m_IsA;}
|
||||||
|
|
||||||
void SetString(const char* s)
|
void SetString(const char* s);
|
||||||
{
|
|
||||||
m_String = "\"";
|
|
||||||
m_String += s;
|
|
||||||
m_String += "\"";
|
|
||||||
}
|
|
||||||
const char* GetString()
|
const char* GetString()
|
||||||
{
|
{
|
||||||
return m_String.c_str();
|
return m_String.c_str();
|
||||||
@ -80,6 +75,8 @@ public:
|
|||||||
{
|
{
|
||||||
m_cmTarget = t;
|
m_cmTarget = t;
|
||||||
}
|
}
|
||||||
|
const char* GetComment() {return m_Comment.c_str();}
|
||||||
|
bool HasComment() { return (m_Comment.size() != 0);}
|
||||||
cmXCodeObject* GetObject(const char* name)
|
cmXCodeObject* GetObject(const char* name)
|
||||||
{
|
{
|
||||||
if(m_ObjectAttributes.count(name))
|
if(m_ObjectAttributes.count(name))
|
||||||
@ -122,11 +119,14 @@ public:
|
|||||||
return m_DependLibraries;
|
return m_DependLibraries;
|
||||||
}
|
}
|
||||||
std::vector<cmXCodeObject*> const& GetObjectList() { return m_List;}
|
std::vector<cmXCodeObject*> const& GetObjectList() { return m_List;}
|
||||||
|
void SetComment(const char* c) { m_Comment = c;}
|
||||||
protected:
|
protected:
|
||||||
cmTarget* m_cmTarget;
|
cmTarget* m_cmTarget;
|
||||||
Type m_Type;
|
Type m_Type;
|
||||||
cmStdString m_Id;
|
cmStdString m_Id;
|
||||||
PBXType m_IsA;
|
PBXType m_IsA;
|
||||||
|
int m_Version;
|
||||||
|
cmStdString m_Comment;
|
||||||
cmStdString m_String;
|
cmStdString m_String;
|
||||||
cmXCodeObject* m_Object;
|
cmXCodeObject* m_Object;
|
||||||
cmXCodeObject* m_PBXTargetDependency;
|
cmXCodeObject* m_PBXTargetDependency;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user