[Cmake-commits] CMake branch, next, updated. v2.8.12.1-7270-g3c6550c

Stephen Kelly steveire at gmail.com
Fri Jan 24 11:05:46 EST 2014


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  3c6550c49c5b8a99e1af5effd2c6bb978e9c517f (commit)
       via  a7c73c48bd785e54e0ca9bd4b41ddc3574ad2040 (commit)
       via  eaa256064fca2d44a87f4a88d6aafee3e478c00d (commit)
      from  f18b26a42627ac731ce1f9b1df71f8b2a46071f1 (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=3c6550c49c5b8a99e1af5effd2c6bb978e9c517f
commit 3c6550c49c5b8a99e1af5effd2c6bb978e9c517f
Merge: f18b26a a7c73c4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 24 11:05:45 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 24 11:05:45 2014 -0500

    Merge topic 'fix-Qt-autogen' into next
    
    a7c73c48 QtAutogen: Short-circut some logic when moc is not available.
    eaa25606 QtAutogen: Separate source file processing from AUTOMOC.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7c73c48bd785e54e0ca9bd4b41ddc3574ad2040
commit a7c73c48bd785e54e0ca9bd4b41ddc3574ad2040
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 24 17:01:59 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Jan 24 17:03:20 2014 +0100

    QtAutogen: Short-circut some logic when moc is not available.
    
    This is the case when AUTOMOC is false.  This prevents creating rules
    to moc the files in the absense of moc.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 94112b8..a71726c 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1435,6 +1435,12 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
               << std::endl;
     return;
     }
+  this->ParseForUic(absFilename, contentsString, includedUis);
+  if (this->MocExecutable.empty())
+    {
+    return;
+    }
+
   const std::string absPath = cmsys::SystemTools::GetFilenamePath(
                    cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
   const std::string scannedFileBasename = cmsys::SystemTools::
@@ -1563,7 +1569,6 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
       matchOffset += mocIncludeRegExp.end();
       } while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
     }
-  this->ParseForUic(absFilename, contentsString, includedUis);
 
   // In this case, check whether the scanned file itself contains a Q_OBJECT.
   // If this is the case, the moc_foo.cpp should probably be generated from
@@ -1618,6 +1623,12 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename,
               << std::endl;
     return;
     }
+  this->ParseForUic(absFilename, contentsString, includedUis);
+  if (this->MocExecutable.empty())
+    {
+    return;
+    }
+
   const std::string absPath = cmsys::SystemTools::GetFilenamePath(
                    cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
   const std::string scannedFileBasename = cmsys::SystemTools::
@@ -1696,7 +1707,6 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename,
       matchOffset += mocIncludeRegExp.end();
       } while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
     }
-  this->ParseForUic(absFilename, contentsString, includedUis);
 
   // In this case, check whether the scanned file itself contains a Q_OBJECT.
   // If this is the case, the moc_foo.cpp should probably be generated from
@@ -1821,7 +1831,8 @@ void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders,
     const std::string& headerName = *hIt;
     const std::string contents = ReadAll(headerName);
 
-    if (includedMocs.find(headerName) == includedMocs.end())
+    if (!this->MocExecutable.empty()
+        && includedMocs.find(headerName) == includedMocs.end())
       {
       if (this->Verbose)
         {
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 7b99395..515bf5b 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -11,6 +11,11 @@ if (QT_TEST_VERSION STREQUAL 4)
   include(UseQt4)
 
   set(QT_QTCORE_TARGET Qt4::QtCore)
+
+  macro(qtx_wrap_cpp)
+    qt4_wrap_cpp(${ARGN})
+  endmacro()
+
 else()
   if (NOT QT_TEST_VERSION STREQUAL 5)
     message(SEND_ERROR "Invalid Qt version specified.")
@@ -25,6 +30,11 @@ else()
   if(Qt5_POSITION_INDEPENDENT_CODE)
     set(CMAKE_POSITION_INDEPENDENT_CODE ON)
   endif()
+
+  macro(qtx_wrap_cpp)
+    qt5_wrap_cpp(${ARGN})
+  endmacro()
+
 endif()
 
 
@@ -77,3 +87,7 @@ set_target_properties(empty PROPERTIES AUTOMOC TRUE)
 target_link_libraries(empty no_link_language)
 add_library(no_link_language STATIC empty.h)
 set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE)
+
+qtx_wrap_cpp(uicOnlyMoc uiconly.h)
+add_executable(uiconly uiconly.cpp ${uicOnlyMoc})
+target_link_libraries(uiconly ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/uiconly.cpp b/Tests/QtAutogen/uiconly.cpp
new file mode 100644
index 0000000..7cbad77
--- /dev/null
+++ b/Tests/QtAutogen/uiconly.cpp
@@ -0,0 +1,14 @@
+
+#include "uiconly.h"
+#include "ui_uiconly.h"
+
+UicOnly::UicOnly(QWidget *parent)
+  : QWidget(parent), ui(new Ui::UicOnly)
+{
+
+}
+
+int main()
+{
+  return 0;
+}
diff --git a/Tests/QtAutogen/uiconly.h b/Tests/QtAutogen/uiconly.h
new file mode 100644
index 0000000..0d73a77
--- /dev/null
+++ b/Tests/QtAutogen/uiconly.h
@@ -0,0 +1,23 @@
+
+#ifndef UIC_ONLY_H
+#define UIC_ONLY_H
+
+#include <QWidget>
+#include <memory>
+
+namespace Ui
+{
+class UicOnly;
+}
+
+class UicOnly : public QWidget
+{
+  Q_OBJECT
+public:
+  explicit UicOnly(QWidget *parent = 0);
+
+private:
+  const std::auto_ptr<Ui::UicOnly> ui;
+};
+
+#endif
diff --git a/Tests/QtAutogen/uiconly.ui b/Tests/QtAutogen/uiconly.ui
new file mode 100644
index 0000000..13fb832
--- /dev/null
+++ b/Tests/QtAutogen/uiconly.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UicOnly</class>
+ <widget class="QWidget" name="UicOnly">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <widget class="QTreeView" name="treeView"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eaa256064fca2d44a87f4a88d6aafee3e478c00d
commit eaa256064fca2d44a87f4a88d6aafee3e478c00d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 24 16:32:34 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Jan 24 17:03:09 2014 +0100

    QtAutogen: Separate source file processing from AUTOMOC.
    
    This will allow using AUTOUIC without using AUTOMOC for example.

diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 7554213..b6f9791 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -1,4 +1,4 @@
-set(AM_SOURCES @_moc_files@ )
+set(AM_SOURCES @_cpp_files@ )
 set(AM_RCC_SOURCES @_rcc_files@ )
 set(AM_SKIP_MOC @_skip_moc@ )
 set(AM_SKIP_UIC @_skip_uic@ )
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 166bbe0..94112b8 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -231,7 +231,6 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
   if (target->GetPropertyAsBool("AUTORCC"))
     {
     toolNames.push_back("rcc");
-    this->InitializeAutoRccTarget(target);
     }
 
   std::string tools = toolNames[0];
@@ -380,6 +379,9 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
   std::map<std::string, std::string> configDefines;
   std::map<std::string, std::string> configUicOptions;
 
+  this->SetupSourceFiles(target);
+  makefile->AddDefinition("_cpp_files",
+          cmLocalGenerator::EscapeForCMake(this->Sources.c_str()).c_str());
   if (target->GetPropertyAsBool("AUTOMOC"))
     {
     this->SetupAutoMocTarget(target, autogenTargetName,
@@ -448,23 +450,20 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
     }
 }
 
-void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
-                          const std::string &autogenTargetName,
-                          std::map<std::string, std::string> &configIncludes,
-                          std::map<std::string, std::string> &configDefines)
+void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
 {
   cmMakefile* makefile = target->GetMakefile();
 
-  std::string _moc_files;
-  std::string _moc_headers;
   const char* sepFiles = "";
   const char* sepHeaders = "";
 
   std::vector<cmSourceFile*> srcFiles;
   target->GetSourceFiles(srcFiles);
 
-  std::string skip_moc;
-  const char *sep = "";
+  const char *skipMocSep = "";
+  const char *skipUicSep = "";
+
+  std::vector<cmSourceFile*> newRccFiles;
 
   for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
       fileIt != srcFiles.end();
@@ -473,48 +472,83 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
     cmSourceFile* sf = *fileIt;
     std::string absFile = cmsys::SystemTools::GetRealPath(
                                                     sf->GetFullPath().c_str());
-    bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
+    bool skipMoc = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
     bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"));
 
+    if(cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")))
+      {
+      this->SkipUic += skipUicSep;
+      this->SkipUic += absFile;
+      skipUicSep = ";";
+      }
+
+    std::string ext = sf->GetExtension();
+    if (ext == "qrc"
+        && !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")))
+      {
+      std::string basename = cmsys::SystemTools::
+                                    GetFilenameWithoutLastExtension(absFile);
+
+      std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
+      rcc_output_file += "/qrc_" + basename + ".cpp";
+      makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+                              rcc_output_file.c_str(), false);
+      cmSourceFile* rccCppSource
+              = makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
+      newRccFiles.push_back(rccCppSource);
+      }
+
     if (!generated)
       {
-      if (skip)
+      if (skipMoc)
         {
-        skip_moc += sep;
-        skip_moc += absFile;
-        sep = ";";
+        this->SkipMoc += skipMocSep;
+        this->SkipMoc += absFile;
+        skipMocSep = ";";
         }
       else
         {
-        std::string ext = sf->GetExtension();
         cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat(
                                                                 ext.c_str());
         if (fileType == cmSystemTools::CXX_FILE_FORMAT)
           {
-          _moc_files += sepFiles;
-          _moc_files += absFile;
+          this->Sources += sepFiles;
+          this->Sources += absFile;
           sepFiles = ";";
           }
         else if (fileType == cmSystemTools::HEADER_FILE_FORMAT)
           {
-          _moc_headers += sepHeaders;
-          _moc_headers += absFile;
+          this->Headers += sepHeaders;
+          this->Headers += absFile;
           sepHeaders = ";";
           }
         }
       }
     }
 
+  for(std::vector<cmSourceFile*>::const_iterator fileIt = newRccFiles.begin();
+      fileIt != newRccFiles.end();
+      ++fileIt)
+    {
+    const_cast<cmTarget*>(target)->AddSourceFile(*fileIt);
+    }
+}
+
+void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
+                          const std::string &autogenTargetName,
+                          std::map<std::string, std::string> &configIncludes,
+                          std::map<std::string, std::string> &configDefines)
+{
+  cmMakefile* makefile = target->GetMakefile();
+
   const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
   std::string _moc_options = (tmp!=0 ? tmp : "");
   makefile->AddDefinition("_moc_options",
           cmLocalGenerator::EscapeForCMake(_moc_options.c_str()).c_str());
-  makefile->AddDefinition("_moc_files",
-          cmLocalGenerator::EscapeForCMake(_moc_files.c_str()).c_str());
   makefile->AddDefinition("_skip_moc",
-          cmLocalGenerator::EscapeForCMake(skip_moc.c_str()).c_str());
+          cmLocalGenerator::EscapeForCMake(this->SkipMoc.c_str()).c_str());
   makefile->AddDefinition("_moc_headers",
-          cmLocalGenerator::EscapeForCMake(_moc_headers.c_str()).c_str());
+          cmLocalGenerator::EscapeForCMake(this->Headers.c_str()).c_str());
   bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE");
   makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
 
@@ -655,41 +689,17 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
 {
   cmMakefile *makefile = target->GetMakefile();
 
-  std::vector<cmSourceFile*> srcFiles;
-  target->GetSourceFiles(srcFiles);
-
-  std::string skip_uic;
-  const char *sep = "";
-
   std::set<cmStdString> skipped;
-
-  for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
-      fileIt != srcFiles.end();
-      ++fileIt)
-    {
-    cmSourceFile* sf = *fileIt;
-    std::string absFile = cmsys::SystemTools::GetRealPath(
-                                                    sf->GetFullPath().c_str());
-
-    if (cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")))
-      {
-      skip_uic += sep;
-      skip_uic += absFile;
-      sep = ";";
-      skipped.insert(absFile);
-      }
-    }
+  std::vector<std::string> skipVec;
+  cmSystemTools::ExpandListArgument(this->SkipUic.c_str(), skipVec);
+  skipped.insert(skipVec.begin(), skipVec.end());
 
   makefile->AddDefinition("_skip_uic",
-          cmLocalGenerator::EscapeForCMake(skip_uic.c_str()).c_str());
+          cmLocalGenerator::EscapeForCMake(this->SkipUic.c_str()).c_str());
 
   std::vector<cmSourceFile*> uiFilesWithOptions
                                         = makefile->GetQtUiFilesWithOptions();
 
-  std::string uiFileFiles;
-  std::string uiFileOptions;
-  sep = "";
-
   const char *qtVersion = makefile->GetDefinition("_target_qt_version");
 
   std::string _uic_opts;
@@ -718,6 +728,10 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
       }
     }
 
+  std::string uiFileFiles;
+  std::string uiFileOptions;
+  const char* sep = "";
+
   for(std::vector<cmSourceFile*>::const_iterator fileIt =
       uiFilesWithOptions.begin();
       fileIt != uiFilesWithOptions.end();
@@ -819,51 +833,6 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts,
   opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
 }
 
-void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target)
-{
-  cmMakefile *makefile = target->GetMakefile();
-
-  std::vector<cmSourceFile*> srcFiles;
-  target->GetSourceFiles(srcFiles);
-
-  std::vector<cmSourceFile*> newFiles;
-
-  for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
-      fileIt != srcFiles.end();
-      ++fileIt)
-    {
-    cmSourceFile* sf = *fileIt;
-    std::string ext = sf->GetExtension();
-    if (ext == "qrc")
-      {
-      std::string absFile = cmsys::SystemTools::GetRealPath(
-                                                  sf->GetFullPath().c_str());
-      bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
-
-      if (!skip)
-        {
-        std::string basename = cmsys::SystemTools::
-                                      GetFilenameWithoutLastExtension(absFile);
-
-        std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
-        rcc_output_file += "/qrc_" + basename + ".cpp";
-        makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
-                                rcc_output_file.c_str(), false);
-        cmSourceFile* rccCppSource
-                = makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
-        newFiles.push_back(rccCppSource);
-        }
-      }
-    }
-
-  for(std::vector<cmSourceFile*>::const_iterator fileIt = newFiles.begin();
-      fileIt != newFiles.end();
-      ++fileIt)
-    {
-    target->AddSourceFile(*fileIt);
-    }
-}
-
 void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
 {
   std::string _rcc_files;
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index ac0fd9e..f66d02b 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -25,6 +25,7 @@ public:
 
   bool InitializeAutogenTarget(cmTarget* target);
   void SetupAutoGenerateTarget(cmTarget const* target);
+  void SetupSourceFiles(cmTarget const* target);
 
 private:
   void SetupAutoMocTarget(cmTarget const* target,
@@ -33,7 +34,6 @@ private:
                           std::map<std::string, std::string> &configDefines);
   void SetupAutoUicTarget(cmTarget const* target,
                         std::map<std::string, std::string> &configUicOptions);
-  void InitializeAutoRccTarget(cmTarget* target);
   void SetupAutoRccTarget(cmTarget const* target);
 
   bool ReadAutogenInfoFile(cmMakefile* makefile,

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

Summary of changes:
 Modules/AutogenInfo.cmake.in   |    2 +-
 Source/cmQtAutoGenerators.cxx  |  178 ++++++++++++++++++----------------------
 Source/cmQtAutoGenerators.h    |    2 +-
 Tests/QtAutogen/CMakeLists.txt |   14 ++++
 Tests/QtAutogen/uiconly.cpp    |   14 ++++
 Tests/QtAutogen/uiconly.h      |   23 ++++++
 Tests/QtAutogen/uiconly.ui     |   24 ++++++
 7 files changed, 156 insertions(+), 101 deletions(-)
 create mode 100644 Tests/QtAutogen/uiconly.cpp
 create mode 100644 Tests/QtAutogen/uiconly.h
 create mode 100644 Tests/QtAutogen/uiconly.ui


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list