[cmake-commits] king committed cmLocalUnixMakefileGenerator3.cxx 1.214 1.215 cmLocalUnixMakefileGenerator3.h 1.74 1.75 cmMakefileTargetGenerator.cxx 1.67 1.68

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Aug 7 13:57:15 EDT 2007


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

Modified Files:
	cmLocalUnixMakefileGenerator3.cxx 
	cmLocalUnixMakefileGenerator3.h cmMakefileTargetGenerator.cxx 
Log Message:
ENH: Replaced dependency integrity map with an explicit map from object file to source file for each language in each target.  This simplifies creation of implicit dependency scanning rules and allows more than one object file in a target to start dependency scanning with the same source file.


Index: cmLocalUnixMakefileGenerator3.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.h,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- cmLocalUnixMakefileGenerator3.h	1 Aug 2007 19:25:40 -0000	1.74
+++ cmLocalUnixMakefileGenerator3.h	7 Aug 2007 17:57:13 -0000	1.75
@@ -211,15 +211,18 @@
 
   std::string GetRelativeTargetDirectory(cmTarget& target);
 
-  // List the files for which to check dependency integrity.  Each
-  // language has its own list because integrity may be checked
-  // differently.
-  struct IntegrityCheckSet: public std::set<cmSourceFile *> {};
-  struct IntegrityCheckSetMap: public std::map<cmStdString, IntegrityCheckSet>
-  {};
-  std::map<cmStdString, IntegrityCheckSetMap> &GetIntegrityCheckSet() 
-  { return this->CheckDependFiles;}
-  
+  // File pairs for implicit dependency scanning.  The key of the map
+  // is the depender and the value is the explicit dependee.
+  struct ImplicitDependFileMap: public std::map<cmStdString, cmStdString> {};
+  struct ImplicitDependLanguageMap:
+    public std::map<cmStdString, ImplicitDependFileMap> {};
+  struct ImplicitDependTargetMap:
+    public std::map<cmStdString, ImplicitDependLanguageMap> {};
+  ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt);
+
+  void AddImplicitDepends(cmTarget const& tgt, const char* lang,
+                          const char* obj, const char* src);
+
   void AppendGlobalTargetDepends(std::vector<std::string>& depends,
                                  cmTarget& target);
 
@@ -323,8 +326,8 @@
   friend class cmMakefileLibraryTargetGenerator;
   friend class cmMakefileUtilityTargetGenerator;
   friend class cmGlobalUnixMakefileGenerator3;
-  
-  std::map<cmStdString, IntegrityCheckSetMap> CheckDependFiles;
+
+  ImplicitDependTargetMap ImplicitDepends;
 
   //==========================================================================
   // Configuration settings.

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -d -r1.214 -r1.215
--- cmLocalUnixMakefileGenerator3.cxx	3 Aug 2007 20:31:08 -0000	1.214
+++ cmLocalUnixMakefileGenerator3.cxx	7 Aug 2007 17:57:13 -0000	1.215
@@ -1644,52 +1644,37 @@
 void cmLocalUnixMakefileGenerator3
 ::WriteDependLanguageInfo(std::ostream& cmakefileStream, cmTarget &target)
 {
-  // now write all the language stuff
-  // Set the set of files to check for dependency integrity.
-  std::set<cmStdString> checkSetLangs;
-  std::map<cmStdString,cmLocalUnixMakefileGenerator3::IntegrityCheckSet>& 
-    checkSet = this->GetIntegrityCheckSet()[target.GetName()];
-  for(std::map<cmStdString, 
-        cmLocalUnixMakefileGenerator3::IntegrityCheckSet>::const_iterator
-        l = checkSet.begin(); l != checkSet.end(); ++l)
-    {
-    checkSetLangs.insert(l->first);
-    }
-  
+  ImplicitDependLanguageMap const& implicitLangs =
+    this->GetImplicitDepends(target);
+
   // list the languages
   cmakefileStream
-    << "# The set of files whose dependency integrity should be checked:\n";
+    << "# The set of languages for which implicit dependencies are needed:\n";
   cmakefileStream
     << "SET(CMAKE_DEPENDS_LANGUAGES\n";
-  for(std::set<cmStdString>::iterator
-        l = checkSetLangs.begin(); l != checkSetLangs.end(); ++l)
+  for(ImplicitDependLanguageMap::const_iterator
+        l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
     {
-    cmakefileStream << "  \"" << l->c_str() << "\"\n";
+    cmakefileStream << "  \"" << l->first.c_str() << "\"\n";
     }
   cmakefileStream << "  )\n";
-  
+
   // now list the files for each language
-  for(std::set<cmStdString>::iterator
-        l = checkSetLangs.begin(); l != checkSetLangs.end(); ++l)
+  cmakefileStream
+    << "# The set of files for implicit dependencies of each language:\n";
+  for(ImplicitDependLanguageMap::const_iterator
+        l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
     {
     cmakefileStream
-      << "SET(CMAKE_DEPENDS_CHECK_" << l->c_str() << "\n";
-    // get the check set for this local gen and language
-    cmLocalUnixMakefileGenerator3::IntegrityCheckSet iCheckSet = 
-      checkSet[*l];
-    // for each file
-    for(cmLocalUnixMakefileGenerator3::IntegrityCheckSet::const_iterator 
-          csIter = iCheckSet.begin();
-        csIter != iCheckSet.end(); ++csIter)
+      << "SET(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n";
+    ImplicitDependFileMap const& implicitPairs = l->second;
+
+    // for each file pair
+    for(ImplicitDependFileMap::const_iterator pi = implicitPairs.begin();
+        pi != implicitPairs.end(); ++pi)
       {
-      cmakefileStream << "  \"" << (*csIter)->GetFullPath() << "\"\n";
-      // Get the full path name of the object file.
-      std::string obj = this->Makefile->GetStartOutputDirectory();
-      obj += "/";
-      obj += this->GetObjectFileName(target, **csIter);
-      cmakefileStream << "  \"" << 
-        this->Convert(obj.c_str(),
-                      cmLocalGenerator::FULL).c_str() << "\"\n";
+      cmakefileStream << "  \"" << pi->second << "\" ";
+      cmakefileStream << "\"" << pi->first << "\"\n";
       }
     cmakefileStream << "  )\n";
     }
@@ -1926,6 +1911,24 @@
   return dir;
 }
 
+//----------------------------------------------------------------------------
+cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const&
+cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt)
+{
+  return this->ImplicitDepends[tgt.GetName()];
+}
+
+//----------------------------------------------------------------------------
+void
+cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt,
+                                                  const char* lang,
+                                                  const char* obj,
+                                                  const char* src)
+{
+  this->ImplicitDepends[tgt.GetName()][lang][obj] = src;
+}
+
+//----------------------------------------------------------------------------
 void cmLocalUnixMakefileGenerator3
 ::CreateCDCommand(std::vector<std::string>& commands, const char *tgtDir,
                   const char *retDir)

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- cmMakefileTargetGenerator.cxx	2 Aug 2007 17:38:39 -0000	1.67
+++ cmMakefileTargetGenerator.cxx	7 Aug 2007 17:57:13 -0000	1.68
@@ -341,8 +341,18 @@
   this->WriteObjectBuildFile(obj, lang, source, depends);
 
   // The object file should be checked for dependency integrity.
+  std::string objFullPath = this->Makefile->GetCurrentOutputDirectory();
+  objFullPath += "/";
+  objFullPath += obj;
+  objFullPath =
+    this->Convert(objFullPath.c_str(), cmLocalGenerator::FULL);
+  std::string srcFullPath =
+    this->Convert(source.GetFullPath().c_str(), cmLocalGenerator::FULL);
   this->LocalGenerator->
-    CheckDependFiles[this->Target->GetName()][lang].insert(&source);
+    AddImplicitDepends(*this->Target, lang,
+                       objFullPath.c_str(),
+                       srcFullPath.c_str());
+
   // add this to the list of objects for this local generator
   if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
     {



More information about the Cmake-commits mailing list