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  629c0f7eb84ddd5d77ed3809fa7309d16f335917 (commit)
       via  587451858f73d7585e1280de16f9d07f566fd267 (commit)
       via  521b930bf4e211735842e71f1eb0018c2184a05f (commit)
       via  9298987a826dd8c71b02779145d5b9e3ebc30f4f (commit)
       via  5bad8ae342a7f1134fe3bb1ad3f2cc9852679124 (commit)
      from  8c8069edb7953c0e31d211201fcff9427fb413f5 (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=629c0f7eb84ddd5d77ed3809fa7309d16f335917
commit 629c0f7eb84ddd5d77ed3809fa7309d16f335917
Merge: 8c8069e 5874518
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Mon Mar 31 04:47:31 2014 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Mar 31 04:47:31 2014 -0400

    Merge topic 'automoc-windows-command-limit' into next
    
    58745185 QtAutogen: Use an at-file for very long command on Windows.
    521b930b CMake Nightly Date Stamp
    9298987a CMake Nightly Date Stamp
    5bad8ae3 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=587451858f73d7585e1280de16f9d07f566fd267
commit 587451858f73d7585e1280de16f9d07f566fd267
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Mon Mar 31 10:31:26 2014 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Mon Mar 31 10:31:26 2014 +0200

    QtAutogen: Use an at-file for very long command on Windows.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a6e6af7..426cfea 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -994,7 +994,7 @@ bool cmQtAutoGenerators::Run(const std::string& 
targetDirectory,
 
   if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
     {
-    success = this->RunAutogen(makefile);
+    success = this->RunAutogen(makefile, targetDirectory);
     }
 
   this->WriteOldMocDefinitionsFile(targetDirectory);
@@ -1273,7 +1273,8 @@ void cmQtAutoGenerators::Init()
 }
 
 
-bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
+bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile,
+                                    const std::string& targetDirectory)
 {
   if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
     || (this->OldCompileSettingsStr != this->CurrentCompileSettingsStr))
@@ -1370,7 +1371,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
       it != includedMocs.end();
       ++it)
     {
-    this->GenerateMoc(it->first, it->second);
+    this->GenerateMoc(it->first, it->second, targetDirectory);
     }
   for(std::map<std::string, std::string>::const_iterator
       it = includedUis.begin();
@@ -1402,7 +1403,8 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
         it != notIncludedMocs.end();
         ++it)
       {
-      bool mocSuccess = this->GenerateMoc(it->first, it->second);
+      bool mocSuccess = this->GenerateMoc(it->first, it->second,
+                                          targetDirectory);
       if (mocSuccess)
         {
         automocCppChanged = true;
@@ -1890,8 +1892,12 @@ void cmQtAutoGenerators::ParseHeaders(const 
std::set<std::string>& absHeaders,
 }
 
 bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
-                              const std::string& mocFileName)
+                              const std::string& mocFileName,
+                              const std::string& targetDirectory)
 {
+#ifndef _WIN32
+  (void)targetDirectory;
+#endif
   const std::string mocFilePath = this->Builddir + mocFileName;
   int sourceNewerThanMoc = 0;
   bool success = cmsys::SystemTools::FileTimeCompare(sourceFile.c_str(),
@@ -1914,25 +1920,66 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& 
sourceFile,
 
     std::vector<std::string> command;
     command.push_back(this->MocExecutable);
+#ifdef _WIN32
+  std::string::size_type commandLength = 0;
+#endif
     for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
          it != this->MocIncludes.end();
          ++it)
       {
       command.push_back(*it);
+#ifdef _WIN32
+      commandLength += it->size() + 3;
+#endif
       }
     for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
         it != this->MocDefinitions.end();
         ++it)
       {
       command.push_back(*it);
+#ifdef _WIN32
+      commandLength += it->size() + 3;
+#endif
       }
     for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
         it != this->MocOptions.end();
         ++it)
       {
       command.push_back(*it);
+#ifdef _WIN32
+      commandLength += it->size() + 3;
+#endif
       }
 #ifdef _WIN32
+    commandLength += mocFilePath.size() + 3;
+    commandLength += sourceFile.size() + 3;
+    if(commandLength > 32000)
+      {
+      // Windows command line length limit is 2**15. If it's really long,
+      // just put it in a @-file.
+      std::string atfilename(
+          cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
+      cmSystemTools::ConvertToUnixSlashes(atfilename);
+      atfilename += "/moc_parameters";
+
+      std::fstream atfile;
+      atfile.open(atfilename.c_str(),
+                  std::ios::out | std::ios::trunc);
+      for (std::vector<std::string>::const_iterator it = command.begin() + 1;
+          it != command.end(); ++it)
+        {
+        atfile << *it << "\n";
+        }
+
+      command.clear();
+      command.push_back(this->MocExecutable);
+      command.push_back("@" + atfilename);
+
+      atfile.close();
+      }
+#endif
+
+#ifdef _WIN32
     command.push_back("-DWIN32");
 #endif
     command.push_back("-o");
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 8003795..40283a8 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -45,9 +45,10 @@ private:
 
   std::string MakeCompileSettingsString(cmMakefile* makefile);
 
-  bool RunAutogen(cmMakefile* makefile);
+  bool RunAutogen(cmMakefile* makefile, const std::string& targetDirectory);
   bool GenerateMoc(const std::string& sourceFile,
-                   const std::string& mocFileName);
+                   const std::string& mocFileName,
+                   const std::string& targetDirectory);
   bool GenerateUi(const std::string& realName, const std::string& uiFileName);
   bool GenerateQrc();
   void ParseCppFile(const std::string& absFilename,

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

Summary of changes:
 Source/CMakeVersion.cmake     |    2 +-
 Source/cmQtAutoGenerators.cxx |   57 +++++++++++++++++++++++++++++++++++++----
 Source/cmQtAutoGenerators.h   |    5 ++--
 3 files changed, 56 insertions(+), 8 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