[Cmake-commits] [cmake-commits] king committed cmLocalGenerator.cxx 1.290 1.291 cmLocalGenerator.h 1.108 1.109 cmLocalUnixMakefileGenerator3.cxx 1.259 1.260 cmLocalUnixMakefileGenerator3.h 1.87 1.88 cmMakefile.cxx 1.503 1.504 cmMakefileExecutableTargetGenerator.cxx 1.53 1.54 cmMakefileLibraryTargetGenerator.cxx 1.68 1.69 cmMakefileTargetGenerator.cxx 1.113 1.114 cmTarget.cxx 1.234 1.235 cmake.cxx 1.405 1.406

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 10 08:51:19 EST 2009


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

Modified Files:
	cmLocalGenerator.cxx cmLocalGenerator.h 
	cmLocalUnixMakefileGenerator3.cxx 
	cmLocalUnixMakefileGenerator3.h cmMakefile.cxx 
	cmMakefileExecutableTargetGenerator.cxx 
	cmMakefileLibraryTargetGenerator.cxx 
	cmMakefileTargetGenerator.cxx cmTarget.cxx cmake.cxx 
Log Message:
ENH: Define RULE_LAUNCH_* properties

This defines global, directory, and target properties
RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM.  Their
values specify 'launcher' command lines which are prefixed to compile,
link, and custom build rules by Makefile generators.


Index: cmLocalUnixMakefileGenerator3.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -C 2 -d -r1.87 -r1.88
*** cmLocalUnixMakefileGenerator3.h	10 Feb 2009 13:50:33 -0000	1.87
--- cmLocalUnixMakefileGenerator3.h	10 Feb 2009 13:51:13 -0000	1.88
***************
*** 348,351 ****
--- 348,354 ----
  
  private:
+   std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target,
+                            RelativeRoot relative);
+ 
    friend class cmMakefileTargetGenerator;
    friend class cmMakefileExecutableTargetGenerator;

Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.290
retrieving revision 1.291
diff -C 2 -d -r1.290 -r1.291
*** cmLocalGenerator.cxx	4 Feb 2009 15:34:10 -0000	1.290
--- cmLocalGenerator.cxx	10 Feb 2009 13:51:13 -0000	1.291
***************
*** 1035,1038 ****
--- 1035,1040 ----
    std::vector<std::string> enabledLanguages;
    this->GlobalGenerator->GetEnabledLanguages(enabledLanguages);
+   this->InsertRuleLauncher(s, replaceValues.CMTarget,
+                            replaceValues.RuleLauncher);
    std::string::size_type start = s.find('<');
    // no variables to expand
***************
*** 1077,1080 ****
--- 1079,1108 ----
  
  //----------------------------------------------------------------------------
+ const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target,
+                                               const char* prop)
+ {
+   if(target)
+     {
+     return target->GetProperty(prop);
+     }
+   else
+     {
+     return this->Makefile->GetProperty(prop);
+     }
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
+                                           const char* prop)
+ {
+   if(const char* val = this->GetRuleLauncher(target, prop))
+     {
+     cmOStringStream wrapped;
+     wrapped << val << " " << s;
+     s = wrapped.str();
+     }
+ }
+ 
+ //----------------------------------------------------------------------------
  std::string
  cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,

Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.108
retrieving revision 1.109
diff -C 2 -d -r1.108 -r1.109
*** cmLocalGenerator.h	16 Dec 2008 14:15:18 -0000	1.108
--- cmLocalGenerator.h	10 Feb 2009 13:51:13 -0000	1.109
***************
*** 204,207 ****
--- 204,208 ----
          memset(this, 0,  sizeof(*this));
        }
+     cmTarget* CMTarget;
      const char* TargetPDB;
      const char* TargetVersionMajor;
***************
*** 223,226 ****
--- 224,228 ----
      const char* LanguageCompileFlags;
      const char* Defines;
+     const char* RuleLauncher;
    };
  
***************
*** 318,321 ****
--- 320,328 ----
    std::string ExpandRuleVariable(std::string const& variable,
                                   const RuleVariables& replaceValues);
+ 
+   const char* GetRuleLauncher(cmTarget* target, const char* prop);
+   void InsertRuleLauncher(std::string& s, cmTarget* target,
+                           const char* prop);
+ 
    
    /** Convert a target to a utility target for unsupported 

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.405
retrieving revision 1.406
diff -C 2 -d -r1.405 -r1.406
*** cmake.cxx	6 Feb 2009 16:49:00 -0000	1.405
--- cmake.cxx	10 Feb 2009 13:51:15 -0000	1.406
***************
*** 3445,3448 ****
--- 3445,3473 ----
       "Set to list of currently enabled lanauges.");
  
+   cm->DefineProperty
+     ("RULE_LAUNCH_COMPILE", cmProperty::GLOBAL,
+      "Specify a launcher for compile rules.",
+      "Makefile generators prefix compiler commands with the given "
+      "launcher command line.  "
+      "This is intended to allow launchers to intercept build problems "
+      "with high granularity.  "
+      "Non-Makefile generators currently ignore this property.");
+   cm->DefineProperty
+     ("RULE_LAUNCH_LINK", cmProperty::GLOBAL,
+      "Specify a launcher for link rules.",
+      "Makefile generators prefix link and archive commands with the given "
+      "launcher command line.  "
+      "This is intended to allow launchers to intercept build problems "
+      "with high granularity.  "
+      "Non-Makefile generators currently ignore this property.");
+   cm->DefineProperty
+     ("RULE_LAUNCH_CUSTOM", cmProperty::GLOBAL,
+      "Specify a launcher for custom rules.",
+      "Makefile generators prefix custom commands with the given "
+      "launcher command line.  "
+      "This is intended to allow launchers to intercept build problems "
+      "with high granularity.  "
+      "Non-Makefile generators currently ignore this property.");
+ 
    // ================================================================
    // define variables as well

Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.68
retrieving revision 1.69
diff -C 2 -d -r1.68 -r1.69
*** cmMakefileLibraryTargetGenerator.cxx	10 Feb 2009 13:50:33 -0000	1.68
--- cmMakefileLibraryTargetGenerator.cxx	10 Feb 2009 13:51:13 -0000	1.69
***************
*** 714,717 ****
--- 714,719 ----
    vars.TargetVersionMinor = targetVersionMinor.c_str();
  
+   vars.RuleLauncher = "RULE_LAUNCH_LINK";
+   vars.CMTarget = this->Target;
    vars.Language = linkLanguage;
    vars.Objects = buildObjs.c_str();

Index: cmMakefileExecutableTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v
retrieving revision 1.53
retrieving revision 1.54
diff -C 2 -d -r1.53 -r1.54
*** cmMakefileExecutableTargetGenerator.cxx	10 Feb 2009 13:50:33 -0000	1.53
--- cmMakefileExecutableTargetGenerator.cxx	10 Feb 2009 13:51:13 -0000	1.54
***************
*** 361,364 ****
--- 361,366 ----
  
    cmLocalGenerator::RuleVariables vars;
+   vars.RuleLauncher = "RULE_LAUNCH_LINK";
+   vars.CMTarget = this->Target;
    vars.Language = linkLanguage;
    vars.Objects = buildObjs.c_str();

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.259
retrieving revision 1.260
diff -C 2 -d -r1.259 -r1.260
*** cmLocalUnixMakefileGenerator3.cxx	10 Feb 2009 13:50:32 -0000	1.259
--- cmLocalUnixMakefileGenerator3.cxx	10 Feb 2009 13:51:13 -0000	1.260
***************
*** 975,979 ****
                        std::ostream* content)
  {
-   static_cast<void>(target); // Future use
    // Optionally create a command to display the custom command's
    // comment text.  This is used for pre-build, pre-link, and
--- 975,978 ----
***************
*** 1044,1048 ****
            }
          }
!       cmd = this->Convert(cmd.c_str(),NONE,SHELL);
        for(unsigned int j=1; j < commandLine.size(); ++j)
          {
--- 1043,1049 ----
            }
          }
!       std::string launcher =
!         this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
!       cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL);
        for(unsigned int j=1; j < commandLine.size(); ++j)
          {
***************
*** 1060,1064 ****
        if(content)
          {
!         *content << cmd;
          }
        if(this->BorlandMakeCurlyHack)
--- 1061,1066 ----
        if(content)
          {
!         // Rule content does not include the launcher.
!         *content << (cmd.c_str()+launcher.size());
          }
        if(this->BorlandMakeCurlyHack)
***************
*** 1095,1098 ****
--- 1097,1129 ----
  
  //----------------------------------------------------------------------------
+ std::string
+ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
+                                             cmTarget* target,
+                                             RelativeRoot relative)
+ {
+   // Short-circuit if there is no launcher.
+   const char* prop = "RULE_LAUNCH_CUSTOM";
+   const char* val = this->GetRuleLauncher(target, prop);
+   if(!(val && *val))
+     {
+     return "";
+     }
+ 
+   // Expand rules in the empty string.  It may insert the launcher and
+   // perform replacements.
+   RuleVariables vars;
+   vars.RuleLauncher = prop;
+   vars.CMTarget = target;
+ 
+   std::string launcher;
+   this->ExpandRuleVariables(launcher, vars);
+   if(!launcher.empty())
+     {
+     launcher += " ";
+     }
+   return launcher;
+ }
+ 
+ //----------------------------------------------------------------------------
  void
  cmLocalUnixMakefileGenerator3

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.113
retrieving revision 1.114
diff -C 2 -d -r1.113 -r1.114
*** cmMakefileTargetGenerator.cxx	10 Feb 2009 13:50:33 -0000	1.113
--- cmMakefileTargetGenerator.cxx	10 Feb 2009 13:51:13 -0000	1.114
***************
*** 620,623 ****
--- 620,625 ----
    }
    cmLocalGenerator::RuleVariables vars;
+   vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
+   vars.CMTarget = this->Target;
    vars.Language = lang;
    vars.TargetPDB = targetOutPathPDB.c_str();

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.234
retrieving revision 1.235
diff -C 2 -d -r1.234 -r1.235
*** cmTarget.cxx	10 Feb 2009 13:50:21 -0000	1.234
--- cmTarget.cxx	10 Feb 2009 13:51:13 -0000	1.235
***************
*** 524,527 ****
--- 524,546 ----
  
    cm->DefineProperty
+     ("RULE_LAUNCH_COMPILE", cmProperty::TARGET,
+      "Specify a launcher for compile rules.",
+      "See the global property of the same name for details.  "
+      "This overrides the global and directory property for a target.",
+      true);
+   cm->DefineProperty
+     ("RULE_LAUNCH_LINK", cmProperty::TARGET,
+      "Specify a launcher for link rules.",
+      "See the global property of the same name for details.  "
+      "This overrides the global and directory property for a target.",
+      true);
+   cm->DefineProperty
+     ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET,
+      "Specify a launcher for custom rules.",
+      "See the global property of the same name for details.  "
+      "This overrides the global and directory property for a target.",
+      true);
+ 
+   cm->DefineProperty
      ("SKIP_BUILD_RPATH", cmProperty::TARGET,
       "Should rpaths be used for the build tree.",

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.503
retrieving revision 1.504
diff -C 2 -d -r1.503 -r1.504
*** cmMakefile.cxx	2 Feb 2009 18:27:30 -0000	1.503
--- cmMakefile.cxx	10 Feb 2009 13:51:13 -0000	1.504
***************
*** 3565,3568 ****
--- 3565,3587 ----
       "so far to the link_directories command.  "
       "It is intended for debugging purposes.", false);
+ 
+   cm->DefineProperty
+     ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
+      "Specify a launcher for compile rules.",
+      "See the global property of the same name for details.  "
+      "This overrides the global property for a directory.",
+      true);
+   cm->DefineProperty
+     ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY,
+      "Specify a launcher for link rules.",
+      "See the global property of the same name for details.  "
+      "This overrides the global property for a directory.",
+      true);
+   cm->DefineProperty
+     ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY,
+      "Specify a launcher for custom rules.",
+      "See the global property of the same name for details.  "
+      "This overrides the global property for a directory.",
+      true);
  }
  



More information about the Cmake-commits mailing list