[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-1081-gff136d9

Stephen Kelly steveire at gmail.com
Sat Mar 15 05:15:33 EDT 2014


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  ff136d969cf3c6ae655fc90f42e3f8d19c0c8e0e (commit)
       via  e2e2734ff70971ac9cd12d9398064ea440b28954 (commit)
      from  e1e479a625ad6b9ebc557d8b2264909732115aab (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=ff136d969cf3c6ae655fc90f42e3f8d19c0c8e0e
commit ff136d969cf3c6ae655fc90f42e3f8d19c0c8e0e
Merge: e1e479a e2e2734
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Mar 15 05:15:32 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Mar 15 05:15:32 2014 -0400

    Merge topic 'target-objects-refactor' into next
    
    e2e2734f cmGeneratorTarget: Compute target objects on demand


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2e2734ff70971ac9cd12d9398064ea440b28954
commit e2e2734ff70971ac9cd12d9398064ea440b28954
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Mar 14 13:21:26 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Mar 15 10:15:24 2014 +0100

    cmGeneratorTarget: Compute target objects on demand
    
    Add a ComputeTargetObjects method to compute the object
    names.  It takes mapping to populate as an out-parameter so
    that it can be extended in the future with parameters
    relevant to generator expression evaluation.
    
    Remove the supporting cmGeneratorTarget::AddObject method. It is
    no longer needed as the container member is populated directly.
    
    In a follow-up, the UseObjectLibraries usage may be replaced by a
    true generator expression evaluator for TARGET_OBJECTS. That
    will require generators to use cmGeneratorTarget::GetExternalObjects
    which is not currently the case for Xcode and VS generators.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 2a144c6..094a113 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -310,18 +310,36 @@ cmGeneratorTarget
 ::GetObjectSources(std::vector<cmSourceFile const*> &data) const
 {
   IMPLEMENT_VISIT(ObjectSources);
+
+  if (!this->Objects.empty())
+    {
+    return;
+    }
+
+  for(std::vector<cmSourceFile const*>::const_iterator it = data.begin();
+      it != data.end(); ++it)
+    {
+    this->Objects[*it];
+    }
+
+  this->LocalGenerator->ComputeObjectFilenames(this->Objects, this);
 }
 
-//----------------------------------------------------------------------------
-const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
+void cmGeneratorTarget::ComputeObjectMapping()
 {
-  return this->Objects[file];
+  if(!this->Objects.empty())
+    {
+    return;
+    }
+  std::vector<cmSourceFile const*> sourceFiles;
+  this->GetObjectSources(sourceFiles);
 }
 
-void cmGeneratorTarget::AddObject(cmSourceFile const* sf,
-                                  std::string const&name)
+//----------------------------------------------------------------------------
+const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
 {
-    this->Objects[sf] = name;
+  this->ComputeObjectMapping();
+  return this->Objects[file];
 }
 
 //----------------------------------------------------------------------------
@@ -333,6 +351,7 @@ void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
 //----------------------------------------------------------------------------
 bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
 {
+  const_cast<cmGeneratorTarget*>(this)->ComputeObjectMapping();
   std::set<cmSourceFile const*>::const_iterator it
                                         = this->ExplicitObjectName.find(file);
   return it != this->ExplicitObjectName.end();
@@ -573,6 +592,9 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
     cmTarget* objLib = *ti;
     cmGeneratorTarget* ogt =
       this->GlobalGenerator->GetGeneratorTarget(objLib);
+
+    ogt->ComputeObjectMapping();
+
     std::vector<cmSourceFile const*> objectSources;
     ogt->GetObjectSources(objectSources);
     for(std::vector<cmSourceFile const*>::const_iterator
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 53e27c5..22735c6 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -35,7 +35,6 @@ public:
   void GetObjectSources(std::vector<cmSourceFile const*> &) const;
   const std::string& GetObjectName(cmSourceFile const* file);
 
-  void AddObject(cmSourceFile const* sf, std::string const&name);
   bool HasExplicitObjectName(cmSourceFile const* file) const;
   void AddExplicitObjectName(cmSourceFile const* sf);
 
@@ -125,7 +124,9 @@ private:
   typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
   SourceEntriesType SourceEntries;
 
-  std::map<cmSourceFile const*, std::string> Objects;
+  void ComputeObjectMapping();
+
+  mutable std::map<cmSourceFile const*, std::string> Objects;
   std::set<cmSourceFile const*> ExplicitObjectName;
   std::vector<cmTarget*> ObjectLibraries;
   mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 5b6d729..a4998f9 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1451,7 +1451,6 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
       cmGeneratorTarget* gt = ti->second;
       this->ComputeTargetObjectDirectory(gt);
       gt->LookupObjectLibraries();
-      this->ComputeTargetObjects(gt);
       }
     }
 }
@@ -1516,29 +1515,6 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
-{
-  std::vector<cmSourceFile const*> objectSources;
-  gt->GetObjectSources(objectSources);
-
-  std::map<cmSourceFile const*, std::string> mapping;
-  for(std::vector<cmSourceFile const*>::const_iterator it
-      = objectSources.begin(); it != objectSources.end(); ++it)
-    {
-    mapping[*it];
-    }
-
-  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
-
-  for(std::map<cmSourceFile const*, std::string>::const_iterator it
-      = mapping.begin(); it != mapping.end(); ++it)
-    {
-    assert(!it->second.empty());
-    gt->AddObject(it->first, it->second);
-    }
-}
-
-//----------------------------------------------------------------------------
 void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
 {
 }
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 49a418d..5366733 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -443,7 +443,6 @@ private:
   void CreateGeneratorTargets(cmMakefile* mf);
   void CreateGeneratorTargets();
   void ComputeGeneratorTargetObjects();
-  void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   void ClearGeneratorMembers();
 

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list