cmQtAutoGeneratorRcc.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 "cmFileLock.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 : unsigned char
  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. bool 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 IsMultiConfig() const { return MultiConfig_; }
  57. std::string MultiConfigOutput() const;
  58. bool StartProcess(std::string const& workingDirectory,
  59. std::vector<std::string> const& command,
  60. bool mergedOutput);
  61. private:
  62. // -- Config settings
  63. bool MultiConfig_ = false;
  64. // -- Directories
  65. std::string AutogenBuildDir_;
  66. std::string IncludeDir_;
  67. // -- Qt environment
  68. std::string RccExecutable_;
  69. std::vector<std::string> RccListOptions_;
  70. // -- Job
  71. std::string LockFile_;
  72. cmFileLock LockFileLock_;
  73. std::string QrcFile_;
  74. std::string QrcFileName_;
  75. std::string QrcFileDir_;
  76. std::string RccPathChecksum_;
  77. std::string RccFileName_;
  78. std::string RccFileOutput_;
  79. std::string RccFilePublic_;
  80. std::vector<std::string> Options_;
  81. std::vector<std::string> Inputs_;
  82. // -- Subprocess
  83. ProcessResultT ProcessResult_;
  84. std::unique_ptr<ReadOnlyProcessT> Process_;
  85. // -- Settings file
  86. std::string SettingsFile_;
  87. std::string SettingsString_;
  88. bool SettingsChanged_ = false;
  89. // -- libuv loop
  90. StageT Stage_ = StageT::SETTINGS_READ;
  91. bool Error_ = false;
  92. bool Generate_ = false;
  93. bool BuildFileChanged_ = false;
  94. };
  95. #endif