[Cmake-commits] [cmake-commits] king committed cmGlobalXCode21Generator.cxx 1.7 1.8 cmGlobalXCodeGenerator.cxx 1.210 1.211 cmGlobalXCodeGenerator.h 1.56 1.57
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Jun 29 13:02:08 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv27735/Source
Modified Files:
cmGlobalXCode21Generator.cxx cmGlobalXCodeGenerator.cxx
cmGlobalXCodeGenerator.h
Log Message:
ENH: Generate native Xcode 3.0 and 3.1 projects
CMake previously generated Xcode project files labeled as 2.4-compatible
by recent versions of Xcode (3.0 and 3.1). It is better to generate
native Xcode 3.0 and 3.1 projects. In particular, this can improve
build times by using the "Build independent targets in parallel"
feature.
Patch from Doug Gregor. See issue #9216.
Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.210
retrieving revision 1.211
diff -C 2 -d -r1.210 -r1.211
*** cmGlobalXCodeGenerator.cxx 16 Mar 2009 18:30:24 -0000 1.210
--- cmGlobalXCodeGenerator.cxx 29 Jun 2009 17:02:05 -0000 1.211
***************
*** 452,455 ****
--- 452,506 ----
}
+ // Builds either an object list or a space-separated string from the
+ // given inputs.
+ class cmGlobalXCodeGenerator::BuildObjectListOrString
+ {
+ cmGlobalXCodeGenerator *Generator;
+ cmXCodeObject *Group;
+ bool Empty;
+ std::string String;
+
+ public:
+ BuildObjectListOrString(cmGlobalXCodeGenerator *gen, bool buildObjectList)
+ : Generator(gen), Group(0), Empty(true)
+ {
+ if (buildObjectList)
+ {
+ this->Group = this->Generator->CreateObject(cmXCodeObject::OBJECT_LIST);
+ }
+ }
+
+ bool IsEmpty() const { return this->Empty; }
+
+ void Add(const char *newString)
+ {
+ this->Empty = false;
+
+ if (this->Group)
+ {
+ this->Group->AddObject(this->Generator->CreateString(newString));
+ }
+ else
+ {
+ this->String += newString;
+ this->String += ' ';
+ }
+ }
+
+ const std::string &GetString() const { return this->String; }
+
+ cmXCodeObject *CreateList()
+ {
+ if (this->Group)
+ {
+ return this->Group;
+ }
+ else
+ {
+ return this->Generator->CreateString(this->String.c_str());
+ }
+ }
+ };
+
//----------------------------------------------------------------------------
cmXCodeObject*
***************
*** 467,471 ****
// Add per-source definitions.
! this->AppendDefines(flags, sf->GetProperty("COMPILE_DEFINITIONS"), true);
// Using a map and the full path guarantees that we will always get the same
--- 518,532 ----
// Add per-source definitions.
! BuildObjectListOrString flagsBuild(this, false);
! this->AppendDefines(flagsBuild,
! sf->GetProperty("COMPILE_DEFINITIONS"), true);
! if (!flagsBuild.IsEmpty())
! {
! if (flags.size())
! {
! flags += ' ';
! }
! flags += flagsBuild.GetString();
! }
// Using a map and the full path guarantees that we will always get the same
***************
*** 1349,1353 ****
// Add preprocessor definitions for this target and configuration.
! std::string ppDefs;
if(this->XcodeVersion > 15)
{
--- 1410,1414 ----
// Add preprocessor definitions for this target and configuration.
! BuildObjectListOrString ppDefs(this, this->XcodeVersion >= 30);
if(this->XcodeVersion > 15)
{
***************
*** 1371,1375 ****
}
buildSettings->AddAttribute
! ("GCC_PREPROCESSOR_DEFINITIONS", this->CreateString(ppDefs.c_str()));
std::string extraLinkOptions;
--- 1432,1436 ----
}
buildSettings->AddAttribute
! ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
std::string extraLinkOptions;
***************
*** 1564,1571 ****
this->CreateString("NO"));
}
! std::string dirs;
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes);
- std::string fdirs;
std::set<cmStdString> emitted;
emitted.insert("/System/Library/Frameworks");
--- 1625,1633 ----
this->CreateString("NO"));
}
!
! BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
! BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes);
std::set<cmStdString> emitted;
emitted.insert("/System/Library/Frameworks");
***************
*** 1580,1585 ****
if(emitted.insert(frameworkDir).second)
{
! fdirs += this->XCodeEscapePath(frameworkDir.c_str());
! fdirs += " ";
}
}
--- 1642,1646 ----
if(emitted.insert(frameworkDir).second)
{
! fdirs.Add(this->XCodeEscapePath(frameworkDir.c_str()).c_str());
}
}
***************
*** 1588,1592 ****
std::string incpath =
this->XCodeEscapePath(i->c_str());
! dirs += incpath + " ";
}
}
--- 1649,1653 ----
std::string incpath =
this->XCodeEscapePath(i->c_str());
! dirs.Add(incpath.c_str());
}
}
***************
*** 1599,1616 ****
if(emitted.insert(*fmIt).second)
{
! fdirs += this->XCodeEscapePath(fmIt->c_str());
! fdirs += " ";
}
}
}
! if(fdirs.size())
{
buildSettings->AddAttribute("FRAMEWORK_SEARCH_PATHS",
! this->CreateString(fdirs.c_str()));
}
! if(dirs.size())
{
buildSettings->AddAttribute("HEADER_SEARCH_PATHS",
! this->CreateString(dirs.c_str()));
}
std::string oflagc = this->ExtractFlag("-O", cflags);
--- 1660,1676 ----
if(emitted.insert(*fmIt).second)
{
! fdirs.Add(this->XCodeEscapePath(fmIt->c_str()).c_str());
}
}
}
! if(!fdirs.IsEmpty())
{
buildSettings->AddAttribute("FRAMEWORK_SEARCH_PATHS",
! fdirs.CreateList());
}
! if(!dirs.IsEmpty())
{
buildSettings->AddAttribute("HEADER_SEARCH_PATHS",
! dirs.CreateList());
}
std::string oflagc = this->ExtractFlag("-O", cflags);
***************
*** 1715,1722 ****
buildSettings->AddAttribute("USE_HEADERMAP",
this->CreateString("NO"));
! buildSettings->AddAttribute("WARNING_CFLAGS",
! this->CreateString(
! "-Wmost -Wno-four-char-constants"
! " -Wno-unknown-pragmas"));
// Runtime version information.
--- 1775,1793 ----
buildSettings->AddAttribute("USE_HEADERMAP",
this->CreateString("NO"));
! if (this->XcodeVersion >= 30)
! {
! cmXCodeObject *group = this->CreateObject(cmXCodeObject::OBJECT_LIST);
! group->AddObject(this->CreateString("-Wmost"));
! group->AddObject(this->CreateString("-Wno-four-char-constants"));
! group->AddObject(this->CreateString("-Wno-unknown-pragmas"));
! buildSettings->AddAttribute("WARNING_CFLAGS", group);
! }
! else
! {
! buildSettings->AddAttribute("WARNING_CFLAGS",
! this->CreateString(
! "-Wmost -Wno-four-char-constants"
! " -Wno-unknown-pragmas"));
! }
// Runtime version information.
***************
*** 2433,2436 ****
--- 2504,2521 ----
this->RootObject->AddAttribute("hasScannedForEncodings",
this->CreateString("0"));
+ if (this->XcodeVersion >= 30)
+ {
+ group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
+ group->AddAttribute("BuildIndependentTargetsInParallel",
+ this->CreateString("YES"));
+ this->RootObject->AddAttribute("attributes", group);
+ if (this->XcodeVersion >= 31)
+ this->RootObject->AddAttribute("compatibilityVersion",
+ this->CreateString("Xcode 3.1"));
+ else
+ this->RootObject->AddAttribute("compatibilityVersion",
+ this->CreateString("Xcode 3.0"));
+ this->RootObject->AddAttribute("projectDirPath", this->CreateString(""));
+ }
// Point Xcode at the top of the source tree.
{
***************
*** 2947,2951 ****
//----------------------------------------------------------------------------
! void cmGlobalXCodeGenerator::AppendDefines(std::string& defs,
const char* defines_list,
bool dflag)
--- 3032,3036 ----
//----------------------------------------------------------------------------
! void cmGlobalXCodeGenerator::AppendDefines(BuildObjectListOrString& defs,
const char* defines_list,
bool dflag)
***************
*** 2968,2986 ****
// Note that in the code below we need one more level of escapes for
// C string syntax in this source file.
- const char* sep = defs.empty()? "" : " ";
for(std::vector<std::string>::const_iterator di = defines.begin();
di != defines.end(); ++di)
{
! // Separate from previous definition.
! defs += sep;
! sep = " ";
// Open single quote.
! defs += "'";
// Add -D flag if requested.
if(dflag)
{
! defs += "-D";
}
--- 3053,3068 ----
// Note that in the code below we need one more level of escapes for
// C string syntax in this source file.
for(std::vector<std::string>::const_iterator di = defines.begin();
di != defines.end(); ++di)
{
! std::string def;
// Open single quote.
! def += "'";
// Add -D flag if requested.
if(dflag)
{
! def += "-D";
}
***************
*** 2990,3007 ****
if(*c == '\'')
{
! defs += "\\\\'";
}
else if(*c == '\\')
{
! defs += "\\\\\\\\";
}
else
{
! defs += *c;
}
}
// Close single quote.
! defs += "'";
}
}
--- 3072,3091 ----
if(*c == '\'')
{
! def += "\\\\'";
}
else if(*c == '\\')
{
! def += "\\\\\\\\";
}
else
{
! def += *c;
}
}
// Close single quote.
! def += "'";
!
! defs.Add(def.c_str());
}
}
Index: cmGlobalXCodeGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -C 2 -d -r1.56 -r1.57
*** cmGlobalXCodeGenerator.h 16 Mar 2009 18:30:24 -0000 1.56
--- cmGlobalXCodeGenerator.h 29 Jun 2009 17:02:05 -0000 1.57
***************
*** 179,183 ****
const char* default_flags);
! void AppendDefines(std::string& defs, const char* defines_list,
bool dflag = false);
--- 179,186 ----
const char* default_flags);
! class BuildObjectListOrString;
! friend class BuildObjectListOrString;
!
! void AppendDefines(BuildObjectListOrString& defs, const char* defines_list,
bool dflag = false);
Index: cmGlobalXCode21Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCode21Generator.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmGlobalXCode21Generator.cxx 14 Aug 2007 15:45:14 -0000 1.7
--- cmGlobalXCode21Generator.cxx 29 Jun 2009 17:02:05 -0000 1.8
***************
*** 39,43 ****
fout << "};\n";
cmXCode21Object::Indent(1, fout);
! fout << "objectVersion = 42;\n";
cmXCode21Object::PrintList(this->XCodeObjects, fout);
cmXCode21Object::Indent(1, fout);
--- 39,48 ----
fout << "};\n";
cmXCode21Object::Indent(1, fout);
! if (this->XcodeVersion >= 31)
! fout << "objectVersion = 45;\n";
! else if (this->XcodeVersion >= 30)
! fout << "objectVersion = 44;\n";
! else
! fout << "objectVersion = 42;\n";
cmXCode21Object::PrintList(this->XCodeObjects, fout);
cmXCode21Object::Indent(1, fout);
More information about the Cmake-commits
mailing list