[Cmake-commits] CMake branch, next, updated. v2.8.8-3157-gfd5f49c

Peter Kuemmel syntheticpp at gmx.net
Thu Jun 14 04:49:58 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  fd5f49c75c5451c510cd32ac859074e5984ce7ef (commit)
       via  220fdc16fc577feb3401a44eea475dae119257b0 (commit)
       via  77cb7b502f3a90c75e92df655f2d37132ee5627f (commit)
      from  26fe13382a9a5eef4cf762184bdf752f1f3fe717 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd5f49c75c5451c510cd32ac859074e5984ce7ef
commit fd5f49c75c5451c510cd32ac859074e5984ce7ef
Merge: 26fe133 220fdc1
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Thu Jun 14 04:49:57 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jun 14 04:49:57 2012 -0400

    Merge topic 'ninja-cldeps' into next
    
    220fdc1 Ninja: cmcldeps
    77cb7b5 Ninja: suppress startup logos


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=220fdc16fc577feb3401a44eea475dae119257b0
commit 220fdc16fc577feb3401a44eea475dae119257b0
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Thu Jun 14 10:35:06 2012 +0200
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Thu Jun 14 10:48:32 2012 +0200

    Ninja: cmcldeps
    
    - don't depend on argument order
    - update help

diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index a665f89..2a7f8aa 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -482,15 +482,16 @@ void SubprocessSet::Clear() {
 // See http://msdn.microsoft.com/en-us/library/zay8tzh6(v=vs.85).aspx
 void _setargv() {}
 
-
 static void usage(const char* msg) {
-  Fatal("%s\n\nusage:\n"
-          "  cldeps "
-          "<source file> "
-          "<output path for *.d file> "
-          "<output path for *.obj file> "
-          "<prefix of /showIncludes> "
-          "<path to cl> "
+  Fatal("%s\n\nusage:\n    "
+          "cmcldeps "
+          "<language C, CXX or RC>  "
+          "<source file path>  "
+          "<output path for *.d file>  "
+          "<output path for *.obj file>  "
+          "<prefix of /showIncludes>  "
+          "<path to cl.exe>  "
+          "<path to tool (cl or rc)>  "
           "<rest of command ...>\n", msg);
 }
 
@@ -547,12 +548,6 @@ static void parseCommandLine(LPTSTR wincmdline,
   /* self */ getArg(cmdline);
   lang = getArg(cmdline);
   srcfile = getArg(cmdline);
-  std::string::size_type pos = srcfile.rfind("\\");
-  if (pos != string::npos) {
-    srcfile = srcfile.substr(pos + 1);
-  } else {
-    srcfile = "";
-  }
   dfile = getArg(cmdline);
   objfile = getArg(cmdline);
   prefix = getArg(cmdline);
@@ -615,7 +610,7 @@ std::string replace(const std::string& str, const std::string& what,
 
 
 
-static int process( const string& srcfile,
+static int process( const string& srcfilename,
                     const string& dfile,
                     const string& objfile,
                     const string& prefix,
@@ -652,7 +647,7 @@ static int process( const string& srcfile,
         includes.push_back(inc);
        }
     } else {
-      if (!isFirstLine || !startsWith(line, srcfile)) {
+      if (!isFirstLine || !startsWith(line, srcfilename)) {
         if (!quiet) {
           fprintf(stdout, "%s\n", line.c_str());
         }
@@ -685,32 +680,38 @@ int main() {
   parseCommandLine(GetCommandLine(), lang, srcfile, dfile, objfile,
                                      prefix, cl, binpath, rest);
 
-#if 0
-  fprintf(stderr, "\n\ncmcldebug:\n");
-  fprintf(stderr, ".d  : %s\n", dfile.c_str());
-  fprintf(stderr, "OBJ : %s\n", objfile.c_str());
-  fprintf(stderr, "CL  : %s\n", clpath.c_str());
-  fprintf(stderr, "REST: %s\n", rest.c_str());
-  fprintf(stderr, "\n\n");
-#endif
+  // needed to suppress filename output of msvc tools
+  string srcfilename;
+  std::string::size_type pos = srcfile.rfind("\\");
+  if (pos != string::npos) {
+    srcfilename = srcfile.substr(pos + 1);
+  }
 
-  std::string showflag = " /showIncludes /nologo ";
-  if (lang != "RC") {
-    return process(srcfile, dfile, objfile, prefix,
-                   binpath + showflag + rest);
-  } else {
+  std::string nol = " /nologo ";
+  std::string show = " /showIncludes ";
+  if (lang == "C" || lang == "CXX") {
+    return process(srcfilename, dfile, objfile, prefix,
+                   binpath + nol + show + rest);
+  } else if (lang == "RC") {
     // "misuse" cl.exe to get headers from .rc files
-    // rc: /fo  x\CMakeFiles\x.dir\x.rc.res              src\x\x.rc
-    // cl: /out:x\CMakeFiles\x.dir\x.rc.res.dep.obj  /Tc src\x\x.rc
 
-    cl = "\"" + cl + "\" /P /DRC_INVOKED " + showflag +
-         replace(rest, "/fo" + objfile, "/out:" + objfile + ".dep.obj /Tc ");
+    string clrest = rest;
+    // rc: /fo x.dir\x.rc.res  ->  cl: /out:x.dir\x.rc.res.dep.obj
+    clrest = replace(clrest, "/fo", "/out:");
+    clrest = replace(clrest, objfile, objfile + ".dep.obj ");
+    // rc: src\x\x.rc  ->  cl: /Tc src\x\x.rc
+    clrest = replace(clrest, srcfile, "/Tc " + srcfile);
+
+    cl = "\"" + cl + "\" /P /DRC_INVOKED ";
+
+    // extract dependencies with cl.exe
+    process(srcfilename, dfile, objfile,
+                  prefix, cl + nol + show + clrest, true);
 
-    int ret;
-    ret = process(srcfile, dfile, objfile, prefix, cl, true);
-    ret = process(srcfile, ""   , objfile, prefix,
-                  binpath + " /nologo "  + rest);
-    return ret;
+    // compile rc file with rc.exe
+    return process(srcfilename, "" , objfile, prefix, binpath + nol + rest);
   }
 
+  usage("Invalid language specified.");
+  return 1;
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77cb7b502f3a90c75e92df655f2d37132ee5627f
commit 77cb7b502f3a90c75e92df655f2d37132ee5627f
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Thu Jun 14 09:52:39 2012 +0200
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Thu Jun 14 10:48:31 2012 +0200

    Ninja: suppress startup logos
    
    Having Ninja's smart printing we are more allergic on
    unneeded tool output.

diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 193a2e0..a665f89 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -694,20 +694,22 @@ int main() {
   fprintf(stderr, "\n\n");
 #endif
 
+  std::string showflag = " /showIncludes /nologo ";
   if (lang != "RC") {
     return process(srcfile, dfile, objfile, prefix,
-                   binpath + " /showIncludes " + rest);
+                   binpath + showflag + rest);
   } else {
     // "misuse" cl.exe to get headers from .rc files
     // rc: /fo  x\CMakeFiles\x.dir\x.rc.res              src\x\x.rc
     // cl: /out:x\CMakeFiles\x.dir\x.rc.res.dep.obj  /Tc src\x\x.rc
 
-    cl = "\"" + cl + "\" /P /DRC_INVOKED /showIncludes " +
+    cl = "\"" + cl + "\" /P /DRC_INVOKED " + showflag +
          replace(rest, "/fo" + objfile, "/out:" + objfile + ".dep.obj /Tc ");
 
     int ret;
     ret = process(srcfile, dfile, objfile, prefix, cl, true);
-    ret = process(srcfile, ""   , objfile, prefix, binpath + " " + rest);
+    ret = process(srcfile, ""   , objfile, prefix,
+                  binpath + " /nologo "  + rest);
     return ret;
   }
 

-----------------------------------------------------------------------

Summary of changes:
 Source/cmcldeps.cxx |   75 ++++++++++++++++++++++++++------------------------
 1 files changed, 39 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list