cmQtAutoGenerators.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. class cmGlobalGenerator;
  15. class cmMakefile;
  16. class cmQtAutoGenerators
  17. {
  18. public:
  19. cmQtAutoGenerators();
  20. bool Run(const std::string& targetDirectory, const std::string& config);
  21. bool InitializeAutogenTarget(cmTarget* target);
  22. void SetupAutoGenerateTarget(cmTarget const* target);
  23. void SetupSourceFiles(cmTarget const* target);
  24. private:
  25. void SetupAutoMocTarget(cmTarget const* target,
  26. const std::string &autogenTargetName,
  27. std::map<std::string, std::string> &configIncludes,
  28. std::map<std::string, std::string> &configDefines);
  29. void SetupAutoUicTarget(cmTarget const* target,
  30. std::map<std::string, std::string> &configUicOptions);
  31. void SetupAutoRccTarget(cmTarget const* target);
  32. bool ReadAutogenInfoFile(cmMakefile* makefile,
  33. const std::string& targetDirectory,
  34. const std::string& config);
  35. bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
  36. const std::string& targetDirectory);
  37. void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
  38. std::string MakeCompileSettingsString(cmMakefile* makefile);
  39. bool RunAutogen(cmMakefile* makefile);
  40. bool GenerateMoc(const std::string& sourceFile,
  41. const std::string& mocFileName);
  42. bool GenerateUi(const std::string& realName, const std::string& uiFileName);
  43. bool GenerateQrc();
  44. void ParseCppFile(const std::string& absFilename,
  45. const std::vector<std::string>& headerExtensions,
  46. std::map<std::string, std::string>& includedMocs,
  47. std::map<std::string, std::vector<std::string> >& includedUis);
  48. void StrictParseCppFile(const std::string& absFilename,
  49. const std::vector<std::string>& headerExtensions,
  50. std::map<std::string, std::string>& includedMocs,
  51. std::map<std::string, std::vector<std::string> >& includedUis);
  52. void SearchHeadersForCppFile(const std::string& absFilename,
  53. const std::vector<std::string>& headerExtensions,
  54. std::set<std::string>& absHeaders);
  55. void ParseHeaders(const std::set<std::string>& absHeaders,
  56. const std::map<std::string, std::string>& includedMocs,
  57. std::map<std::string, std::string>& notIncludedMocs,
  58. std::map<std::string, std::vector<std::string> >& includedUis);
  59. void ParseForUic(const std::string& fileName,
  60. const std::string& contentsString,
  61. std::map<std::string, std::vector<std::string> >& includedUis);
  62. void ParseForUic(const std::string& fileName,
  63. std::map<std::string, std::vector<std::string> >& includedUis);
  64. void Init();
  65. std::string Join(const std::vector<std::string>& lst, char separator);
  66. bool EndsWith(const std::string& str, const std::string& with);
  67. bool StartsWith(const std::string& str, const std::string& with);
  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 GetRccExecutable(cmTarget const* target);
  73. std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target,
  74. std::vector<std::string>& depends);
  75. std::string ListQt4RccInputs(cmSourceFile* sf,
  76. std::vector<std::string>& depends);
  77. bool InputFilesNewerThanQrc(const std::string& qrcFile,
  78. const std::string& rccOutput);
  79. std::string QtMajorVersion;
  80. std::string Sources;
  81. std::vector<std::string> RccSources;
  82. std::string SkipMoc;
  83. std::string SkipUic;
  84. std::string Headers;
  85. bool IncludeProjectDirsBefore;
  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 OutMocCppFilename;
  101. std::list<std::string> MocIncludes;
  102. std::list<std::string> MocDefinitions;
  103. std::vector<std::string> MocOptions;
  104. std::vector<std::string> UicTargetOptions;
  105. std::map<std::string, std::string> UicOptions;
  106. std::map<std::string, std::string> RccOptions;
  107. std::map<std::string, std::vector<std::string> > RccInputs;
  108. bool Verbose;
  109. bool ColorOutput;
  110. bool RunMocFailed;
  111. bool RunUicFailed;
  112. bool RunRccFailed;
  113. bool GenerateAll;
  114. bool RelaxedMode;
  115. };
  116. #endif