cmQtAutoGenInitializer.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmQtAutoGenInitializer_h
  4. #define cmQtAutoGenInitializer_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cmQtAutoGen.h"
  7. #include <map>
  8. #include <set>
  9. #include <string>
  10. #include <vector>
  11. class cmGeneratorTarget;
  12. /// @brief Initializes the QtAutoGen generators
  13. class cmQtAutoGenInitializer : public cmQtAutoGen
  14. {
  15. public:
  16. static std::string GetQtMajorVersion(cmGeneratorTarget const* target);
  17. static std::string GetQtMinorVersion(cmGeneratorTarget const* target,
  18. std::string const& qtVersionMajor);
  19. /// @brief Rcc job information
  20. class Qrc
  21. {
  22. public:
  23. Qrc()
  24. : Generated(false)
  25. , Unique(false)
  26. {
  27. }
  28. public:
  29. std::string LockFile;
  30. std::string QrcFile;
  31. std::string QrcName;
  32. std::string PathChecksum;
  33. std::string InfoFile;
  34. std::string SettingsFile;
  35. std::string RccFile;
  36. bool Generated;
  37. bool Unique;
  38. std::vector<std::string> Options;
  39. std::vector<std::string> Resources;
  40. };
  41. public:
  42. cmQtAutoGenInitializer(cmGeneratorTarget* target, bool mocEnabled,
  43. bool uicEnabled, bool rccEnabled,
  44. std::string const& qtVersionMajor);
  45. bool InitCustomTargets();
  46. bool SetupCustomTargets();
  47. private:
  48. bool InitCustomTargetsMoc();
  49. bool InitCustomTargetsUic();
  50. bool InitCustomTargetsRcc();
  51. bool SetupWriteAutogenInfo();
  52. bool SetupWriteRccInfo();
  53. void AddGeneratedSource(std::string const& filename, GeneratorT genType);
  54. bool QtVersionGreaterOrEqual(unsigned long requestMajor,
  55. unsigned long requestMinor) const;
  56. bool GetMocExecutable();
  57. bool GetUicExecutable();
  58. bool GetRccExecutable();
  59. bool RccListInputs(std::string const& fileName,
  60. std::vector<std::string>& files,
  61. std::string& errorMessage);
  62. private:
  63. cmGeneratorTarget* Target;
  64. bool MultiConfig = false;
  65. // Qt
  66. std::string QtVersionMajor;
  67. std::string QtVersionMinor;
  68. // Configurations
  69. std::string ConfigDefault;
  70. std::vector<std::string> ConfigsList;
  71. std::string Parallel;
  72. std::string Verbosity;
  73. // Names
  74. std::string AutogenTargetName;
  75. std::string AutogenFolder;
  76. std::string AutogenInfoFile;
  77. std::string AutogenSettingsFile;
  78. // Directories
  79. std::string DirInfo;
  80. std::string DirBuild;
  81. std::string DirWork;
  82. std::string DirInclude;
  83. std::map<std::string, std::string> DirConfigInclude;
  84. // Sources
  85. std::vector<std::string> Headers;
  86. std::vector<std::string> Sources;
  87. // Moc
  88. struct
  89. {
  90. bool Enabled = false;
  91. std::string Executable;
  92. std::string PredefsCmd;
  93. std::set<std::string> Skip;
  94. std::string Includes;
  95. std::map<std::string, std::string> ConfigIncludes;
  96. std::string Defines;
  97. std::map<std::string, std::string> ConfigDefines;
  98. std::string MocsCompilation;
  99. } Moc;
  100. // Uic
  101. struct
  102. {
  103. bool Enabled = false;
  104. std::string Executable;
  105. std::set<std::string> Skip;
  106. std::vector<std::string> SearchPaths;
  107. std::string Options;
  108. std::map<std::string, std::string> ConfigOptions;
  109. std::vector<std::string> FileFiles;
  110. std::vector<std::vector<std::string>> FileOptions;
  111. } Uic;
  112. // Rcc
  113. struct
  114. {
  115. bool Enabled = false;
  116. std::string Executable;
  117. std::vector<std::string> ListOptions;
  118. std::vector<Qrc> Qrcs;
  119. } Rcc;
  120. };
  121. #endif