cmQtAutoGenerators.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 const* target);
  22. void SetupSourceFiles(cmTarget const* target);
  23. private:
  24. void SetupAutoMocTarget(cmTarget const* target,
  25. const std::string &autogenTargetName,
  26. std::map<std::string, std::string> &configIncludes,
  27. std::map<std::string, std::string> &configDefines);
  28. void SetupAutoUicTarget(cmTarget const* target,
  29. std::map<std::string, std::string> &configUicOptions);
  30. void SetupAutoRccTarget(cmTarget const* target);
  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& path, 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::map<std::string, 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::map<std::string, 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::map<std::string, std::string>& includedUis);
  58. void ParseForUic(const std::string& fileName,
  59. const std::string& contentsString,
  60. std::map<std::string, std::string>& includedUis);
  61. void ParseForUic(const std::string& fileName,
  62. std::map<std::string, 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. void MergeUicOptions(std::vector<std::string> &opts,
  68. const std::vector<std::string> &fileOpts, bool isQt5);
  69. void MergeRccOptions(std::vector<std::string> &opts,
  70. const std::vector<std::string> &fileOpts, bool isQt5);
  71. std::string QtMajorVersion;
  72. std::string Sources;
  73. std::string RccSources;
  74. std::string SkipMoc;
  75. std::string SkipUic;
  76. std::string Headers;
  77. bool IncludeProjectDirsBefore;
  78. std::string Srcdir;
  79. std::string Builddir;
  80. std::string MocExecutable;
  81. std::string UicExecutable;
  82. std::string RccExecutable;
  83. std::string MocCompileDefinitionsStr;
  84. std::string MocIncludesStr;
  85. std::string MocOptionsStr;
  86. std::string ProjectBinaryDir;
  87. std::string ProjectSourceDir;
  88. std::string TargetName;
  89. std::string CurrentCompileSettingsStr;
  90. std::string OldCompileSettingsStr;
  91. std::string OutMocCppFilename;
  92. std::list<std::string> MocIncludes;
  93. std::list<std::string> MocDefinitions;
  94. std::vector<std::string> MocOptions;
  95. std::vector<std::string> UicTargetOptions;
  96. std::map<std::string, std::string> UicOptions;
  97. std::map<std::string, std::string> RccOptions;
  98. bool Verbose;
  99. bool ColorOutput;
  100. bool RunMocFailed;
  101. bool RunUicFailed;
  102. bool RunRccFailed;
  103. bool GenerateAll;
  104. bool RelaxedMode;
  105. };
  106. #endif