diff options
Diffstat (limited to 'Source/cmQtAutoGenInitializer.h')
-rw-r--r-- | Source/cmQtAutoGenInitializer.h | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index ce00e00..903ec85 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -4,15 +4,18 @@ #define cmQtAutoGenInitializer_h #include "cmConfigure.h" // IWYU pragma: keep +#include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" #include <map> +#include <ostream> #include <set> #include <string> #include <vector> class cmGeneratorTarget; class cmTarget; +class cmQtAutoGenGlobalInitializer; /// @brief Initializes the QtAutoGen generators class cmQtAutoGenInitializer : public cmQtAutoGen @@ -43,12 +46,47 @@ public: std::vector<std::string> 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 + operator bool() const { return static_cast<bool>(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 <class C> + void WriteStrings(const char* key, C const& container); + void WriteConfig(const char* key, + std::map<std::string, std::string> const& map); + template <class C> + void WriteConfigStrings(const char* key, + std::map<std::string, C> const& map); + void WriteNestedLists(const char* key, + std::vector<std::vector<std::string>> const& lists); + + private: + template <class IT> + 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(cmGeneratorTarget* target, bool mocEnabled, + cmQtAutoGenInitializer(cmQtAutoGenGlobalInitializer* globalInitializer, + cmGeneratorTarget* target, + IntegerVersion const& qtVersion, bool mocEnabled, bool uicEnabled, bool rccEnabled, - IntegerVersion const& qtVersion); + bool globalAutogenTarget, bool globalAutoRccTarget); bool InitCustomTargets(); bool SetupCustomTargets(); @@ -76,6 +114,7 @@ private: std::string& errorMessage); private: + cmQtAutoGenGlobalInitializer* GlobalInitializer; cmGeneratorTarget* Target; // Configuration @@ -100,6 +139,7 @@ private: struct { std::string Name; + bool GlobalTarget = false; // Settings std::string Parallel; // Configuration files @@ -107,6 +147,7 @@ private: std::string SettingsFile; std::map<std::string, std::string> ConfigSettingsFile; // Dependencies + bool DependOrigin = false; std::set<std::string> DependFiles; std::set<cmTarget*> DependTargets; // Sources to process @@ -123,10 +164,10 @@ private: std::string Executable; std::string PredefsCmd; std::set<std::string> Skip; - std::string Includes; - std::map<std::string, std::string> ConfigIncludes; - std::string Defines; - std::map<std::string, std::string> ConfigDefines; + std::vector<std::string> Includes; + std::map<std::string, std::vector<std::string>> ConfigIncludes; + std::set<std::string> Defines; + std::map<std::string, std::set<std::string>> ConfigDefines; std::string MocsCompilation; } Moc; @@ -137,8 +178,8 @@ private: std::string Executable; std::set<std::string> Skip; std::vector<std::string> SearchPaths; - std::string Options; - std::map<std::string, std::string> ConfigOptions; + std::vector<std::string> Options; + std::map<std::string, std::vector<std::string>> ConfigOptions; std::vector<std::string> FileFiles; std::vector<std::vector<std::string>> FileOptions; } Uic; @@ -147,6 +188,7 @@ private: struct { bool Enabled = false; + bool GlobalTarget = false; std::string Executable; std::vector<std::string> ListOptions; std::vector<Qrc> Qrcs; |