[Cmake-commits] CMake branch, next, updated. v3.8.0-793-g48facf8

Kitware Robot kwrobot at kitware.com
Tue Apr 18 10:35:02 EDT 2017


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
  discards  9c6b7474fc148063be7a564311c0ed0634238f65 (commit)
  discards  ff6078d597562661270d3e675c6d136ade917243 (commit)
  discards  bba5bcf93de71085e478ea958d82d97f26dfa658 (commit)
       via  48facf8259e4db190bc342aad8585153c86a5a5e (commit)
       via  05e1bcb2dd43c7de15f0434b998032f481e42c72 (commit)
       via  b6508988f725ffa9bf339b2c5cc7a58923205025 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (9c6b7474fc148063be7a564311c0ed0634238f65)
            \
             N -- N -- N (48facf8259e4db190bc342aad8585153c86a5a5e)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48facf8259e4db190bc342aad8585153c86a5a5e
commit 48facf8259e4db190bc342aad8585153c86a5a5e
Merge: 4fb5157 05e1bcb
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Apr 18 14:26:42 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Apr 18 10:26:44 2017 -0400

    Stage topic 'autogen-fixes'
    
    Topic-id: 23520
    Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/671


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05e1bcb2dd43c7de15f0434b998032f481e42c72
commit 05e1bcb2dd43c7de15f0434b998032f481e42c72
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Apr 13 18:13:07 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 18 10:24:50 2017 -0400

    Autogen: Include moc_predefs.h by absolute path

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 1cf06f2..ba4957b 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -581,6 +581,12 @@ void cmQtAutoGenerators::Init(cmMakefile* makefile)
 
   this->MocCppFilenameAbs = this->CurrentBinaryDir + this->MocCppFilenameRel;
 
+  // Moc predefs file
+  if (!this->MocPredefsCmd.empty()) {
+    this->MocPredefsFileRel = this->AutogenBuildSubDir + "moc_predefs.h";
+    this->MocPredefsFileAbs = this->CurrentBinaryDir + this->MocPredefsFileRel;
+  }
+
   // Init file path checksum generator
   fpathCheckSum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir,
                                 this->ProjectSourceDir,
@@ -1146,13 +1152,12 @@ bool cmQtAutoGenerators::MocGenerateAll(
 
   // Generate moc_predefs
   if (!this->MocPredefsCmd.empty()) {
-    const std::string mocPredefsFile =
-      this->AutogenBuildSubDir + "moc_predefs.h";
-    if (!this->MakeParentDirectory(mocPredefsFile)) {
-      this->LogError("AutoMoc: Error creating directory for" + mocPredefsFile);
+    if (!this->MakeParentDirectory(this->MocPredefsFileAbs)) {
+      this->LogError("AutoMoc: Error creating directory for " +
+                     this->MocPredefsFileRel);
       return false;
     }
-    this->LogBold("Generating " + mocPredefsFile);
+    this->LogBold("Generating MOC predefs " + this->MocPredefsFileRel);
 
     std::vector<std::string> cmd = this->MocPredefsCmd;
     cmd.insert(cmd.end(), this->MocIncludes.begin(), this->MocIncludes.end());
@@ -1170,16 +1175,16 @@ bool cmQtAutoGenerators::MocGenerateAll(
 
     // actually write the file
     cmsys::ofstream outfile;
-    outfile.open(mocPredefsFile.c_str(), std::ios::trunc);
+    outfile.open(this->MocPredefsFileAbs.c_str(), std::ios::trunc);
     if (!outfile) {
       moc_predefsGenerated = false;
-      this->LogError("AutoMoc: Error opening " + mocPredefsFile);
+      this->LogError("AutoMoc: Error opening " + this->MocPredefsFileRel);
     } else {
       outfile << output;
       // Check for write errors
       if (!outfile.good()) {
         moc_predefsGenerated = false;
-        this->LogError("AutoMoc: Error writing " + mocPredefsFile);
+        this->LogError("AutoMoc: Error writing " + this->MocPredefsFileRel);
       }
     }
 
@@ -1350,9 +1355,9 @@ bool cmQtAutoGenerators::MocGenerateFile(
         cmd.push_back("-D" + (*it));
       }
       cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
-      if (!this->MocPredefsCmd.empty()) {
+      if (!this->MocPredefsFileAbs.empty()) {
         cmd.push_back("--include");
-        cmd.push_back(this->AutogenBuildSubDir + "moc_predefs.h");
+        cmd.push_back(this->MocPredefsFileAbs);
       }
 #ifdef _WIN32
       cmd.push_back("-DWIN32");
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index cc8b029..cb6f45a 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -176,6 +176,8 @@ private:
   // - Moc
   std::string MocCppFilenameRel;
   std::string MocCppFilenameAbs;
+  std::string MocPredefsFileRel;
+  std::string MocPredefsFileAbs;
   std::vector<std::string> MocSkipList;
   std::vector<std::string> MocIncludePaths;
   std::vector<std::string> MocIncludes;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6508988f725ffa9bf339b2c5cc7a58923205025
commit b6508988f725ffa9bf339b2c5cc7a58923205025
Author:     Aleix Pol <aleixpol at kde.org>
AuthorDate: Thu Apr 6 04:14:35 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 18 10:24:35 2017 -0400

    Autogen: Fix automoc in some set ups
    
    Qt is relying on whoever calls moc to include a file with the predefined
    values that will be used by the compiler, otherwise moc takes wrong
    paths and weird things happen.
    Instead, generate an include file and feed it to all mocs to make sure
    it's generating correct code.
    
    Fixes: #16640

diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index fcecb6c..5e945bc 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -21,6 +21,7 @@ set(AM_MOC_INCLUDES @_moc_incs@)
 set(AM_MOC_OPTIONS @_moc_options@)
 set(AM_MOC_RELAXED_MODE @_moc_relaxed_mode@)
 set(AM_MOC_DEPEND_FILTERS @_moc_depend_filters@)
+set(AM_MOC_PREDEFS_CMD @_moc_predefs_cmd@)
 # UIC settings
 set(AM_UIC_SKIP @_uic_skip@)
 set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake
index 02968b4..513e62a 100644
--- a/Modules/Compiler/Intel.cmake
+++ b/Modules/Compiler/Intel.cmake
@@ -22,5 +22,7 @@ else()
     string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
     string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
     string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
+
+    set(CMAKE_GENERATE_${lang}_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
   endmacro()
 endif()
diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake
index 6878254..939c08e 100644
--- a/Modules/Platform/Linux-GNU.cmake
+++ b/Modules/Platform/Linux-GNU.cmake
@@ -12,4 +12,5 @@ macro(__linux_compiler_gnu lang)
   # We pass this for historical reasons.  Projects may have
   # executables that use dlopen but do not set ENABLE_EXPORTS.
   set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+  set(CMAKE_GENERATE_${lang}_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
 endmacro()
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index d69794c..07fcb2f 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -96,6 +96,36 @@ static std::string GetQtMajorVersion(cmGeneratorTarget const* target)
   return qtMajorVersion;
 }
 
+static std::string GetQtMinorVersion(cmGeneratorTarget const* target)
+{
+  cmMakefile* makefile = target->Target->GetMakefile();
+  std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MINOR");
+  if (qtMajorVersion.empty()) {
+    qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MINOR");
+  }
+  const char* targetQtVersion =
+    target->GetLinkInterfaceDependentStringProperty("QT_MINOR_VERSION", "");
+  if (targetQtVersion != CM_NULLPTR) {
+    qtMajorVersion = targetQtVersion;
+  }
+  return qtMajorVersion;
+}
+
+static bool QtVersionGreaterOrEqual(const std::string& major,
+                                    const std::string& minor,
+                                    unsigned long requestMajor,
+                                    unsigned long requestMinor)
+{
+  unsigned long majorUL(0);
+  unsigned long minorUL(0);
+  if (cmSystemTools::StringToULong(major.c_str(), &majorUL) &&
+      cmSystemTools::StringToULong(minor.c_str(), &minorUL)) {
+    return (majorUL > requestMajor) ||
+      (majorUL == requestMajor && minorUL >= requestMinor);
+  }
+  return false;
+}
+
 static void GetCompileDefinitionsAndDirectories(
   cmGeneratorTarget const* target, const std::string& config,
   std::string& incs, std::string& defs)
@@ -258,6 +288,12 @@ static void MocSetupAutoTarget(
   AddDefinitionEscaped(makefile, "_moc_depend_filters",
                        GetSafeProperty(target, "AUTOMOC_DEPEND_FILTERS"));
 
+  if (QtVersionGreaterOrEqual(qtMajorVersion, GetQtMinorVersion(target), 5,
+                              8)) {
+    AddDefinitionEscaped(
+      makefile, "_moc_predefs_cmd",
+      makefile->GetSafeDefinition("CMAKE_GENERATE_CXX_PREDEFINES_COMMAND"));
+  }
   // Moc includes and compile definitions
   {
     std::string _moc_incs;
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 246dd8d..1cf06f2 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -360,6 +360,8 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   InfoGet(makefile, "AM_QT_MOC_EXECUTABLE", this->MocExecutable);
   InfoGet(makefile, "AM_QT_UIC_EXECUTABLE", this->UicExecutable);
   InfoGet(makefile, "AM_QT_RCC_EXECUTABLE", this->RccExecutable);
+
+  InfoGet(makefile, "AM_MOC_PREDEFS_CMD", this->MocPredefsCmd);
   // Check Qt version
   if ((this->QtMajorVersion != "4") && (this->QtMajorVersion != "5")) {
     this->LogError("AutoGen: Error: Unsupported Qt version: " +
@@ -1142,6 +1144,49 @@ bool cmQtAutoGenerators::MocGenerateAll(
     return true;
   }
 
+  // Generate moc_predefs
+  if (!this->MocPredefsCmd.empty()) {
+    const std::string mocPredefsFile =
+      this->AutogenBuildSubDir + "moc_predefs.h";
+    if (!this->MakeParentDirectory(mocPredefsFile)) {
+      this->LogError("AutoMoc: Error creating directory for" + mocPredefsFile);
+      return false;
+    }
+    this->LogBold("Generating " + mocPredefsFile);
+
+    std::vector<std::string> cmd = this->MocPredefsCmd;
+    cmd.insert(cmd.end(), this->MocIncludes.begin(), this->MocIncludes.end());
+    for (std::vector<std::string>::const_iterator it =
+           this->MocDefinitions.begin();
+         it != this->MocDefinitions.end(); ++it) {
+      cmd.push_back("-D" + (*it));
+    }
+    cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
+
+    std::string output;
+    bool moc_predefsGenerated = this->RunCommand(cmd, output, false);
+    if (!moc_predefsGenerated)
+      return false;
+
+    // actually write the file
+    cmsys::ofstream outfile;
+    outfile.open(mocPredefsFile.c_str(), std::ios::trunc);
+    if (!outfile) {
+      moc_predefsGenerated = false;
+      this->LogError("AutoMoc: Error opening " + mocPredefsFile);
+    } else {
+      outfile << output;
+      // Check for write errors
+      if (!outfile.good()) {
+        moc_predefsGenerated = false;
+        this->LogError("AutoMoc: Error writing " + mocPredefsFile);
+      }
+    }
+
+    if (!moc_predefsGenerated)
+      return false;
+  }
+
   bool mocCompFileGenerated = false;
   bool mocCompChanged = false;
 
@@ -1305,6 +1350,10 @@ bool cmQtAutoGenerators::MocGenerateFile(
         cmd.push_back("-D" + (*it));
       }
       cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
+      if (!this->MocPredefsCmd.empty()) {
+        cmd.push_back("--include");
+        cmd.push_back(this->AutogenBuildSubDir + "moc_predefs.h");
+      }
 #ifdef _WIN32
       cmd.push_back("-DWIN32");
 #endif
@@ -1805,7 +1854,7 @@ bool cmQtAutoGenerators::MakeParentDirectory(const std::string& filename) const
  * @return True on success
  */
 bool cmQtAutoGenerators::RunCommand(const std::vector<std::string>& command,
-                                    std::string& output) const
+                                    std::string& output, bool verbose) const
 {
   // Log command
   if (this->Verbose) {
@@ -1813,8 +1862,9 @@ bool cmQtAutoGenerators::RunCommand(const std::vector<std::string>& command,
   }
   // Execute command
   int retVal = 0;
-  bool res =
-    cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
+  bool res = cmSystemTools::RunSingleCommand(
+    command, &output, &output, &retVal, CM_NULLPTR,
+    verbose ? cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE);
   return (res && (retVal == 0));
 }
 
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index ee046de..cc8b029 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -142,8 +142,8 @@ private:
                              const char* basePrefix,
                              const char* baseSuffix) const;
   bool MakeParentDirectory(const std::string& filename) const;
-  bool RunCommand(const std::vector<std::string>& command,
-                  std::string& output) const;
+  bool RunCommand(const std::vector<std::string>& command, std::string& output,
+                  bool verbose = true) const;
 
   bool FindHeader(std::string& header, const std::string& testBasePath) const;
 
@@ -197,6 +197,8 @@ private:
   MacroFilter MacroFilters[2];
   cmsys::RegularExpression RegExpMocInclude;
   cmsys::RegularExpression RegExpUicInclude;
+  // - moc_predefs
+  std::vector<std::string> MocPredefsCmd;
   // - Flags
   bool IncludeProjectDirsBefore;
   bool Verbose;

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list