cmQtAutoGenerators.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 "cmStandardIncludes.h"
  14. #include <list>
  15. #include <map>
  16. #include <string>
  17. #include <vector>
  18. class cmMakefile;
  19. class cmQtAutoGenerators
  20. {
  21. public:
  22. cmQtAutoGenerators();
  23. bool Run(const std::string& targetDirectory, const std::string& config);
  24. private:
  25. bool ReadAutogenInfoFile(cmMakefile* makefile,
  26. const std::string& targetDirectory,
  27. const std::string& config);
  28. bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
  29. const std::string& targetDirectory);
  30. void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
  31. std::string MakeCompileSettingsString(cmMakefile* makefile);
  32. bool RunAutogen(cmMakefile* makefile);
  33. bool GenerateMocFiles(
  34. const std::map<std::string, std::string>& includedMocs,
  35. const std::map<std::string, std::string>& notIncludedMocs);
  36. bool GenerateMoc(const std::string& sourceFile,
  37. const std::string& mocFileName);
  38. bool GenerateUiFiles(
  39. const std::map<std::string, std::vector<std::string> >& includedUis);
  40. bool GenerateUi(const std::string& realName, 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(
  46. const std::string& absFilename,
  47. const std::vector<std::string>& headerExtensions,
  48. std::map<std::string, std::string>& includedMocs,
  49. std::map<std::string, std::vector<std::string> >& includedUis);
  50. void StrictParseCppFile(
  51. const std::string& absFilename,
  52. const std::vector<std::string>& headerExtensions,
  53. std::map<std::string, std::string>& includedMocs,
  54. std::map<std::string, std::vector<std::string> >& includedUis);
  55. void SearchHeadersForCppFile(
  56. const std::string& absFilename,
  57. const std::vector<std::string>& headerExtensions,
  58. std::set<std::string>& absHeaders);
  59. void ParseHeaders(
  60. const std::set<std::string>& absHeaders,
  61. const std::map<std::string, std::string>& includedMocs,
  62. std::map<std::string, std::string>& notIncludedMocs,
  63. std::map<std::string, std::vector<std::string> >& includedUis);
  64. void ParseForUic(
  65. const std::string& fileName, const std::string& contentsString,
  66. std::map<std::string, std::vector<std::string> >& includedUis);
  67. void ParseForUic(
  68. const std::string& fileName,
  69. std::map<std::string, std::vector<std::string> >& includedUis);
  70. void Init();
  71. bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
  72. std::multimap<std::string, std::string>& collisions);
  73. void NameCollisionLog(
  74. const std::string& message,
  75. const std::multimap<std::string, std::string>& collisions);
  76. void LogInfo(const std::string& message);
  77. void LogError(const std::string& message);
  78. void LogCommand(const std::vector<std::string>& command);
  79. std::string JoinExts(const std::vector<std::string>& lst);
  80. static void MergeUicOptions(std::vector<std::string>& opts,
  81. const std::vector<std::string>& fileOpts,
  82. bool isQt5);
  83. bool InputFilesNewerThanQrc(const std::string& qrcFile,
  84. const std::string& rccOutput);
  85. std::string QtMajorVersion;
  86. std::string Sources;
  87. std::vector<std::string> RccSources;
  88. std::string SkipMoc;
  89. std::string SkipUic;
  90. std::string Headers;
  91. std::string Srcdir;
  92. std::string Builddir;
  93. std::string MocExecutable;
  94. std::string UicExecutable;
  95. std::string RccExecutable;
  96. std::string MocCompileDefinitionsStr;
  97. std::string MocIncludesStr;
  98. std::string MocOptionsStr;
  99. std::string ProjectBinaryDir;
  100. std::string ProjectSourceDir;
  101. std::string TargetName;
  102. std::string OriginTargetName;
  103. std::string CurrentCompileSettingsStr;
  104. std::string OldCompileSettingsStr;
  105. std::string TargetBuildSubDir;
  106. std::string OutMocCppFilenameRel;
  107. std::string OutMocCppFilenameAbs;
  108. std::list<std::string> MocIncludes;
  109. std::list<std::string> MocDefinitions;
  110. std::vector<std::string> MocOptions;
  111. std::vector<std::string> UicTargetOptions;
  112. std::map<std::string, std::string> UicOptions;
  113. std::map<std::string, std::string> RccOptions;
  114. std::map<std::string, std::vector<std::string> > RccInputs;
  115. bool IncludeProjectDirsBefore;
  116. bool Verbose;
  117. bool ColorOutput;
  118. bool RunMocFailed;
  119. bool RunUicFailed;
  120. bool RunRccFailed;
  121. bool GenerateAll;
  122. bool RelaxedMode;
  123. };
  124. #endif