cmQtAutoGeneratorRcc.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 cmQtAutoGeneratorRcc_h
  4. #define cmQtAutoGeneratorRcc_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cmQtAutoGenerator.h"
  7. #include "cm_uv.h"
  8. #include <string>
  9. #include <vector>
  10. class cmMakefile;
  11. // @brief AUTORCC generator
  12. class cmQtAutoGeneratorRcc : public cmQtAutoGenerator
  13. {
  14. CM_DISABLE_COPY(cmQtAutoGeneratorRcc)
  15. public:
  16. cmQtAutoGeneratorRcc();
  17. ~cmQtAutoGeneratorRcc() override;
  18. private:
  19. // -- Types
  20. /// @brief Processing stage
  21. enum class StageT : unsigned char
  22. {
  23. SETTINGS_READ,
  24. TEST_QRC_RCC_FILES,
  25. TEST_RESOURCES_READ,
  26. TEST_RESOURCES,
  27. TEST_INFO_FILE,
  28. GENERATE,
  29. GENERATE_RCC,
  30. GENERATE_WRAPPER,
  31. SETTINGS_WRITE,
  32. FINISH,
  33. END
  34. };
  35. // -- Abstract processing interface
  36. bool Init(cmMakefile* makefile) override;
  37. bool Process() override;
  38. // -- Process stage
  39. static void UVPollStage(uv_async_t* handle);
  40. void PollStage();
  41. void SetStage(StageT stage);
  42. // -- Settings file
  43. void SettingsFileRead();
  44. void SettingsFileWrite();
  45. // -- Tests
  46. bool TestQrcRccFiles();
  47. bool TestResourcesRead();
  48. bool TestResources();
  49. void TestInfoFile();
  50. // -- Generation
  51. void GenerateParentDir();
  52. bool GenerateRcc();
  53. void GenerateWrapper();
  54. // -- Utility
  55. bool IsMultiConfig() const { return MultiConfig_; }
  56. std::string MultiConfigOutput() const;
  57. bool StartProcess(std::string const& workingDirectory,
  58. std::vector<std::string> const& command,
  59. bool mergedOutput);
  60. private:
  61. // -- Config settings
  62. bool MultiConfig_;
  63. // -- Directories
  64. std::string AutogenBuildDir_;
  65. std::string IncludeDir_;
  66. // -- Qt environment
  67. std::string RccExecutable_;
  68. std::vector<std::string> RccListOptions_;
  69. // -- Job
  70. std::string QrcFile_;
  71. std::string QrcFileName_;
  72. std::string QrcFileDir_;
  73. std::string RccPathChecksum_;
  74. std::string RccFileName_;
  75. std::string RccFileOutput_;
  76. std::string RccFilePublic_;
  77. std::vector<std::string> Options_;
  78. std::vector<std::string> Inputs_;
  79. // -- Subprocess
  80. ProcessResultT ProcessResult_;
  81. std::unique_ptr<ReadOnlyProcessT> Process_;
  82. // -- Settings file
  83. std::string SettingsFile_;
  84. std::string SettingsString_;
  85. bool SettingsChanged_;
  86. // -- libuv loop
  87. StageT Stage_;
  88. bool Error_;
  89. bool Generate_;
  90. bool BuildFileChanged_;
  91. };
  92. #endif