/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #ifndef cmQtAutoGenInitializer_h #define cmQtAutoGenInitializer_h #include "cmConfigure.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" #include #include #include #include #include class cmGeneratorTarget; class cmTarget; class cmQtAutoGenGlobalInitializer; /// @brief Initializes the QtAutoGen generators class cmQtAutoGenInitializer : public cmQtAutoGen { public: /// @brief Rcc job information class Qrc { public: Qrc() : Generated(false) , Unique(false) { } public: std::string LockFile; std::string QrcFile; std::string QrcName; std::string PathChecksum; std::string InfoFile; std::string SettingsFile; std::map ConfigSettingsFile; std::string RccFile; bool Generated; bool Unique; std::vector Options; std::vector Resources; }; /// @brief Writes a CMake info file class InfoWriter { public: /// @brief Open the given file InfoWriter(std::string const& filename); /// @return True if the file is open explicit operator bool() const { return static_cast(Ofs_); } void Write(const char* text) { Ofs_ << text; } void Write(const char* key, std::string const& value); void WriteUInt(const char* key, unsigned int value); template void WriteStrings(const char* key, C const& container); void WriteConfig(const char* key, std::map const& map); template void WriteConfigStrings(const char* key, std::map const& map); void WriteNestedLists(const char* key, std::vector> const& lists); private: template static std::string ListJoin(IT it_begin, IT it_end); static std::string ConfigKey(const char* key, std::string const& config); private: cmGeneratedFileStream Ofs_; }; public: static IntegerVersion GetQtVersion(cmGeneratorTarget const* target); cmQtAutoGenInitializer(cmQtAutoGenGlobalInitializer* globalInitializer, cmGeneratorTarget* target, IntegerVersion const& qtVersion, bool mocEnabled, bool uicEnabled, bool rccEnabled, bool globalAutogenTarget, bool globalAutoRccTarget); bool InitCustomTargets(); bool SetupCustomTargets(); private: bool InitMoc(); bool InitUic(); bool InitRcc(); bool InitScanFiles(); bool InitAutogenTarget(); bool InitRccTargets(); bool SetupWriteAutogenInfo(); bool SetupWriteRccInfo(); void AddGeneratedSource(std::string const& filename, GeneratorT genType); bool GetMocExecutable(); bool GetUicExecutable(); bool GetRccExecutable(); bool RccListInputs(std::string const& fileName, std::vector& files, std::string& errorMessage); private: cmQtAutoGenGlobalInitializer* GlobalInitializer; cmGeneratorTarget* Target; // Configuration IntegerVersion QtVersion; bool MultiConfig = false; std::string ConfigDefault; std::vector ConfigsList; std::string Verbosity; std::string TargetsFolder; /// @brief Common directories struct { std::string Info; std::string Build; std::string Work; std::string Include; std::map ConfigInclude; } Dir; /// @brief Autogen target variables struct { std::string Name; bool GlobalTarget = false; // Settings std::string Parallel; // Configuration files std::string InfoFile; std::string SettingsFile; std::map ConfigSettingsFile; // Dependencies bool DependOrigin = false; std::set DependFiles; std::set DependTargets; // Sources to process std::vector Headers; std::vector Sources; std::vector HeadersGenerated; std::vector SourcesGenerated; } AutogenTarget; /// @brief Moc only variables struct { bool Enabled = false; std::string Executable; std::string PredefsCmd; std::set Skip; std::vector Includes; std::map> ConfigIncludes; std::set Defines; std::map> ConfigDefines; std::string MocsCompilation; } Moc; ///@brief Uic only variables struct { bool Enabled = false; std::string Executable; std::set Skip; std::vector SearchPaths; std::vector Options; std::map> ConfigOptions; std::vector FileFiles; std::vector> FileOptions; } Uic; /// @brief Rcc only variables struct { bool Enabled = false; bool GlobalTarget = false; std::string Executable; std::vector ListOptions; std::vector Qrcs; } Rcc; }; #endif