cmQtAutoGeneratorRcc.h 2.3 KB

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