[Cmake-commits] CMake branch, next, updated. v3.1.0-2131-g7cf7cc6

Brad King brad.king at kitware.com
Mon Jan 19 08:40:26 EST 2015


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  7cf7cc664af24a7ca8e74dfad2d655183e0f85e3 (commit)
       via  9e0176e2b37b93f34718b6333edd73302b5c5350 (commit)
       via  c0ff542c58e48ac91714d9dc44058c9cb42fb828 (commit)
      from  eaaf5aab1a9c286a3d7470880e0c1590fd6bb9a7 (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=7cf7cc664af24a7ca8e74dfad2d655183e0f85e3
commit 7cf7cc664af24a7ca8e74dfad2d655183e0f85e3
Merge: eaaf5aa 9e0176e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jan 19 08:40:25 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Jan 19 08:40:25 2015 -0500

    Merge topic 'xcode-target-sort' into next
    
    9e0176e2 Xcode: Sort targets deterministically and with ALL_BUILD first (#15346)
    c0ff542c Xcode: Fix early termination on per-config source file error


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e0176e2b37b93f34718b6333edd73302b5c5350
commit 9e0176e2b37b93f34718b6333edd73302b5c5350
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Jan 16 17:37:26 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jan 19 08:36:45 2015 -0500

    Xcode: Sort targets deterministically and with ALL_BUILD first (#15346)
    
    The default target in XCode is the first one in the file.
    
    In commit v3.1.0-rc1~286^2 (cmTarget: use a hash_map for cmTargets
    typedef, 2014-06-10) the order of the targets stored in cmMakefile was
    made non-deterministic instead of lexicographic.  Teach the Xcode
    generator to do its own sorting to restore a predictable order.
    
    While at it, place ALL_BUILD first (as is done in VS IDE generators)
    explicitly in the comparison function so that it is the default target
    even if other targets sort earlier lexicographically (e.g. "AAA").

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 09d5c79..637e60d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -966,6 +966,23 @@ struct cmSourceFilePathCompare
 };
 
 //----------------------------------------------------------------------------
+struct cmCompareTargets
+{
+  bool operator () (std::string const& a, std::string const& b) const
+  {
+    if (a == "ALL_BUILD")
+      {
+      return true;
+      }
+    if (b == "ALL_BUILD")
+      {
+      return false;
+      }
+    return strcmp(a.c_str(), b.c_str()) < 0;
+  }
+};
+
+//----------------------------------------------------------------------------
 bool
 cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
                                            std::vector<cmXCodeObject*>&
@@ -973,9 +990,16 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
 {
   this->SetCurrentLocalGenerator(gen);
   cmTargets &tgts = this->CurrentMakefile->GetTargets();
+  typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets;
+  cmSortedTargets sortedTargets;
   for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
     {
-    cmTarget& cmtarget = l->second;
+    sortedTargets[l->first] = &l->second;
+    }
+  for(cmSortedTargets::iterator l = sortedTargets.begin();
+      l != sortedTargets.end(); l++)
+    {
+    cmTarget& cmtarget = *l->second;
     cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
 
     // make sure ALL_BUILD, INSTALL, etc are only done once

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0ff542c58e48ac91714d9dc44058c9cb42fb828
commit c0ff542c58e48ac91714d9dc44058c9cb42fb828
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jan 19 08:27:15 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jan 19 08:34:32 2015 -0500

    Xcode: Fix early termination on per-config source file error
    
    In commit v3.1.0-rc1~687^2~4 (cmTarget: Make the source files depend on
    the config, 2014-02-13) an early termination case was added to the Xcode
    generator.  Fix handling of this case to actually abort all the
    generation steps.  Otherwise some of the later steps are attempted
    without the preconditions normally established by earlier steps,
    possibly leading to a crash.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 13e6988..09d5c79 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -966,7 +966,7 @@ struct cmSourceFilePathCompare
 };
 
 //----------------------------------------------------------------------------
-void
+bool
 cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
                                            std::vector<cmXCodeObject*>&
                                            targets)
@@ -992,7 +992,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
     if(cmtarget.GetType() == cmTarget::UTILITY ||
        cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
       {
-      targets.push_back(this->CreateUtilityTarget(cmtarget));
+      cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
+      if (!t)
+        {
+        return false;
+        }
+      targets.push_back(t);
       continue;
       }
 
@@ -1000,7 +1005,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
     std::vector<cmSourceFile*> classes;
     if (!cmtarget.GetConfigCommonSourceFiles(classes))
       {
-      return;
+      return false;
       }
     std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
 
@@ -1227,6 +1232,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
 
     targets.push_back(this->CreateXCodeTarget(cmtarget, buildPhases));
     }
+  return true;
 }
 
 //----------------------------------------------------------------------------
@@ -2940,7 +2946,7 @@ void cmGlobalXCodeGenerator
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
+bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
                                           std::vector<cmLocalGenerator*>&
                                           generators)
 {
@@ -2983,7 +2989,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
       std::vector<cmSourceFile*> classes;
       if (!cmtarget.GetConfigCommonSourceFiles(classes))
         {
-        return;
+        return false;
         }
       // Put cmSourceFile instances in proper groups:
       for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
@@ -3016,6 +3022,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
         }
       }
     }
+  return true;
 }
 
 cmXCodeObject *cmGlobalXCodeGenerator
@@ -3136,7 +3143,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator
+bool cmGlobalXCodeGenerator
 ::CreateXCodeObjects(cmLocalGenerator* root,
                      std::vector<cmLocalGenerator*>&
                      generators)
@@ -3217,7 +3224,10 @@ void cmGlobalXCodeGenerator
   this->MainGroupChildren->AddObject(resourcesGroup);
 
   // now create the cmake groups
-  this->CreateGroups(root, generators);
+  if (!this->CreateGroups(root, generators))
+    {
+    return false;
+    }
 
   cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
   productGroup->AddAttribute("name", this->CreateString("Products"));
@@ -3417,7 +3427,10 @@ void cmGlobalXCodeGenerator
     {
     if(!this->IsExcluded(root, *i))
       {
-      this->CreateXCodeTargets(*i, targets);
+      if (!this->CreateXCodeTargets(*i, targets))
+        {
+        return false;
+        }
       }
     }
   // loop over all targets and add link and depend info
@@ -3446,6 +3459,7 @@ void cmGlobalXCodeGenerator
       }
     }
   this->RootObject->AddAttribute("targets", allTargets);
+  return true;
 }
 
 //----------------------------------------------------------------------------
@@ -3632,8 +3646,10 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
       }
     }
 
-  this->CreateXCodeObjects(root,
-                           generators);
+  if (!this->CreateXCodeObjects(root, generators))
+    {
+    return;
+    }
   std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory();
   xcodeDir += "/";
   xcodeDir += root->GetMakefile()->GetProjectName();
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 9d7b784..8d7cfaf 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -91,7 +91,7 @@ private:
                                      cmSourceGroup* sg);
   cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
                                 std::string name);
-  void CreateGroups(cmLocalGenerator* root,
+  bool CreateGroups(cmLocalGenerator* root,
                     std::vector<cmLocalGenerator*>&
                     generators);
   std::string XCodeEscapePath(const char* p);
@@ -151,7 +151,7 @@ private:
   std::string ExtractFlag(const char* flag, std::string& flags);
   // delete all objects in the this->XCodeObjects vector.
   void ClearXCodeObjects();
-  void CreateXCodeObjects(cmLocalGenerator* root,
+  bool CreateXCodeObjects(cmLocalGenerator* root,
                           std::vector<cmLocalGenerator*>& generators);
   void OutputXCodeProject(cmLocalGenerator* root,
                           std::vector<cmLocalGenerator*>& generators);
@@ -170,7 +170,7 @@ private:
   cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
                                        cmSourceFile* sf,
                                        cmTarget& cmtarget);
-  void CreateXCodeTargets(cmLocalGenerator* gen,
+  bool CreateXCodeTargets(cmLocalGenerator* gen,
                           std::vector<cmXCodeObject*>&);
   bool IsHeaderFile(cmSourceFile*);
   void AddDependTarget(cmXCodeObject* target,

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

Summary of changes:
 Source/cmGlobalXCodeGenerator.cxx |   62 ++++++++++++++++++++++++++++++-------
 Source/cmGlobalXCodeGenerator.h   |    6 ++--
 2 files changed, 54 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list