cmQtAutoGenerators.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2004-2011 Kitware, Inc.
  4. Copyright 2011 Alexander Neundorf ([email protected])
  5. Distributed under the OSI-approved BSD License (the "License");
  6. see accompanying file Copyright.txt for details.
  7. This software is distributed WITHOUT ANY WARRANTY; without even the
  8. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. See the License for more information.
  10. ============================================================================*/
  11. #ifndef cmQtAutoGenerators_h
  12. #define cmQtAutoGenerators_h
  13. #include <list>
  14. #include <vector>
  15. #include <string>
  16. #include <map>
  17. class cmMakefile;
  18. class cmQtAutoGenerators
  19. {
  20. public:
  21. cmQtAutoGenerators();
  22. bool Run(const std::string& targetDirectory, const std::string& config);
  23. private:
  24. bool ReadAutogenInfoFile(cmMakefile* makefile,
  25. const std::string& targetDirectory,
  26. const std::string& config);
  27. bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
  28. const std::string& targetDirectory);
  29. void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
  30. std::string MakeCompileSettingsString(cmMakefile* makefile);
  31. bool RunAutogen(cmMakefile* makefile);
  32. bool GenerateMocFiles(
  33. const std::map<std::string, std::string>& includedMocs,
  34. const std::map<std::string, std::string>& notIncludedMocs);
  35. bool GenerateMoc(const std::string& sourceFile,
  36. const std::string& mocFileName);
  37. bool GenerateUiFiles(
  38. const std::map<std::string, std::vector<std::string> >& includedUis );
  39. bool GenerateUi(const std::string& realName,
  40. const std::string& uiInputFile,
  41. const std::string& uiOutputFile );
  42. bool GenerateQrcFiles();
  43. bool GenerateQrc(const std::string& qrcInputFile,
  44. const std::string& qrcOutputFile);
  45. void ParseCppFile(const std::string& absFilename,
  46. const std::vector<std::string>& headerExtensions,
  47. std::map<std::string, std::string>& includedMocs,
  48. std::map<std::string, std::vector<std::string> >& includedUis);
  49. void StrictParseCppFile(const std::string& absFilename,
  50. const std::vector<std::string>& headerExtensions,
  51. std::map<std::string, std::string>& includedMocs,
  52. std::map<std::string, std::vector<std::string> >& includedUis);
  53. void SearchHeadersForCppFile(const std::string& absFilename,
  54. const std::vector<std::string>& headerExtensions,
  55. std::set<std::string>& absHeaders);
  56. void ParseHeaders(const std::set<std::string>& absHeaders,
  57. const std::map<std::string, std::string>& includedMocs,
  58. std::map<std::string, std::string>& notIncludedMocs,
  59. std::map<std::string, std::vector<std::string> >& includedUis);
  60. void ParseForUic(const std::string& fileName,
  61. const std::string& contentsString,
  62. std::map<std::string, std::vector<std::string> >& includedUis);
  63. void ParseForUic(const std::string& fileName,
  64. std::map<std::string, std::vector<std::string> >& includedUis);
  65. void Init();
  66. std::string SourceRelativePath(const std::string& filename);
  67. bool NameCollisionTest(const std::map<std::string, std::string >& genFiles,
  68. std::multimap<std::string, std::string>& collisions );
  69. void NameCollisionLog(
  70. const std::string& message,
  71. const std::multimap<std::string, std::string>& collisions );
  72. void LogInfo(const std::string& message);
  73. void LogError(const std::string& message);
  74. void LogCommand(const std::vector<std::string>& command);
  75. std::string JoinExts(const std::vector<std::string>& lst);
  76. static void MergeUicOptions(std::vector<std::string> &opts,
  77. const std::vector<std::string> &fileOpts, bool isQt5);
  78. bool InputFilesNewerThanQrc(const std::string& qrcFile,
  79. const std::string& rccOutput);
  80. std::string QtMajorVersion;
  81. std::string Sources;
  82. std::vector<std::string> RccSources;
  83. std::string SkipMoc;
  84. std::string SkipUic;
  85. std::string Headers;
  86. std::string Srcdir;
  87. std::string Builddir;
  88. std::string MocExecutable;
  89. std::string UicExecutable;
  90. std::string RccExecutable;
  91. std::string MocCompileDefinitionsStr;
  92. std::string MocIncludesStr;
  93. std::string MocOptionsStr;
  94. std::string ProjectBinaryDir;
  95. std::string ProjectSourceDir;
  96. std::string TargetName;
  97. std::string OriginTargetName;
  98. std::string CurrentCompileSettingsStr;
  99. std::string OldCompileSettingsStr;
  100. std::string TargetBuildSubDir;
  101. std::string OutMocCppFilenameRel;
  102. std::string OutMocCppFilenameAbs;
  103. std::list<std::string> MocIncludes;
  104. std::list<std::string> MocDefinitions;
  105. std::vector<std::string> MocOptions;
  106. std::vector<std::string> UicTargetOptions;
  107. std::map<std::string, std::string> UicOptions;
  108. std::map<std::string, std::string> RccOptions;
  109. std::map<std::string, std::vector<std::string> > RccInputs;
  110. bool IncludeProjectDirsBefore;
  111. bool Verbose;
  112. bool ColorOutput;
  113. bool RunMocFailed;
  114. bool RunUicFailed;
  115. bool RunRccFailed;
  116. bool GenerateAll;
  117. bool RelaxedMode;
  118. };
  119. #endif