diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-02-12 14:59:52 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-02-21 17:27:10 (GMT) |
commit | d9893fb594c904605b3b9ebf3548d2f48793f788 (patch) | |
tree | a4664687476a302a3315aa6c5a0c140c14cc33a0 /Source/cmQtAutoGenInitializer.h | |
parent | 5e36209f716900cb8a61c1bffd480c639be041bb (diff) | |
download | CMake-d9893fb594c904605b3b9ebf3548d2f48793f788.zip CMake-d9893fb594c904605b3b9ebf3548d2f48793f788.tar.gz CMake-d9893fb594c904605b3b9ebf3548d2f48793f788.tar.bz2 |
Autogen: Refactor Qt executable name computation
In AUTOGEN a common new base class cmQtAutoGenInitializer::GenVarsT for
mo/uic/rcc generator variables allows to generalize variable computation
functions.
Diffstat (limited to 'Source/cmQtAutoGenInitializer.h')
-rw-r--r-- | Source/cmQtAutoGenInitializer.h | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 816e1af..d3db8ea 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -40,6 +40,27 @@ public: std::vector<std::string> Resources; }; + /// @brief Abstract moc/uic/rcc generator variables base class + struct GenVarsT + { + bool Enabled = false; + // Generator type/name + GenT Gen; + std::string const& GenName; + std::string const& GenNameUpper; + // Executable + std::string ExecutableTargetName; + cmGeneratorTarget* ExecutableTarget = nullptr; + std::string Executable; + + /// @brief Constructor + GenVarsT(GenT gen, std::string const& genName, + std::string const& genNameUpper) + : Gen(gen) + , GenName(genName) + , GenNameUpper(genNameUpper){}; + }; + /// @brief Writes a CMake info file class InfoWriter { @@ -102,18 +123,13 @@ private: void AddGeneratedSource(std::string const& filename, GenT genType, bool prepend = false); - bool GetMocExecutable(); - bool GetUicExecutable(); - bool GetRccExecutable(); + bool GetQtExecutable(GenVarsT& genVars, const std::string& executable, + bool ignoreMissingTarget, std::string* output) const; bool RccListInputs(std::string const& fileName, std::vector<std::string>& files, std::string& errorMessage); - std::pair<bool, std::string> GetQtExecutable(const std::string& executable, - bool ignoreMissingTarget, - std::string* output); - private: cmQtAutoGenGlobalInitializer* GlobalInitializer; cmGeneratorTarget* Target; @@ -159,10 +175,8 @@ private: } AutogenTarget; /// @brief Moc only variables - struct + struct MocT : public GenVarsT { - bool Enabled = false; - std::string Executable; std::string PredefsCmd; std::set<std::string> Skip; std::vector<std::string> Includes; @@ -170,29 +184,40 @@ private: std::set<std::string> Defines; std::map<std::string, std::set<std::string>> ConfigDefines; std::string MocsCompilation; + + /// @brief Constructor + MocT() + : GenVarsT(cmQtAutoGen::GenT::MOC, cmQtAutoGen::GenNameMoc, + cmQtAutoGen::GenNameMocUpper){}; } Moc; - ///@brief Uic only variables - struct + /// @brief Uic only variables + struct UicT : public GenVarsT { - bool Enabled = false; - std::string Executable; std::set<std::string> Skip; std::vector<std::string> SearchPaths; 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; + + /// @brief Constructor + UicT() + : GenVarsT(cmQtAutoGen::GenT::UIC, cmQtAutoGen::GenNameUic, + cmQtAutoGen::GenNameUicUpper){}; } Uic; /// @brief Rcc only variables - struct + struct RccT : public GenVarsT { - bool Enabled = false; bool GlobalTarget = false; - std::string Executable; std::vector<std::string> ListOptions; std::vector<Qrc> Qrcs; + + /// @brief Constructor + RccT() + : GenVarsT(cmQtAutoGen::GenT::RCC, cmQtAutoGen::GenNameRcc, + cmQtAutoGen::GenNameRccUpper){}; } Rcc; }; |