[Cmake-commits] [cmake-commits] king committed cmComputeLinkDepends.cxx 1.34 1.35 cmComputeLinkDepends.h 1.18 1.19 cmExportFileGenerator.cxx 1.18 1.19 cmTarget.cxx 1.267 1.268 cmTarget.h 1.139 1.140

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Sep 1 10:37:40 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1777/Source

Modified Files:
	cmComputeLinkDepends.cxx cmComputeLinkDepends.h 
	cmExportFileGenerator.cxx cmTarget.cxx cmTarget.h 
Log Message:
Define 'multiplicity' for cyclic dependencies

We create target property "LINK_INTERFACE_MULTIPLICITY" and a per-config
version "LINK_INTERFACE_MULTIPLICITY_<CONFIG>".  It sets the number of
times a linker should scan through a mutually dependent group of static
libraries.  The largest value of this property on any target in the
group is used.  This will help projects link even for extreme cases of
cyclic inter-target dependencies.


Index: cmComputeLinkDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C 2 -d -r1.18 -r1.19
*** cmComputeLinkDepends.h	6 Jul 2009 20:25:19 -0000	1.18
--- cmComputeLinkDepends.h	1 Sep 2009 14:37:36 -0000	1.19
***************
*** 154,157 ****
--- 154,158 ----
    void VisitEntry(int index);
    PendingComponent& MakePendingComponent(unsigned int component);
+   int ComputeComponentCount(NodeList const& nl);
    void DisplayFinalEntries();
  

Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.139
retrieving revision 1.140
diff -C 2 -d -r1.139 -r1.140
*** cmTarget.h	11 Aug 2009 13:07:42 -0000	1.139
--- cmTarget.h	1 Sep 2009 14:37:37 -0000	1.140
***************
*** 250,256 ****
--- 250,262 ----
      std::vector<std::string> SharedDeps;
  
+     // Number of repetitions of a strongly connected component of two
+     // or more static libraries.
+     int Multiplicity;
+ 
      // Libraries listed for other configurations.
      // Needed only for OLD behavior of CMP0003.
      std::vector<std::string> WrongConfigLibraries;
+ 
+     LinkInterface(): Multiplicity(0) {}
    };
  

Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -C 2 -d -r1.34 -r1.35
*** cmComputeLinkDepends.cxx	8 Jul 2009 16:04:47 -0000	1.34
--- cmComputeLinkDepends.cxx	1 Sep 2009 14:37:35 -0000	1.35
***************
*** 901,905 ****
      // this component will come first which minimizes the number of
      // repeats needed.
!     pc.Count = 2;
      }
  
--- 901,905 ----
      // this component will come first which minimizes the number of
      // repeats needed.
!     pc.Count = this->ComputeComponentCount(nl);
      }
  
***************
*** 911,914 ****
--- 911,935 ----
  
  //----------------------------------------------------------------------------
+ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
+ {
+   int count = 2;
+   for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+     {
+     if(cmTarget* target = this->EntryList[*ni].Target)
+       {
+       if(cmTarget::LinkInterface const* iface =
+          target->GetLinkInterface(this->Config))
+         {
+         if(iface->Multiplicity > count)
+           {
+           count = iface->Multiplicity;
+           }
+         }
+       }
+     }
+   return count;
+ }
+ 
+ //----------------------------------------------------------------------------
  void cmComputeLinkDepends::DisplayFinalEntries()
  {

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.267
retrieving revision 1.268
diff -C 2 -d -r1.267 -r1.268
*** cmTarget.cxx	11 Aug 2009 13:07:42 -0000	1.267
--- cmTarget.cxx	1 Sep 2009 14:37:36 -0000	1.268
***************
*** 336,339 ****
--- 336,351 ----
  
    cm->DefineProperty
+     ("IMPORTED_LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET,
+      "Repetition count for cycles of IMPORTED static libraries.",
+      "This is LINK_INTERFACE_MULTIPLICITY for IMPORTED targets.");
+   cm->DefineProperty
+     ("IMPORTED_LINK_INTERFACE_MULTIPLICITY_<CONFIG>", cmProperty::TARGET,
+      "Per-configuration repetition count for cycles of IMPORTED archives.",
+      "This is the configuration-specific version of "
+      "IMPORTED_LINK_INTERFACE_MULTIPLICITY.  "
+      "If set, this property completely overrides the generic property "
+      "for the named configuration.");
+ 
+   cm->DefineProperty
      ("IMPORTED_LOCATION", cmProperty::TARGET,
       "Full path to the main file on disk for an IMPORTED target.",
***************
*** 509,512 ****
--- 521,543 ----
  
    cm->DefineProperty
+     ("LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET,
+      "Repetition count for STATIC libraries with cyclic dependencies.",
+      "When linking to a STATIC library target with cyclic dependencies the "
+      "linker may need to scan more than once through the archives in the "
+      "strongly connected component of the dependency graph.  "
+      "CMake by default constructs the link line so that the linker will "
+      "scan through the component at least twice.  "
+      "This property specifies the minimum number of scans if it is larger "
+      "than the default.  "
+      "CMake uses the largest value specified by any target in a component.");
+   cm->DefineProperty
+     ("LINK_INTERFACE_MULTIPLICITY_<CONFIG>", cmProperty::TARGET,
+      "Per-configuration repetition count for cycles of STATIC libraries.",
+      "This is the configuration-specific version of "
+      "LINK_INTERFACE_MULTIPLICITY.  "
+      "If set, this property completely overrides the generic property "
+      "for the named configuration.");
+ 
+   cm->DefineProperty
      ("MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::TARGET,
       "Map from project configuration to IMPORTED target's configuration.",
***************
*** 3878,3881 ****
--- 3909,3928 ----
        }
      }
+ 
+   // Get the cyclic repetition count.
+   if(this->GetType() == cmTarget::STATIC_LIBRARY)
+     {
+     std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
+     linkProp += suffix;
+     if(const char* config_reps = this->GetProperty(linkProp.c_str()))
+       {
+       sscanf(config_reps, "%u", &info.LinkInterface.Multiplicity);
+       }
+     else if(const char* reps =
+             this->GetProperty("IMPORTED_LINK_INTERFACE_MULTIPLICITY"))
+       {
+       sscanf(reps, "%u", &info.LinkInterface.Multiplicity);
+       }
+     }
  }
  
***************
*** 4011,4014 ****
--- 4058,4078 ----
      }
  
+   if(this->GetType() == cmTarget::STATIC_LIBRARY)
+     {
+     // How many repetitions are needed if this library has cyclic
+     // dependencies?
+     std::string propName = "LINK_INTERFACE_MULTIPLICITY";
+     propName += suffix;
+     if(const char* config_reps = this->GetProperty(propName.c_str()))
+       {
+       sscanf(config_reps, "%u", &iface.Multiplicity);
+       }
+     else if(const char* reps =
+             this->GetProperty("LINK_INTERFACE_MULTIPLICITY"))
+       {
+       sscanf(reps, "%u", &iface.Multiplicity);
+       }
+     }
+ 
    return true;
  }

Index: cmExportFileGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExportFileGenerator.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -C 2 -d -r1.18 -r1.19
*** cmExportFileGenerator.cxx	11 Jul 2009 14:12:03 -0000	1.18
--- cmExportFileGenerator.cxx	1 Sep 2009 14:37:36 -0000	1.19
***************
*** 162,165 ****
--- 162,173 ----
                                  "IMPORTED_LINK_DEPENDENT_LIBRARIES",
                                  iface->SharedDeps, properties);
+     if(iface->Multiplicity > 0)
+       {
+       std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
+       prop += suffix;
+       cmOStringStream m;
+       m << iface->Multiplicity;
+       properties[prop] = m.str();
+       }
      }
  }



More information about the Cmake-commits mailing list