Browse Source

fixed commands that were setting definitions in final pass to set definitions in initial pass

Ken Martin 23 years ago
parent
commit
0b88e57e54

+ 15 - 14
Source/cmQTWrapCPPCommand.cxx

@@ -49,6 +49,15 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn)
   m_LibraryName = args[0];
   m_SourceList = args[1];
   
+  std::string sourceListValue;
+
+  // was the list already populated
+  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
+  if (def)
+    {
+    sourceListValue = def;
+    }
+
   // get the list of classes for this library
   for(std::vector<std::string>::iterator j = (args.begin() + 2);
       j != args.end(); ++j)
@@ -72,9 +81,15 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn)
       // add starting depends
       file.GetDepends().push_back(hname);
       m_WrapClasses.push_back(file);
+      if (sourceListValue.size() > 0)
+        {
+        sourceListValue += ";";
+        }
+      sourceListValue += newName + ".cxx";
       }
     }
   
+  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
   return true;
 }
 
@@ -85,14 +100,6 @@ void cmQTWrapCPPCommand::FinalPass()
   size_t lastClass = m_WrapClasses.size();
   std::vector<std::string> depends;
   std::string moc_exe = "${QT_MOC_EXE}";
-  std::string sourceListValue;
-
-  // was the list already populated
-  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
-  if (def)
-    {
-    sourceListValue = def;
-    }
 
   // wrap all the .h files
   depends.push_back(moc_exe);
@@ -109,11 +116,6 @@ void cmQTWrapCPPCommand::FinalPass()
     {
     // Add output to build list
     m_Makefile->AddSource(m_WrapClasses[classNum]);
-    if (sourceListValue.size() > 0)
-      {
-      sourceListValue += ";";
-      }
-    sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
 
     // set up moc command
     std::string res = m_Makefile->GetCurrentOutputDirectory();
@@ -134,7 +136,6 @@ void cmQTWrapCPPCommand::FinalPass()
     }
 
   m_Makefile->AddDefinition("GENERATED_QT_FILES",moc_list.c_str());
-  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
 }
 
 

+ 13 - 14
Source/cmVTKWrapJavaCommand.cxx

@@ -40,6 +40,13 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
   // keep the library name
   m_LibraryName = args[0];
   m_SourceList = args[1];
+  std::string sourceListValue;
+  // was the list already populated
+  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
+  if (def)
+    {
+    sourceListValue = def;
+    }
   
   // get the list of classes for this library
   for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
@@ -65,9 +72,15 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
       file.GetDepends().push_back(hname);
       m_WrapClasses.push_back(file);
       m_OriginalNames.push_back(srcName);
+      if (sourceListValue.size() > 0)
+        {
+        sourceListValue += ";";
+        }
+      sourceListValue += newName + ".cxx";
       }
     }
   
+  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());  
   return true;
 }
 
@@ -83,17 +96,9 @@ void cmVTKWrapJavaCommand::FinalPass()
   std::string pjava = "${VTK_PARSE_JAVA_EXE}";
   std::string hints = "${VTK_WRAP_HINTS}";
   std::string resultDirectory = "${VTK_JAVA_HOME}";
-  std::string sourceListValue;
 
   m_Makefile->ExpandVariablesInString(hints);
 
-  // was the list already populated
-  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
-  if (def)
-    {
-    sourceListValue = def;
-    }
-
   // wrap all the .h files
   depends.push_back(wjava);
   depends2.push_back(pjava);
@@ -105,11 +110,6 @@ void cmVTKWrapJavaCommand::FinalPass()
   for(size_t classNum = 0; classNum < lastClass; classNum++)
     {
     m_Makefile->AddSource(m_WrapClasses[classNum]);
-    if (sourceListValue.size() > 0)
-      {
-      sourceListValue += ";";
-      }
-    sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
 
     // wrap java
     std::string res = m_Makefile->GetCurrentOutputDirectory();
@@ -153,7 +153,6 @@ void cmVTKWrapJavaCommand::FinalPass()
                                 alldepends,
                                 empty);
   
-  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());  
 }
 
 

+ 27 - 28
Source/cmVTKWrapPythonCommand.cxx

@@ -41,7 +41,30 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& argsIn)
   // keep the library name
   m_LibraryName = args[0];
   m_SourceList = args[1];
-  
+  std::string sourceListValue;
+  // was the list already populated
+  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
+  if (def)
+    {
+    sourceListValue = def;
+    sourceListValue += ";";
+    }
+
+  // Create the init file 
+  std::string res = m_LibraryName;
+  res += "Init.cxx";
+  this->CreateInitFile(res);
+
+  // add the init file
+  cmSourceFile cfile;
+  cfile.SetIsAnAbstractClass(false);
+  std::string newName = m_LibraryName;
+  newName += "Init";
+  cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
+                "cxx",false);
+  m_Makefile->AddSource(cfile);
+  sourceListValue += newName + ".cxx";
+
   // get the list of classes for this library
   for(std::vector<std::string>::iterator j = (args.begin() + 2);
       j != args.end(); ++j)
@@ -65,9 +88,12 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& argsIn)
       // add starting depends
       file.GetDepends().push_back(hname);
       m_WrapClasses.push_back(file);
+      sourceListValue += ";";
+      sourceListValue += newName + ".cxx";
       }
     }
   
+  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
   return true;
 }
 
@@ -78,32 +104,8 @@ void cmVTKWrapPythonCommand::FinalPass()
   std::vector<std::string> depends;
   std::string wpython = "${VTK_WRAP_PYTHON_EXE}";
   std::string hints = "${VTK_WRAP_HINTS}";
-  std::string sourceListValue;
 
   m_Makefile->ExpandVariablesInString(hints);
-  
-  // was the list already populated
-  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
-  if (def)
-    {
-    sourceListValue = def;
-    sourceListValue += ";";
-    }
-
-  // Create the init file 
-  std::string res = m_LibraryName;
-  res += "Init.cxx";
-  this->CreateInitFile(res);
-  
-  // add the init file
-  cmSourceFile cfile;
-  cfile.SetIsAnAbstractClass(false);
-  std::string newName = m_LibraryName;
-  newName += "Init";
-  cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
-                "cxx",false);
-  m_Makefile->AddSource(cfile);
-  sourceListValue += newName + ".cxx";
 
   // wrap all the .h files
   depends.push_back(wpython);
@@ -125,14 +127,11 @@ void cmVTKWrapPythonCommand::FinalPass()
       }
     args.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1"));
     args.push_back(res);
-    sourceListValue += ";";
-    sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
 
     m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
                                  wpython.c_str(), args, depends, 
                                  res.c_str(), m_LibraryName.c_str());
     }
-  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
 }
 
 bool cmVTKWrapPythonCommand::CreateInitFile(std::string& res) 

+ 28 - 29
Source/cmVTKWrapTclCommand.cxx

@@ -81,7 +81,31 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
 
     // get the resulting source list name
     m_SourceList = sources[0];
-
+    std::string sourceListValue;
+    
+    // was the list already populated
+    const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
+    if (def)
+      {
+      sourceListValue = def;
+      sourceListValue += ";";
+      }
+    
+    // Create the init file 
+    std::string res = m_LibraryName;
+    res += "Init.cxx";
+    this->CreateInitFile(res);
+    
+    // add the init file
+    cmSourceFile cfile;
+    cfile.SetIsAnAbstractClass(false);
+    std::string newName = m_LibraryName;
+    newName += "Init";
+    cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
+                  "cxx",false);
+    m_Makefile->AddSource(cfile);
+    sourceListValue += newName + ".cxx";
+    
     for(std::vector<std::string>::iterator j = (sources.begin() + 1);
         j != sources.end(); ++j)
       {   
@@ -104,8 +128,11 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
         // add starting depends
         file.GetDepends().push_back(hname);
         m_WrapClasses.push_back(file);
+        sourceListValue += ";";
+        sourceListValue += newName + ".cxx";
         }
       }
+    m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());  
     }
   
   return true;
@@ -120,30 +147,6 @@ void cmVTKWrapTclCommand::FinalPass()
   std::string hints = "${VTK_WRAP_HINTS}";
   
   m_Makefile->ExpandVariablesInString(hints);
-  std::string sourceListValue;
-  
-  // was the list already populated
-  const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());  
-  if (def)
-    {
-    sourceListValue = def;
-    sourceListValue += ";";
-    }
-
-  // Create the init file 
-  std::string res = m_LibraryName;
-  res += "Init.cxx";
-  this->CreateInitFile(res);
-  
-  // add the init file
-  cmSourceFile cfile;
-  cfile.SetIsAnAbstractClass(false);
-  std::string newName = m_LibraryName;
-  newName += "Init";
-  cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
-                "cxx",false);
-  m_Makefile->AddSource(cfile);
-  sourceListValue += newName + ".cxx";
 
   // wrap all the .h files
   depends.push_back(wtcl);
@@ -165,15 +168,11 @@ void cmVTKWrapTclCommand::FinalPass()
     res += "/";
     res += m_WrapClasses[classNum].GetSourceName() + ".cxx";
     args.push_back(res);
-    sourceListValue += ";";
-    sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
     
     m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
                                  wtcl.c_str(), args, depends, 
                                  res.c_str(), m_LibraryName.c_str());
-
     }
-  m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());  
 }
 
 bool cmVTKWrapTclCommand::CreateInitFile(std::string& res)