cmQtAutoGenInitializer.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. class cmTarget;
  13. /// @brief Initializes the QtAutoGen generators
  14. class cmQtAutoGenInitializer : public cmQtAutoGen
  15. {
  16. public:
  17. /// @brief Rcc job information
  18. class Qrc
  19. {
  20. public:
  21. Qrc()
  22. : Generated(false)
  23. , Unique(false)
  24. {
  25. }
  26. public:
  27. std::string LockFile;
  28. std::string QrcFile;
  29. std::string QrcName;
  30. std::string PathChecksum;
  31. std::string InfoFile;
  32. std::string SettingsFile;
  33. std::map<std::string, std::string> ConfigSettingsFile;
  34. std::string RccFile;
  35. bool Generated;
  36. bool Unique;
  37. std::vector<std::string> Options;
  38. std::vector<std::string> Resources;
  39. };
  40. public:
  41. static IntegerVersion GetQtVersion(cmGeneratorTarget const* target);
  42. cmQtAutoGenInitializer(cmGeneratorTarget* target, bool mocEnabled,
  43. bool uicEnabled, bool rccEnabled,
  44. IntegerVersion const& qtVersion);
  45. bool InitCustomTargets();
  46. bool SetupCustomTargets();
  47. private:
  48. bool InitMoc();
  49. bool InitUic();
  50. bool InitRcc();
  51. bool InitScanFiles();
  52. bool InitAutogenTarget();
  53. bool InitRccTargets();
  54. bool SetupWriteAutogenInfo();
  55. bool SetupWriteRccInfo();
  56. void AddGeneratedSource(std::string const& filename, GeneratorT genType);
  57. bool GetMocExecutable();
  58. bool GetUicExecutable();
  59. bool GetRccExecutable();
  60. bool RccListInputs(std::string const& fileName,
  61. std::vector<std::string>& files,
  62. std::string& errorMessage);
  63. private:
  64. cmGeneratorTarget* Target;
  65. // Configuration
  66. IntegerVersion QtVersion;
  67. bool MultiConfig = false;
  68. std::string ConfigDefault;
  69. std::vector<std::string> ConfigsList;
  70. std::string Verbosity;
  71. std::string TargetsFolder;
  72. /// @brief Common directories
  73. struct
  74. {
  75. std::string Info;
  76. std::string Build;
  77. std::string Work;
  78. std::string Include;
  79. std::map<std::string, std::string> ConfigInclude;
  80. } Dir;
  81. /// @brief Autogen target variables
  82. struct
  83. {
  84. std::string Name;
  85. // Settings
  86. std::string Parallel;
  87. // Configuration files
  88. std::string InfoFile;
  89. std::string SettingsFile;
  90. std::map<std::string, std::string> ConfigSettingsFile;
  91. // Dependencies
  92. bool DependOrigin = false;
  93. std::set<std::string> DependFiles;
  94. std::set<cmTarget*> DependTargets;
  95. // Sources to process
  96. std::vector<std::string> Headers;
  97. std::vector<std::string> Sources;
  98. std::vector<std::string> HeadersGenerated;
  99. std::vector<std::string> SourcesGenerated;
  100. } AutogenTarget;
  101. /// @brief Moc only variables
  102. struct
  103. {
  104. bool Enabled = false;
  105. std::string Executable;
  106. std::string PredefsCmd;
  107. std::set<std::string> Skip;
  108. std::string Includes;
  109. std::map<std::string, std::string> ConfigIncludes;
  110. std::string Defines;
  111. std::map<std::string, std::string> ConfigDefines;
  112. std::string MocsCompilation;
  113. } Moc;
  114. ///@brief Uic only variables
  115. struct
  116. {
  117. bool Enabled = false;
  118. std::string Executable;
  119. std::set<std::string> Skip;
  120. std::vector<std::string> SearchPaths;
  121. std::string Options;
  122. std::map<std::string, std::string> ConfigOptions;
  123. std::vector<std::string> FileFiles;
  124. std::vector<std::vector<std::string>> FileOptions;
  125. } Uic;
  126. /// @brief Rcc only variables
  127. struct
  128. {
  129. bool Enabled = false;
  130. std::string Executable;
  131. std::vector<std::string> ListOptions;
  132. std::vector<Qrc> Qrcs;
  133. } Rcc;
  134. };
  135. #endif