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  eecc5ec83eb49288c98605b0b0b64d9d2fbade0b (commit)
       via  4b43999ca307894caaabe8857412f5f575e60583 (commit)
       via  54a388beaaec8b9a4e4bb6bfb220d5711a866866 (commit)
      from  947d387668ec5382c71c56db6315e5a4ec7c5e38 (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=eecc5ec83eb49288c98605b0b0b64d9d2fbade0b
commit eecc5ec83eb49288c98605b0b0b64d9d2fbade0b
Merge: 947d387 4b43999
Author:     Peter Kuemmel <syntheti...@gmx.net>
AuthorDate: Wed Jun 13 11:29:10 2012 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Wed Jun 13 11:29:10 2012 -0400

    Merge topic 'ninja-cldeps' into next
    
    4b43999 Ninja: remove unused CommentStream
    54a388b Ninja: extract dependencies for .rc files with msvc tools


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b43999ca307894caaabe8857412f5f575e60583
commit 4b43999ca307894caaabe8857412f5f575e60583
Author:     Peter Kuemmel <syntheti...@gmx.net>
AuthorDate: Wed Jun 13 17:23:31 2012 +0200
Commit:     Peter Kuemmel <syntheti...@gmx.net>
CommitDate: Wed Jun 13 17:23:31 2012 +0200

    Ninja: remove unused CommentStream

diff --git a/Source/cmGlobalNinjaGenerator.cxx 
b/Source/cmGlobalNinjaGenerator.cxx
index 4773c37..11d8653 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -377,18 +377,10 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
   , CompileCommandsStream(0)
   , Rules()
   , AllDependencies()
-  , CommentStream(0)
 {
   // // Ninja is not ported to non-Unix OS yet.
   // this->ForceUnixPaths = true;
   this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake";
-  this->ClearCommentStream();
-}
-
-void cmGlobalNinjaGenerator::ClearCommentStream()
-{
-  delete CommentStream;
-  CommentStream = new cmsys_ios::stringstream(std::ios::out);
 }
 
 
@@ -550,12 +542,10 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& 
name,
   // Do not add the same rule twice.
   if (this->HasRule(name))
     {
-    this->ClearCommentStream();
     return;
     }
 
-  *this->RulesFileStream << this->GetCommentStream().str();
-  this->ClearCommentStream();
+  *this->RulesFileStream;
 
   this->Rules.insert(name);
   cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream,
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 54677bc..2055375 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -220,11 +220,6 @@ public:
   cmGeneratedFileStream* GetRulesFileStream() const
   { return this->RulesFileStream; }
 
-  void ClearCommentStream();
-  cmsys_ios::stringstream& GetCommentStream() const
-  { return *this->CommentStream; }
-
-
   void AddCXXCompileCommand(const std::string &commandLine,
                             const std::string &sourceFile);
 
@@ -357,8 +352,6 @@ private:
 
   static bool UsingMinGW;
 
-  cmsys_ios::stringstream* CommentStream;
-
 };
 
 #endif // ! cmGlobalNinjaGenerator_h

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54a388beaaec8b9a4e4bb6bfb220d5711a866866
commit 54a388beaaec8b9a4e4bb6bfb220d5711a866866
Author:     Peter Kuemmel <syntheti...@gmx.net>
AuthorDate: Wed Jun 13 17:14:16 2012 +0200
Commit:     Peter Kuemmel <syntheti...@gmx.net>
CommitDate: Wed Jun 13 17:14:16 2012 +0200

    Ninja: extract dependencies for .rc files with msvc tools
    
    rc.exe doesn't support /showIncludes.
    Because .rc files also #include stuff we can
    misuse cl.exe to get the included files.
    
    Done one the fly by cmcldeps.

diff --git a/Source/cmNinjaTargetGenerator.cxx 
b/Source/cmNinjaTargetGenerator.cxx
index ce1aac2..f76bc0b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -339,7 +339,7 @@ cmNinjaTargetGenerator
   bool useClDeps = false;
   std::string clDepsBinary;
   std::string clShowPrefix;
-  if (lang == "C" || lang == "CXX")
+  if (lang == "C" || lang == "CXX" || lang == "RC")
     {
     const char* depsPtr = mf->GetDefinition("CMAKE_CMCLDEPS_EXECUTABLE");
     const char* showPtr = mf->GetDefinition("CMAKE_CL_SHOWINCLUDE_PREFIX");
@@ -352,8 +352,9 @@ cmNinjaTargetGenerator
       if (projectName != "CMAKE_TRY_COMPILE")
         {
         useClDeps = true;
-        clDepsBinary = depsPtr;
-        clShowPrefix = showPtr;
+        std::string qu = "\"";
+        clDepsBinary = qu + depsPtr + qu;
+        clShowPrefix = qu + showPtr + qu;
         vars.DependencyFile = "$DEP_FILE";
         }
       }
@@ -392,8 +393,10 @@ cmNinjaTargetGenerator
 
   if(useClDeps)
     {
-    cmdLine = "\"" + clDepsBinary + "\" $in \"$DEP_FILE\" $out \""
-              + clShowPrefix + "\" " + cmdLine;
+    std::string cl = mf->GetDefinition("CMAKE_C_COMPILER");
+    cl = "\"" + cl + "\" ";
+    cmdLine =   clDepsBinary + " " + lang + " $in \"$DEP_FILE\" $out "
+              + clShowPrefix + " " + cl   + cmdLine;
     }
 
   // Write the rule for compiling file of the given language.
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 549eeac..542fb90 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -535,14 +535,17 @@ static string getArg(string& cmdline) {
 }
 
 static void parseCommandLine(LPTSTR wincmdline,
+                             string& lang,
                              string& srcfile,
                              string& dfile,
                              string& objfile,
                              string& prefix,
                              string& clpath,
+                             string& binpath,
                              string& rest) {
   string cmdline(wincmdline);
   /* self */ getArg(cmdline);
+  lang = getArg(cmdline);
   srcfile = getArg(cmdline);
   std::string::size_type pos = srcfile.rfind("\\");
   if (pos != string::npos) {
@@ -554,12 +557,16 @@ static void parseCommandLine(LPTSTR wincmdline,
   objfile = getArg(cmdline);
   prefix = getArg(cmdline);
   clpath = getArg(cmdline);
+  binpath = getArg(cmdline);
   rest = trimLeadingSpace(cmdline);
 }
 
 static void outputDepFile(const string& dfile, const string& objfile,
         vector<string>& incs) {
 
+  if (dfile.empty())
+    return;
+
   // strip duplicates
   sort(incs.begin(), incs.end());
   incs.erase(unique(incs.begin(), incs.end()), incs.end());
@@ -581,6 +588,7 @@ static void outputDepFile(const string& dfile, const 
string& objfile,
     //doEscape(tmp, "(", "\\("); // TODO ninja can't read ( and )
     //doEscape(tmp, ")", "\\)");
     fprintf(out, "%s \\\n", tmp.c_str());
+    //printf("include: %s \n", tmp.c_str());
   }
 
   fprintf(out, "\n");
@@ -596,29 +604,26 @@ bool contains(const std::string& str, const std::string& 
what) {
   return str.find(what) != std::string::npos;
 }
 
-int main() {
+std::string replace(const std::string& str, const std::string& what, const 
std::string& replacement) {
+  size_t pos = str.find(what);
+  if (pos == std::string::npos)
+    return str;
+  std::string replaced = str;
+  return replaced.replace(pos, what.size(), replacement);
+}
 
-  // Use the Win32 api instead of argc/argv so we can avoid interpreting the
-  // rest of command line after the .d and .obj. Custom parsing seemed
-  // preferable to the ugliness you get into in trying to re-escape quotes for
-  // subprocesses, so by avoiding argc/argv, the subprocess is called with
-  // the same command line verbatim.
 
-  string srcfile, dfile, objfile, prefix, clpath, rest;
-  parseCommandLine(GetCommandLine(), srcfile, dfile, objfile,
-                                     prefix, clpath, 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
+static int process(bool ignoreErrors,
+                    const string& srcfile,
+                    const string& dfile,
+                    const string& objfile,
+                    const string& prefix,
+                    const string& cmd) {
 
   SubprocessSet subprocs;
-  Subprocess* subproc = subprocs.Add(clpath + " /showIncludes " + rest);
+  Subprocess* subproc = subprocs.Add(cmd);
+
   if(!subproc)
     return 2;
 
@@ -647,18 +652,67 @@ int main() {
        }
     } else {
       if (!isFirstLine || !startsWith(line, srcfile)) {
-        fprintf(stdout, "%s\n", line.c_str());
+        if (!ignoreErrors) {
+          // suppress errors when cl is fed with a rc file
+          fprintf(stdout, "%s\n", line.c_str());
+        }
       } else {
         isFirstLine = false;
       }
     }
   }
 
-  if (!success)
+  if (!success) {
+    if (ignoreErrors) {
+      //printf("\n-- RC file %i dependencies in %s\n\n", includes.size(), 
dfile.c_str());
+      outputDepFile(dfile, objfile, includes);
+    }
     return exit_code;
+  }
 
   // don't update .d until/unless we succeed compilation
   outputDepFile(dfile, objfile, includes);
 
   return 0;
 }
+
+
+int main() {
+
+  // Use the Win32 api instead of argc/argv so we can avoid interpreting the
+  // rest of command line after the .d and .obj. Custom parsing seemed
+  // preferable to the ugliness you get into in trying to re-escape quotes for
+  // subprocesses, so by avoiding argc/argv, the subprocess is called with
+  // the same command line verbatim.
+
+  string lang, srcfile, dfile, objfile, prefix, cl, binpath, rest;
+  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
+
+  if (lang != "RC") {
+    return process(false, srcfile, dfile, objfile, prefix, binpath + " 
/showIncludes " + 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 + "\" /showIncludes ";
+    string clRest = rest;
+    clRest = replace(clRest, "/fo" + objfile, "/out:" + objfile + ".dep.obj 
/Tc ");
+
+    int ret;
+    ret = process(true,  srcfile, dfile, objfile, prefix, cl + clRest);
+    ret = process(false, srcfile, ""   , objfile, prefix, binpath + " " + 
rest);
+    return ret;
+  }
+
+}

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

Summary of changes:
 Source/cmGlobalNinjaGenerator.cxx |   12 +----
 Source/cmGlobalNinjaGenerator.h   |    7 ---
 Source/cmNinjaTargetGenerator.cxx |   13 +++--
 Source/cmcldeps.cxx               |   94 +++++++++++++++++++++++++++++--------
 4 files changed, 83 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to