Explorar o código

Merge topic 'autogen-optimize-cleanup'

8e452e67 Remove AUTOGEN variables from cmSourceFile and cmMakefile
0f2e178f Autogen: Don't use cmMakefile::GetQtUiFilesWithOptions
13bb716f Autogen: Fix and extend SKIP_AUTOMOC test
727247c3 Autogen: Read skip files from makefile
1eb1b409 Autogen: Remove VS specific code exclusion
54ec2a8b Autogen: Initializer file type scanning optimizations
cf7b3b96 Autogen: Initializer optimizations and cleanups

Acked-by: Kitware Robot <[email protected]>
Merge-request: !1171
Brad King %!s(int64=8) %!d(string=hai) anos
pai
achega
fc1aaf1432

+ 1 - 1
Modules/AutogenInfo.cmake.in

@@ -4,7 +4,7 @@ set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
 set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
 set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
 set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
 set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
 set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
 set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
-set(AM_BUILD_DIR @_autogen_build_dir@)
+set(AM_BUILD_DIR @_build_dir@)
 set(AM_SOURCES @_sources@)
 set(AM_SOURCES @_sources@)
 set(AM_HEADERS @_headers@)
 set(AM_HEADERS @_headers@)
 # Qt environment
 # Qt environment

+ 0 - 10
Source/cmMakefile.cxx

@@ -3902,16 +3902,6 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
   return false;
   return false;
 }
 }
 
 
-void cmMakefile::AddQtUiFileWithOptions(cmSourceFile* sf)
-{
-  this->QtUiFilesWithOptions.push_back(sf);
-}
-
-std::vector<cmSourceFile*> cmMakefile::GetQtUiFilesWithOptions() const
-{
-  return this->QtUiFilesWithOptions;
-}
-
 static std::string const matchVariables[] = {
 static std::string const matchVariables[] = {
   "CMAKE_MATCH_0", "CMAKE_MATCH_1", "CMAKE_MATCH_2", "CMAKE_MATCH_3",
   "CMAKE_MATCH_0", "CMAKE_MATCH_1", "CMAKE_MATCH_2", "CMAKE_MATCH_3",
   "CMAKE_MATCH_4", "CMAKE_MATCH_5", "CMAKE_MATCH_6", "CMAKE_MATCH_7",
   "CMAKE_MATCH_4", "CMAKE_MATCH_5", "CMAKE_MATCH_6", "CMAKE_MATCH_7",

+ 0 - 5
Source/cmMakefile.h

@@ -736,9 +736,6 @@ public:
   cmStringRange GetCompileDefinitionsEntries() const;
   cmStringRange GetCompileDefinitionsEntries() const;
   cmBacktraceRange GetCompileDefinitionsBacktraces() const;
   cmBacktraceRange GetCompileDefinitionsBacktraces() const;
 
 
-  void AddQtUiFileWithOptions(cmSourceFile* sf);
-  std::vector<cmSourceFile*> GetQtUiFilesWithOptions() const;
-
   std::set<std::string> const& GetSystemIncludeDirectories() const
   std::set<std::string> const& GetSystemIncludeDirectories() const
   {
   {
     return this->SystemIncludeDirectories;
     return this->SystemIncludeDirectories;
@@ -917,8 +914,6 @@ private:
   void UpdateOutputToSourceMap(std::string const& output,
   void UpdateOutputToSourceMap(std::string const& output,
                                cmSourceFile* source);
                                cmSourceFile* source);
 
 
-  std::vector<cmSourceFile*> QtUiFilesWithOptions;
-
   bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
   bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
                                  std::string* error = CM_NULLPTR) const;
                                  std::string* error = CM_NULLPTR) const;
 
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 368 - 325
Source/cmQtAutoGeneratorInitializer.cxx


+ 1 - 1
Source/cmQtAutoGeneratorInitializer.h

@@ -11,7 +11,7 @@ class cmLocalGenerator;
 class cmQtAutoGeneratorInitializer
 class cmQtAutoGeneratorInitializer
 {
 {
 public:
 public:
-  static void InitializeAutogenTarget(cmLocalGenerator* lg,
+  static void InitializeAutogenTarget(cmLocalGenerator* localGen,
                                       cmGeneratorTarget* target);
                                       cmGeneratorTarget* target);
   static void SetupAutoGenerateTarget(cmGeneratorTarget const* target);
   static void SetupAutoGenerateTarget(cmGeneratorTarget const* target);
 };
 };

+ 0 - 9
Source/cmSourceFile.cxx

@@ -17,8 +17,6 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
 {
 {
   this->CustomCommand = CM_NULLPTR;
   this->CustomCommand = CM_NULLPTR;
   this->FindFullPathFailed = false;
   this->FindFullPathFailed = false;
-  this->IsUiFile = (".ui" == cmSystemTools::GetFilenameLastExtension(
-                               this->Location.GetName()));
 }
 }
 
 
 cmSourceFile::~cmSourceFile()
 cmSourceFile::~cmSourceFile()
@@ -245,13 +243,6 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc)
 void cmSourceFile::SetProperty(const std::string& prop, const char* value)
 void cmSourceFile::SetProperty(const std::string& prop, const char* value)
 {
 {
   this->Properties.SetProperty(prop, value);
   this->Properties.SetProperty(prop, value);
-
-  if (this->IsUiFile) {
-    cmMakefile const* mf = this->Location.GetMakefile();
-    if (prop == "AUTOUIC_OPTIONS") {
-      const_cast<cmMakefile*>(mf)->AddQtUiFileWithOptions(this);
-    }
-  }
 }
 }
 
 
 void cmSourceFile::AppendProperty(const std::string& prop, const char* value,
 void cmSourceFile::AppendProperty(const std::string& prop, const char* value,

+ 0 - 1
Source/cmSourceFile.h

@@ -107,7 +107,6 @@ private:
   std::string ObjectLibrary;
   std::string ObjectLibrary;
   std::vector<std::string> Depends;
   std::vector<std::string> Depends;
   bool FindFullPathFailed;
   bool FindFullPathFailed;
-  bool IsUiFile;
 
 
   bool FindFullPath(std::string* error);
   bool FindFullPath(std::string* error);
   bool TryFullPath(const std::string& path, const std::string& ext);
   bool TryFullPath(const std::string& path, const std::string& ext);

+ 13 - 2
Tests/QtAutogen/CMakeLists.txt

@@ -114,16 +114,27 @@ target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES})
 # -- Test
 # -- Test
 # Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
 # Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
 if(ALLOW_WRAP_CPP)
 if(ALLOW_WRAP_CPP)
+  # Generate header mocs manually
   qtx_wrap_cpp(skipMocWrapMoc
   qtx_wrap_cpp(skipMocWrapMoc
     skipSource/qItemA.hpp
     skipSource/qItemA.hpp
-    skipSource/qItemB.hpp)
+    skipSource/qItemB.hpp
+    skipSource/qItemC.hpp
+    skipSource/qItemD.hpp
+    )
   set(skipMocSources
   set(skipMocSources
     skipMoc.cpp
     skipMoc.cpp
     skipSource/qItemA.cpp
     skipSource/qItemA.cpp
     skipSource/qItemB.cpp
     skipSource/qItemB.cpp
-    skipSource/qItemC.cpp)
+    skipSource/qItemC.cpp
+    skipSource/qItemD.cpp
+    )
+  # When cpp files are skipped, the hpp won't be processed either,
+  # unless they are mentioned in the sources - which they aren't.
   set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
   set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
   set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
   set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
+  # When hpp files are skipped, the cpp still get processed.
+  set_property(SOURCE skipSource/qItemC.hpp PROPERTY SKIP_AUTOMOC ON)
+  set_property(SOURCE skipSource/qItemD.hpp PROPERTY SKIP_AUTOGEN ON)
   # AUTOMOC enabled only
   # AUTOMOC enabled only
   add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
   add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
   set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
   set_property(TARGET skipMocA PROPERTY AUTOMOC ON)

+ 4 - 2
Tests/QtAutogen/skipMoc.cpp

@@ -2,12 +2,14 @@
 #include "skipSource/qItemA.hpp"
 #include "skipSource/qItemA.hpp"
 #include "skipSource/qItemB.hpp"
 #include "skipSource/qItemB.hpp"
 #include "skipSource/qItemC.hpp"
 #include "skipSource/qItemC.hpp"
+#include "skipSource/qItemD.hpp"
 
 
 int main(int, char**)
 int main(int, char**)
 {
 {
   QItemA itemA;
   QItemA itemA;
-  QItemA itemB;
-  QItemA itemC;
+  QItemB itemB;
+  QItemC itemC;
+  QItemD itemD;
 
 
   // Fails to link if the symbol is not present.
   // Fails to link if the symbol is not present.
   return 0;
   return 0;

+ 12 - 0
Tests/QtAutogen/skipSource/qItemC.cpp

@@ -1,5 +1,17 @@
 #include "qItemC.hpp"
 #include "qItemC.hpp"
 
 
+class QItemC_Local : public QObject
+{
+  Q_OBJECT
+public:
+  QItemC_Local(){};
+  ~QItemC_Local(){};
+};
+
 void QItemC::go()
 void QItemC::go()
 {
 {
+  QItemC_Local localObject;
 }
 }
+
+// We need AUTOMOC processing
+#include "qItemC.moc"

+ 17 - 0
Tests/QtAutogen/skipSource/qItemD.cpp

@@ -0,0 +1,17 @@
+#include "qItemD.hpp"
+
+class QItemD_Local : public QObject
+{
+  Q_OBJECT
+public:
+  QItemD_Local(){};
+  ~QItemD_Local(){};
+};
+
+void QItemD::go()
+{
+  QItemD_Local localObject;
+}
+
+// We need AUTOMOC processing
+#include "qItemD.moc"

+ 13 - 0
Tests/QtAutogen/skipSource/qItemD.hpp

@@ -0,0 +1,13 @@
+#ifndef QITEMD_HPP
+#define QITEMD_HPP
+
+#include <QObject>
+
+class QItemD : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+
+#endif

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio