cmQtAutoGenerators.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. class cmGlobalGenerator;
  14. class cmMakefile;
  15. class cmQtAutoGenerators
  16. {
  17. public:
  18. cmQtAutoGenerators();
  19. bool Run(const char* targetDirectory, const char *config);
  20. bool InitializeAutogenTarget(cmTarget* target);
  21. void SetupAutoGenerateTarget(cmTarget* target);
  22. private:
  23. void SetupAutoMocTarget(cmTarget* target,
  24. const std::string &autogenTargetName,
  25. std::map<std::string, std::string> &configIncludes,
  26. std::map<std::string, std::string> &configDefines);
  27. void SetupAutoUicTarget(cmTarget* target);
  28. void SetupAutoRccTarget(cmTarget* target);
  29. cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
  30. const char* targetDirectory);
  31. bool ReadAutogenInfoFile(cmMakefile* makefile,
  32. const char* targetDirectory,
  33. const char *config);
  34. bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
  35. const char* targetDirectory);
  36. void WriteOldMocDefinitionsFile(const char* targetDirectory);
  37. std::string MakeCompileSettingsString(cmMakefile* makefile);
  38. bool RunAutogen(cmMakefile* makefile);
  39. bool GenerateMoc(const std::string& sourceFile,
  40. const std::string& mocFileName);
  41. bool GenerateUi(const std::string& uiFileName);
  42. bool GenerateQrc();
  43. void ParseCppFile(const std::string& absFilename,
  44. const std::vector<std::string>& headerExtensions,
  45. std::map<std::string, std::string>& includedMocs,
  46. std::vector<std::string>& includedUis);
  47. void StrictParseCppFile(const std::string& absFilename,
  48. const std::vector<std::string>& headerExtensions,
  49. std::map<std::string, std::string>& includedMocs,
  50. std::vector<std::string>& includedUis);
  51. void SearchHeadersForCppFile(const std::string& absFilename,
  52. const std::vector<std::string>& headerExtensions,
  53. std::set<std::string>& absHeaders);
  54. void ParseHeaders(const std::set<std::string>& absHeaders,
  55. const std::map<std::string, std::string>& includedMocs,
  56. std::map<std::string, std::string>& notIncludedMocs,
  57. std::vector<std::string>& includedUis);
  58. void ParseForUic(const std::string& fileName,
  59. const std::string& contentsString,
  60. std::vector<std::string>& includedUis);
  61. void ParseForUic(const std::string& fileName,
  62. std::vector<std::string>& includedUis);
  63. void Init();
  64. std::string Join(const std::vector<std::string>& lst, char separator);
  65. bool EndsWith(const std::string& str, const std::string& with);
  66. bool StartsWith(const std::string& str, const std::string& with);
  67. std::string ReadAll(const std::string& filename);
  68. void MergeUicOptions(std::vector<std::string> &opts,
  69. const std::vector<std::string> &fileOpts, bool isQt5);
  70. void MergeRccOptions(std::vector<std::string> &opts,
  71. const std::vector<std::string> &fileOpts, bool isQt5);
  72. std::string QtMajorVersion;
  73. std::string Sources;
  74. std::string RccSources;
  75. std::string SkipMoc;
  76. std::string SkipUic;
  77. std::string Headers;
  78. bool IncludeProjectDirsBefore;
  79. std::string Srcdir;
  80. std::string Builddir;
  81. std::string MocExecutable;
  82. std::string UicExecutable;
  83. std::string RccExecutable;
  84. std::string MocCompileDefinitionsStr;
  85. std::string MocIncludesStr;
  86. std::string MocOptionsStr;
  87. std::string ProjectBinaryDir;
  88. std::string ProjectSourceDir;
  89. std::string TargetName;
  90. std::string CurrentCompileSettingsStr;
  91. std::string OldCompileSettingsStr;
  92. std::string OutMocCppFilename;
  93. std::list<std::string> MocIncludes;
  94. std::list<std::string> MocDefinitions;
  95. std::vector<std::string> MocOptions;
  96. std::vector<std::string> UicTargetOptions;
  97. std::map<std::string, std::string> UicOptions;
  98. std::map<std::string, std::string> RccOptions;
  99. bool Verbose;
  100. bool ColorOutput;
  101. bool RunMocFailed;
  102. bool RunUicFailed;
  103. bool RunRccFailed;
  104. bool GenerateAll;
  105. bool RelaxedMode;
  106. };
  107. #endif