[Cmake-commits] [cmake-commits] king committed cmGlobalGenerator.cxx 1.246 1.247 cmGlobalGenerator.h 1.116 1.117 cmLocalUnixMakefileGenerator3.cxx 1.256 1.257 cmLocalUnixMakefileGenerator3.h 1.84 1.85 cmMakefileTargetGenerator.cxx 1.109 1.110

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Feb 2 13:28:14 EST 2009


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

Modified Files:
	cmGlobalGenerator.cxx cmGlobalGenerator.h 
	cmLocalUnixMakefileGenerator3.cxx 
	cmLocalUnixMakefileGenerator3.h cmMakefileTargetGenerator.cxx 
Log Message:
ENH: Refactor custom command rule hashing

This simplifies computation of custom command rule hashes to hash
content exactly chosen as the custom commands are generated.
Unfortunately this will change the hashes of existing build trees from
earlier CMake versions, but this is not a big deal.  The change is
necessary so that in the future we can make optional adjustments to
custom command lines at generate time without changing the hashes every
time the option is changed.


Index: cmLocalUnixMakefileGenerator3.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -C 2 -d -r1.84 -r1.85
*** cmLocalUnixMakefileGenerator3.h	15 Oct 2008 14:40:57 -0000	1.84
--- cmLocalUnixMakefileGenerator3.h	2 Feb 2009 18:28:12 -0000	1.85
***************
*** 333,337 ****
                             bool echo_comment=false,
                             cmLocalGenerator::RelativeRoot relative =
!                            cmLocalGenerator::HOME_OUTPUT);
    void AppendCleanCommand(std::vector<std::string>& commands,
                            const std::vector<std::string>& files,
--- 333,338 ----
                             bool echo_comment=false,
                             cmLocalGenerator::RelativeRoot relative =
!                            cmLocalGenerator::HOME_OUTPUT,
!                            std::ostream* content = 0);
    void AppendCleanCommand(std::vector<std::string>& commands,
                            const std::vector<std::string>& files,

Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -C 2 -d -r1.116 -r1.117
*** cmGlobalGenerator.h	15 Oct 2008 17:56:06 -0000	1.116
--- cmGlobalGenerator.h	2 Feb 2009 18:28:12 -0000	1.117
***************
*** 252,257 ****
  
    void AddRuleHash(const std::vector<std::string>& outputs,
!                    std::vector<std::string>::const_iterator first,
!                    std::vector<std::string>::const_iterator last);
  
  protected:
--- 252,256 ----
  
    void AddRuleHash(const std::vector<std::string>& outputs,
!                    std::string const& content);
  
  protected:

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.246
retrieving revision 1.247
diff -C 2 -d -r1.246 -r1.247
*** cmGlobalGenerator.cxx	10 Nov 2008 18:42:52 -0000	1.246
--- cmGlobalGenerator.cxx	2 Feb 2009 18:28:12 -0000	1.247
***************
*** 2005,2010 ****
  void
  cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
!                                std::vector<std::string>::const_iterator first,
!                                std::vector<std::string>::const_iterator last)
  {
  #if defined(CMAKE_BUILD_WITH_CMAKE)
--- 2005,2009 ----
  void
  cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
!                                std::string const& content)
  {
  #if defined(CMAKE_BUILD_WITH_CMAKE)
***************
*** 2018,2031 ****
    RuleHash hash;
    {
!   unsigned char const* data;
!   int length;
    cmsysMD5* sum = cmsysMD5_New();
    cmsysMD5_Initialize(sum);
!   for(std::vector<std::string>::const_iterator i = first; i != last; ++i)
!     {
!     data = reinterpret_cast<unsigned char const*>(i->c_str());
!     length = static_cast<int>(i->length());
!     cmsysMD5_Append(sum, data, length);
!     }
    cmsysMD5_FinalizeHex(sum, hash.Data);
    cmsysMD5_Delete(sum);
--- 2017,2026 ----
    RuleHash hash;
    {
!   unsigned char const* data =
!     reinterpret_cast<unsigned char const*>(content.c_str());
!   int length = static_cast<int>(content.length());
    cmsysMD5* sum = cmsysMD5_New();
    cmsysMD5_Initialize(sum);
!   cmsysMD5_Append(sum, data, length);
    cmsysMD5_FinalizeHex(sum, hash.Data);
    cmsysMD5_Delete(sum);

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.256
retrieving revision 1.257
diff -C 2 -d -r1.256 -r1.257
*** cmLocalUnixMakefileGenerator3.cxx	16 Dec 2008 14:14:40 -0000	1.256
--- cmLocalUnixMakefileGenerator3.cxx	2 Feb 2009 18:28:12 -0000	1.257
***************
*** 969,973 ****
  ::AppendCustomCommand(std::vector<std::string>& commands,
                        const cmCustomCommand& cc, bool echo_comment,
!                       cmLocalGenerator::RelativeRoot relative)
  {
    // Optionally create a command to display the custom command's
--- 969,974 ----
  ::AppendCustomCommand(std::vector<std::string>& commands,
                        const cmCustomCommand& cc, bool echo_comment,
!                       cmLocalGenerator::RelativeRoot relative,
!                       std::ostream* content)
  {
    // Optionally create a command to display the custom command's
***************
*** 992,995 ****
--- 993,1000 ----
      dir = workingDir;
      }
+   if(content)
+     {
+     *content << dir;
+     }
    bool escapeOldStyle = cc.GetEscapeOldStyle();
    bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars();
***************
*** 1049,1052 ****
--- 1054,1061 ----
            }
          }
+       if(content)
+         {
+         *content << cmd;
+         }
        if(this->BorlandMakeCurlyHack)
          {

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.109
retrieving revision 1.110
diff -C 2 -d -r1.109 -r1.110
*** cmMakefileTargetGenerator.cxx	15 Oct 2008 14:40:57 -0000	1.109
--- cmMakefileTargetGenerator.cxx	2 Feb 2009 18:28:12 -0000	1.110
***************
*** 1120,1128 ****
                     cmLocalUnixMakefileGenerator3::EchoGenerate);
      }
-   // Below we need to skip over the echo and progress commands.
-   unsigned int skip = static_cast<unsigned int>(commands.size());
  
    // Now append the actual user-specified commands.
!   this->LocalGenerator->AppendCustomCommand(commands, cc);
  
    // Collect the dependencies.
--- 1120,1129 ----
                     cmLocalUnixMakefileGenerator3::EchoGenerate);
      }
  
    // Now append the actual user-specified commands.
!   cmOStringStream content;
!   this->LocalGenerator->AppendCustomCommand(commands, cc, false,
!                                             cmLocalGenerator::HOME_OUTPUT,
!                                             &content);
  
    // Collect the dependencies.
***************
*** 1152,1158 ****
    if(!symbolic)
      {
!     this->GlobalGenerator->AddRuleHash(cc.GetOutputs(),
!                                        commands.begin()+skip,
!                                        commands.end());
      }
    }
--- 1153,1157 ----
    if(!symbolic)
      {
!     this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), content.str());
      }
    }



More information about the Cmake-commits mailing list