[cmake-commits] alex committed cmGlobalGenerator.cxx 1.196 1.197 cmGlobalGenerator.h 1.88 1.89 cmLocalGenerator.cxx 1.229 1.230 cmMakefile.cxx 1.404 1.405 cmMessageCommand.cxx 1.20 1.21 cmakemain.cxx 1.61 1.62

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Jul 17 09:25:11 EDT 2007


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

Modified Files:
	cmGlobalGenerator.cxx cmGlobalGenerator.h cmLocalGenerator.cxx 
	cmMakefile.cxx cmMessageCommand.cxx cmakemain.cxx 
Log Message:

ENH: produce a lot more output when running with --debug-output
-try to fix build error on HPUX

Alex


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -d -r1.229 -r1.230
--- cmLocalGenerator.cxx	21 Jun 2007 17:08:22 -0000	1.229
+++ cmLocalGenerator.cxx	17 Jul 2007 13:25:08 -0000	1.230
@@ -65,6 +65,9 @@
 
 void cmLocalGenerator::Configure()
 {
+  cmLocalGenerator* previousLg = this->GetGlobalGenerator()->GetCurrentLocalGenerator();
+  this->GetGlobalGenerator()->SetCurrentLocalGenerator(this);
+
   // make sure the CMakeFiles dir is there
   std::string filesDir = this->Makefile->GetStartOutputDirectory();
   filesDir += cmake::GetCMakeFilesDirectory();
@@ -94,6 +97,8 @@
   this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
 
   this->Configured = true;
+
+  this->GetGlobalGenerator()->SetCurrentLocalGenerator(previousLg);
 }
 
 void cmLocalGenerator::SetupPathConversions()

Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- cmGlobalGenerator.h	12 Jul 2007 12:37:00 -0000	1.88
+++ cmGlobalGenerator.h	17 Jul 2007 13:25:08 -0000	1.89
@@ -122,6 +122,12 @@
   const std::vector<cmLocalGenerator *>& GetLocalGenerators() const { 
     return this->LocalGenerators;}
 
+  cmLocalGenerator* GetCurrentLocalGenerator() 
+                                          {return this->CurrentLocalGenerator;}
+
+  void SetCurrentLocalGenerator(cmLocalGenerator* lg) 
+                                            {this->CurrentLocalGenerator = lg;}
+
   void AddLocalGenerator(cmLocalGenerator *lg);
 
   ///! Set an generator for an "external makefile based project"
@@ -235,6 +241,7 @@
   cmStdString ConfiguredFilesPath;
   cmake *CMakeInstance;
   std::vector<cmLocalGenerator *> LocalGenerators;
+  cmLocalGenerator* CurrentLocalGenerator;
   // map from project name to vector of local generators in that project
   std::map<cmStdString, std::vector<cmLocalGenerator*> > ProjectMap;
   std::map<cmStdString, std::set<cmTarget*> > ProjectToTargetMap;

Index: cmMessageCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMessageCommand.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cmMessageCommand.cxx	6 Oct 2006 15:11:59 -0000	1.20
+++ cmMessageCommand.cxx	17 Jul 2007 13:25:08 -0000	1.21
@@ -59,14 +59,7 @@
 
   if (send_error || fatal_error)
     {
-    if( !this->Makefile->GetCMakeInstance()->GetDebugOutput())
-      {
-      cmSystemTools::Error(message.c_str());
-      }
-    else
-      {
-      this->SetError(message.c_str());
-      }
+    cmSystemTools::Error(message.c_str());
     }
   else
     {
@@ -83,11 +76,6 @@
     {
     cmSystemTools::SetFatalErrorOccured();
     }
-  // if debug is on then retru
-  if(this->Makefile->GetCMakeInstance()->GetDebugOutput())
-    {
-    return (!send_error && !fatal_error);
-    }
   return true;
 }
 

Index: cmakemain.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmakemain.cxx,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cmakemain.cxx	11 Jul 2007 19:53:58 -0000	1.61
+++ cmakemain.cxx	17 Jul 2007 13:25:08 -0000	1.62
@@ -19,6 +19,9 @@
 #include "cmListFileCache.h"
 #include "cmakewizard.h"
 #include "cmSourceFile.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
 #include "cmDynamicLoader.h"
@@ -172,7 +175,70 @@
 #endif
 
 int do_cmake(int ac, char** av);
-void updateProgress(const char *msg, float prog, void *cd);
+
+static cmMakefile* cmakemainGetMakefile(void *clientdata)
+{
+  cmake* cm = (cmake *)clientdata;
+  if(cm && cm->GetDebugOutput())
+    {
+    cmGlobalGenerator* gg=cm->GetGlobalGenerator();
+    if (gg)
+      {
+      cmLocalGenerator* lg=gg->GetCurrentLocalGenerator();
+      if (lg)
+        {
+        cmMakefile* mf = lg->GetMakefile();
+        return mf;
+        }
+      }
+    }
+  return 0;
+}
+
+static std::string cmakemainGetStack(void *clientdata)
+{
+  std::string msg;
+  cmMakefile* mf=cmakemainGetMakefile(clientdata);
+  if (mf)
+    {
+    msg = mf->GetListFileStack();
+    if (!msg.empty())
+      {
+      msg = "\nCalled from: " + msg;
+      }
+    }
+
+  return msg;
+}
+
+static void cmakemainErrorCallback(const char* m, const char* title, bool& nomore, void *clientdata)
+{
+  std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush;
+}
+
+static void cmakemainProgressCallback(const char *m, float prog, void* clientdata)
+{
+  cmMakefile* mf = cmakemainGetMakefile(clientdata);
+  std::string dir;
+  if ((mf) && (strstr(m, "Configuring")==m))
+    {
+    dir = " ";
+    dir += mf->GetCurrentDirectory();
+    }
+  else if ((mf) && (strstr(m, "Generating")==m))
+    {
+    dir = " ";
+    dir += mf->GetCurrentOutputDirectory();
+    }
+
+  if ((prog < 0) || (!dir.empty()))
+    {
+    std::cout << "-- " << m << dir << cmakemainGetStack(clientdata) << std::endl;
+    }
+
+  std::cout.flush();
+}
+
 
 int main(int ac, char** av)
 {
@@ -355,8 +421,10 @@
     return ret; 
     }
   cmake cm;  
-  cm.SetProgressCallback(updateProgress, 0);
+  cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
+  cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
   cm.SetScriptMode(script_mode);
+
   int res = cm.Run(args, view_only);
   if ( list_cached || list_all_cached )
     {
@@ -390,14 +458,3 @@
   return res;
 }
 
-void updateProgress(const char *msg, float prog, void*)
-{
-  if ( prog < 0 )
-    {
-    std::cout << "-- " << msg << std::endl;
-    }
-  //else
-  //{
-  //std::cout << "-- " << msg << " " << prog << std::endl;
-  //}
-}

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -d -r1.196 -r1.197
--- cmGlobalGenerator.cxx	12 Jul 2007 12:37:00 -0000	1.196
+++ cmGlobalGenerator.cxx	17 Jul 2007 13:25:08 -0000	1.197
@@ -52,6 +52,7 @@
   this->TryCompileTimeout = 0;
 
   this->ExtraGenerator = 0;
+  this->CurrentLocalGenerator = 0;
 }
 
 cmGlobalGenerator::~cmGlobalGenerator()
@@ -845,12 +846,14 @@
   // Generate project files
   for (i = 0; i < this->LocalGenerators.size(); ++i)
     {
+    this->SetCurrentLocalGenerator(this->LocalGenerators[i]);
     this->LocalGenerators[i]->Generate();
     this->LocalGenerators[i]->GenerateInstallRules();
     this->LocalGenerators[i]->GenerateTestFiles();
     this->CMakeInstance->UpdateProgress("Generating",
                                     (i+1.0f)/this->LocalGenerators.size());
     }
+  this->SetCurrentLocalGenerator(0);
 
   if (this->ExtraGenerator != 0)
     {

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.404
retrieving revision 1.405
diff -u -d -r1.404 -r1.405
--- cmMakefile.cxx	16 Jul 2007 17:26:56 -0000	1.404
+++ cmMakefile.cxx	17 Jul 2007 13:25:08 -0000	1.405
@@ -306,7 +306,7 @@
       error << "Error in cmake code at\n"
             << lff.FilePath << ":" << lff.Line << ":\n"
             << rm->GetError() << std::endl
-            << "Current CMake stack: " << this->GetListFileStack().c_str();
+            << "Called from: " << this->GetListFileStack().c_str();
       cmSystemTools::Error(error.str().c_str());
       return false;
       }
@@ -323,7 +323,7 @@
         error << "Error in cmake code at\n"
               << lff.FilePath << ":" << lff.Line << ":\n"
               << usedCommand->GetError() << std::endl
-              << "Current CMake stack: " << this->GetListFileStack().c_str();
+              << "Called from: " << this->GetListFileStack().c_str();
         cmSystemTools::Error(error.str().c_str());
         result = false;
         if ( this->GetCMakeInstance()->GetScriptMode() )
@@ -2607,7 +2607,7 @@
     }
   else if (!strcmp("LISTFILE_STACK",prop))
     {
-    for (std::deque<cmStdString>::const_iterator i = this->ListFileStack.begin();
+    for (std::deque<cmStdString>::iterator i = this->ListFileStack.begin();
          i != this->ListFileStack.end(); ++i)
       {
       if (i != this->ListFileStack.begin())
@@ -2774,17 +2774,24 @@
 {
   cmOStringStream tmp;
   size_t depth = this->ListFileStack.size();
-  std::deque<cmStdString>::iterator it = this->ListFileStack.end();
-  do
+  if (depth > 0)
     {
-    --it;
-    tmp << "\n[";
-    tmp << depth;
-    tmp << "]\t";
-    tmp << *it;
-    depth--;
+    std::deque<cmStdString>::iterator it = this->ListFileStack.end();
+    do
+      {
+      if (depth != this->ListFileStack.size())
+        {
+        tmp << "\n             ";
+        }
+      --it;
+      tmp << "[";
+      tmp << depth;
+      tmp << "]\t";
+      tmp << *it;
+      depth--;
+      }
+    while (it != this->ListFileStack.begin());
     }
-  while (it != this->ListFileStack.begin());
   return tmp.str();
 }
 



More information about the Cmake-commits mailing list