[Cmake-commits] CMake branch, next, updated. v2.8.4-1702-g1dcc4ac

Brad King brad.king at kitware.com
Tue Jun 7 11:31:40 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  1dcc4ac7ae38a0ce87e1be1203c702c8d7b91cc5 (commit)
       via  eeeeca1082a8be5890a6d2096b505ebe584fc2b7 (commit)
       via  59ed84e032922f4d44b973837aa24497d182d2d3 (commit)
       via  d0a403fd99e000f32467f66fe898d785f30435eb (commit)
      from  f87ed31ce514b1c1c299c8b5b714c283875a5a80 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1dcc4ac7ae38a0ce87e1be1203c702c8d7b91cc5
commit 1dcc4ac7ae38a0ce87e1be1203c702c8d7b91cc5
Merge: f87ed31 eeeeca1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 7 11:22:07 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 7 11:22:07 2011 -0400

    Merge topic 'xcode-source_groups-folders-issue-10039' into next
    
    eeeeca1 XCode: Support target folders on XCode.
    59ed84e Xcode: Support multiple level nesting of XCode folders (#10039)
    d0a403f CMake: Move tokenize to cmSystemTools


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eeeeca1082a8be5890a6d2096b505ebe584fc2b7
commit eeeeca1082a8be5890a6d2096b505ebe584fc2b7
Author:     Johan Björk <phb at spotify.com>
AuthorDate: Sun Feb 20 14:05:41 2011 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 7 10:44:27 2011 -0400

    XCode: Support target folders on XCode.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e7ae8be..688296e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2481,27 +2481,55 @@ cmXCodeObject *cmGlobalXCodeGenerator
 cmXCodeObject* cmGlobalXCodeGenerator
 ::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg)
 {
-  cmStdString s = cmtarget.GetName();
-  s += "/";
+  cmStdString s;
+  cmStdString target;
+  const char *targetFolder= cmtarget.GetProperty("FOLDER");
+  if(targetFolder) {
+    target = targetFolder;
+    target += "/";
+  }
+  target += cmtarget.GetName();
+  s = target + "/";
   s += sg->GetFullName();
-  std::map<cmStdString, cmXCodeObject* >::iterator i =
+  std::map<cmStdString, cmXCodeObject* >::iterator it =
     this->GroupNameMap.find(s);
-  if(i != this->GroupNameMap.end())
+  if(it != this->GroupNameMap.end())
     {
-    return i->second;
+    return it->second;
     }
-  i = this->TargetGroup.find(cmtarget.GetName());
+
+  it = this->TargetGroup.find(target);
   cmXCodeObject* tgroup = 0;
-  if(i != this->TargetGroup.end())
+  if(it != this->TargetGroup.end())
     {
-    tgroup = i->second;
+    tgroup = it->second;
     }
   else
     {
-    tgroup = this->CreatePBXGroup(NULL,cmtarget.GetName());
-    this->TargetGroup[cmtarget.GetName()] = tgroup;
-    this->SourcesGroupChildren->AddObject(tgroup);
+    std::vector<std::string> tgt_folders = cmSystemTools::tokenize(target, "/");
+    cmStdString curr_tgt_folder;
+    for(std::vector<std::string>::size_type i = 0; i < tgt_folders.size();i++)
+      {
+      curr_tgt_folder += tgt_folders[i];
+      it = this->TargetGroup.find(curr_tgt_folder);
+      if(it == this->TargetGroup.end())
+        {
+        tgroup = this->CreatePBXGroup(tgroup,tgt_folders[i]);
+        this->TargetGroup[curr_tgt_folder] = tgroup;
+        }
+      else
+        {
+        tgroup = it->second;
+        continue;
+        }
+      if(i == 0)
+        {
+        this->SourcesGroupChildren->AddObject(tgroup);
+        }
+      curr_tgt_folder += "/";
+      }
     }
+  this->TargetGroup[target] = tgroup;
 
   // If it's the default source group (empty name) then put the source file
   // directly in the tgroup...

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59ed84e032922f4d44b973837aa24497d182d2d3
commit 59ed84e032922f4d44b973837aa24497d182d2d3
Author:     Johan Björk <phb at spotify.com>
AuthorDate: Tue Feb 15 14:34:14 2011 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 7 10:21:49 2011 -0400

    Xcode: Support multiple level nesting of XCode folders (#10039)

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 358721f..e7ae8be 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2456,13 +2456,34 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
     }
 }
 
+cmXCodeObject *cmGlobalXCodeGenerator
+::CreatePBXGroup(cmXCodeObject *parent, cmStdString name)
+{
+  cmXCodeObject* parentChildren = NULL;
+  if(parent)
+    parentChildren = parent->GetObject("children");
+  cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup);
+  cmXCodeObject* groupChildren =
+  this->CreateObject(cmXCodeObject::OBJECT_LIST);
+  group->AddAttribute("name", this->CreateString(name.c_str()));
+  group->AddAttribute("children", groupChildren);
+  if(this->XcodeVersion == 15)
+  {
+    group->AddAttribute("refType", this->CreateString("4"));
+  }
+  group->AddAttribute("sourceTree", this->CreateString("<group>"));
+  if(parentChildren)
+    parentChildren->AddObject(group);
+  return group;
+}
+
 //----------------------------------------------------------------------------
 cmXCodeObject* cmGlobalXCodeGenerator
 ::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg)
 {
   cmStdString s = cmtarget.GetName();
   s += "/";
-  s += sg->GetName();
+  s += sg->GetFullName();
   std::map<cmStdString, cmXCodeObject* >::iterator i =
     this->GroupNameMap.find(s);
   if(i != this->GroupNameMap.end())
@@ -2477,41 +2498,46 @@ cmXCodeObject* cmGlobalXCodeGenerator
     }
   else
     {
-    tgroup = this->CreateObject(cmXCodeObject::PBXGroup);
+    tgroup = this->CreatePBXGroup(NULL,cmtarget.GetName());
     this->TargetGroup[cmtarget.GetName()] = tgroup;
-    cmXCodeObject* tgroupChildren =
-      this->CreateObject(cmXCodeObject::OBJECT_LIST);
-    tgroup->AddAttribute("name", this->CreateString(cmtarget.GetName()));
-    tgroup->AddAttribute("children", tgroupChildren);
-    if(this->XcodeVersion == 15)
-      {
-      tgroup->AddAttribute("refType", this->CreateString("4"));
-      }
-    tgroup->AddAttribute("sourceTree", this->CreateString("<group>"));
     this->SourcesGroupChildren->AddObject(tgroup);
     }
 
   // If it's the default source group (empty name) then put the source file
   // directly in the tgroup...
   //
-  if (cmStdString(sg->GetName()) == "")
+  if (cmStdString(sg->GetFullName()) == "")
     {
     this->GroupNameMap[s] = tgroup;
     return tgroup;
     }
 
-  cmXCodeObject* tgroupChildren = tgroup->GetObject("children");
-  cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup);
-  cmXCodeObject* groupChildren =
-    this->CreateObject(cmXCodeObject::OBJECT_LIST);
-  group->AddAttribute("name", this->CreateString(sg->GetName()));
-  group->AddAttribute("children", groupChildren);
-  if(this->XcodeVersion == 15)
+  //It's a recursive folder structure, let's find the real parent group
+  if(std::string(sg->GetFullName()) != std::string(sg->GetName()))
     {
-    group->AddAttribute("refType", this->CreateString("4"));
+    std::vector<std::string> folders = cmSystemTools::tokenize(sg->GetFullName(), "\\");
+    cmStdString curr_folder = cmtarget.GetName();
+    curr_folder += "/";
+    for(std::vector<std::string>::size_type i = 0; i < folders.size();i++)
+      {
+      curr_folder += folders[i];
+      std::map<cmStdString, cmXCodeObject* >::iterator i_folder = this->GroupNameMap.find(curr_folder);
+      //Create new folder
+      if(i_folder == this->GroupNameMap.end())
+        {
+        cmXCodeObject *group = this->CreatePBXGroup(tgroup,folders[i]);
+        this->GroupNameMap[curr_folder] = group;
+        tgroup = group;
+        }
+      else
+        {
+        tgroup = i_folder->second;
+        }
+      curr_folder = curr_folder + "\\";
+      }
+    return tgroup;
     }
-  group->AddAttribute("sourceTree", this->CreateString("<group>"));
-  tgroupChildren->AddObject(group);
+  cmXCodeObject *group = this->CreatePBXGroup(tgroup,sg->GetName());
   this->GroupNameMap[s] = group;
   return group;
 }
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 290532a..22a78f2 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -88,6 +88,8 @@ public:
 private: 
   cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
                                      cmSourceGroup* sg);
+  cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
+                                cmStdString name);
   void CreateGroups(cmLocalGenerator* root,
                     std::vector<cmLocalGenerator*>&
                     generators);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0a403fd99e000f32467f66fe898d785f30435eb
commit d0a403fd99e000f32467f66fe898d785f30435eb
Author:     Johan Björk <phb at spotify.com>
AuthorDate: Tue Feb 15 14:34:14 2011 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 7 10:18:54 2011 -0400

    CMake: Move tokenize to cmSystemTools

diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 27d90db..22f4d47 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -11,37 +11,6 @@
 ============================================================================*/
 #include "cmSourceGroupCommand.h"
 
-inline std::vector<std::string> tokenize(const std::string& str,
-                                         const std::string& sep)
-{
-  std::vector<std::string> tokens;
-  std::string::size_type tokend = 0;
-
-  do
-    {
-    std::string::size_type tokstart=str.find_first_not_of(sep, tokend);
-    if (tokstart==std::string::npos) 
-      {
-      break;    // no more tokens
-      }
-    tokend=str.find_first_of(sep,tokstart);
-    if (tokend==std::string::npos)
-      {
-      tokens.push_back(str.substr(tokstart));
-      }
-    else
-      {
-      tokens.push_back(str.substr(tokstart,tokend-tokstart));
-      }
-    } while (tokend!=std::string::npos);
-
-  if (tokens.empty())
-    {
-    tokens.push_back("");
-    }
-  return tokens;
-}
-
 // cmSourceGroupCommand
 bool cmSourceGroupCommand
 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
@@ -58,7 +27,7 @@ bool cmSourceGroupCommand
     delimiter = this->Makefile->GetDefinition("SOURCE_GROUP_DELIMITER");
     }
 
-  std::vector<std::string> folders = tokenize(args[0], delimiter);
+  std::vector<std::string> folders = cmSystemTools::tokenize(args[0], delimiter);
  
   cmSourceGroup* sg = 0;
   sg = this->Makefile->GetSourceGroup(folders);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7bc89a4..9341a4c 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2833,3 +2833,35 @@ bool cmSystemTools::RepeatedRemoveDirectory(const char* dir)
     }
   return false;
 }
+
+//----------------------------------------------------------------------------
+std::vector<std::string> cmSystemTools::tokenize(const std::string& str,
+                                  const std::string& sep)
+{
+  std::vector<std::string> tokens;
+  std::string::size_type tokend = 0;
+
+  do
+    {
+    std::string::size_type tokstart=str.find_first_not_of(sep, tokend);
+    if (tokstart==std::string::npos)
+      {
+      break;    // no more tokens
+      }
+    tokend=str.find_first_of(sep,tokstart);
+    if (tokend==std::string::npos)
+      {
+      tokens.push_back(str.substr(tokstart));
+      }
+    else
+      {
+      tokens.push_back(str.substr(tokstart,tokend-tokstart));
+      }
+    } while (tokend!=std::string::npos);
+
+  if (tokens.empty())
+    {
+    tokens.push_back("");
+    }
+  return tokens;
+}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 6f9147c..5b5c768 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -439,6 +439,9 @@ public:
   /** Remove a directory; repeat a few times in case of locked files.  */
   static bool RepeatedRemoveDirectory(const char* dir);
 
+  /** Tokenize a string */
+  static std::vector<std::string> tokenize(const std::string& str,
+                                           const std::string& sep);
 private:
   static bool s_ForceUnixPaths;
   static bool s_RunCommandHideConsole;

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGlobalXCodeGenerator.cxx |  114 +++++++++++++++++++++++++++----------
 Source/cmGlobalXCodeGenerator.h   |    2 +
 Source/cmSourceGroupCommand.cxx   |   33 +----------
 Source/cmSystemTools.cxx          |   32 ++++++++++
 Source/cmSystemTools.h            |    3 +
 5 files changed, 122 insertions(+), 62 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list