diff options
author | Brad King <brad.king@kitware.com> | 2017-09-08 13:44:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-08 13:45:07 (GMT) |
commit | e5c1a7dfb3ca419967511ac471c91ebc2c5d76a1 (patch) | |
tree | d77daf590097eba6f265c231cfbb94743c0861b9 /Source/cmQtAutoGenerators.h | |
parent | 90b6186cbdf4e1deeeaa60eaae00e8461136ea6a (diff) | |
parent | 6739a12571bfa8b97b00740981e9f6eb5195529f (diff) | |
download | CMake-e5c1a7dfb3ca419967511ac471c91ebc2c5d76a1.zip CMake-e5c1a7dfb3ca419967511ac471c91ebc2c5d76a1.tar.gz CMake-e5c1a7dfb3ca419967511ac471c91ebc2c5d76a1.tar.bz2 |
Merge topic 'autogen-digests'
6739a125 Autogen: Doc: Add Visual Studio PRE_BUILD note to cmake-qt.rst
2be0acb7 Autogen: Tests: Add AUTOGEN_TARGET_DEPENDS test to mocDepends tests
734d236c Autogen: Smarter target dependency computation
2e4dab08 Autogen: Set CM_DISABLE_COPY in cmQtAutoGenerators
c330d641 Autogen: Replace CM_AUTO_PTR with std::unique_ptr
9468e926 Autogen: Refactor logging
2ba1b281 Autogen: More use of scoped lambdas
0f9080e2 Autogen: More use of scoped lambdas
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1198
Diffstat (limited to 'Source/cmQtAutoGenerators.h')
-rw-r--r-- | Source/cmQtAutoGenerators.h | 92 |
1 files changed, 65 insertions, 27 deletions
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 5cb3d9f..5d3ad74 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -6,18 +6,19 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmFilePathChecksum.h" +#include "cmQtAutoGen.h" #include "cmsys/RegularExpression.hxx" #include <map> #include <set> #include <string> -#include <utility> #include <vector> class cmMakefile; class cmQtAutoGenerators { + CM_DISABLE_COPY(cmQtAutoGenerators) public: cmQtAutoGenerators(); bool Run(const std::string& targetDirectory, const std::string& config); @@ -25,13 +26,35 @@ public: private: // -- Types - /// @brief Used to extract additional dependencies from content text - struct MocDependFilter + /// @brief Search key plus regular expression pair + struct KeyRegExp { - std::string key; - cmsys::RegularExpression regExp; + KeyRegExp() = default; + + KeyRegExp(const char* key, const char* regExp) + : Key(key) + , RegExp(regExp) + { + } + + KeyRegExp(const std::string& key, const std::string& regExp) + : Key(key) + , RegExp(regExp) + { + } + + std::string Key; + cmsys::RegularExpression RegExp; + }; + + /// @brief RCC job + struct RccJob + { + std::string QrcFile; + std::string RccFile; + std::vector<std::string> Options; + std::vector<std::string> Inputs; }; - typedef std::pair<std::string, cmsys::RegularExpression> MocMacroFilter; // -- Configuration bool MocDependFilterPush(const std::string& key, const std::string& regExp); @@ -90,6 +113,9 @@ private: const std::string& fileName, const std::string& contentText, std::map<std::string, std::vector<std::string>>& includedUis); + std::string MocMacroNamesString() const; + std::string MocHeaderSuffixesString() const; + bool MocParseSourceContent( const std::string& absFilename, const std::string& contentText, std::map<std::string, std::string>& mocsIncluded, @@ -122,18 +148,31 @@ private: // -- Rcc file generation bool RccGenerateAll(); - bool RccGenerateFile(const std::string& qrcInputFile, - const std::string& qrcOutputFile, bool unique_n); + bool RccGenerateFile(const RccJob& rccJob); - // -- Logging - void LogErrorNameCollision( - const std::string& message, - const std::multimap<std::string, std::string>& collisions) const; + // -- Log info void LogBold(const std::string& message) const; - void LogInfo(const std::string& message) const; - void LogWarning(const std::string& message) const; - void LogError(const std::string& message) const; - void LogCommand(const std::vector<std::string>& command) const; + void LogInfo(cmQtAutoGen::GeneratorType genType, + const std::string& message) const; + // -- Log warning + void LogWarning(cmQtAutoGen::GeneratorType genType, + const std::string& message) const; + void LogFileWarning(cmQtAutoGen::GeneratorType genType, + const std::string& filename, + const std::string& message) const; + // -- Log error + void LogError(cmQtAutoGen::GeneratorType genType, + const std::string& message) const; + void LogFileError(cmQtAutoGen::GeneratorType genType, + const std::string& filename, + const std::string& message) const; + void LogCommandError(cmQtAutoGen::GeneratorType genType, + const std::string& message, + const std::vector<std::string>& command, + const std::string& output) const; + void LogNameCollisionError( + cmQtAutoGen::GeneratorType genType, const std::string& message, + const std::multimap<std::string, std::string>& collisions) const; // -- Utility bool NameCollisionTest( @@ -142,14 +181,14 @@ private: std::string ChecksumedPath(const std::string& sourceFile, const std::string& basePrefix, const std::string& baseSuffix) const; - bool MakeParentDirectory(const char* logPrefix, + bool MakeParentDirectory(cmQtAutoGen::GeneratorType genType, const std::string& filename) const; bool FileDiffers(const std::string& filename, const std::string& content); - bool FileWrite(const char* logPrefix, const std::string& filename, - const std::string& content); + bool FileWrite(cmQtAutoGen::GeneratorType genType, + const std::string& filename, const std::string& content); - bool RunCommand(const std::vector<std::string>& command, std::string& output, - bool verbose = true) const; + bool RunCommand(const std::vector<std::string>& command, + std::string& output) const; bool FindHeader(std::string& header, const std::string& testBasePath) const; @@ -169,6 +208,7 @@ private: std::string AutogenIncludeDir; // -- Qt environment std::string QtMajorVersion; + std::string QtMinorVersion; std::string MocExecutable; std::string UicExecutable; std::string RccExecutable; @@ -200,23 +240,21 @@ private: std::vector<std::string> MocDefinitions; std::vector<std::string> MocOptions; std::vector<std::string> MocPredefsCmd; - std::vector<MocDependFilter> MocDependFilters; - std::vector<MocMacroFilter> MocMacroFilters; + std::vector<KeyRegExp> MocDependFilters; + std::vector<KeyRegExp> MocMacroFilters; cmsys::RegularExpression MocRegExpInclude; // -- Uic bool UicSettingsChanged; bool UicRunFailed; std::vector<std::string> UicSkipList; std::vector<std::string> UicTargetOptions; - std::map<std::string, std::string> UicOptions; + std::map<std::string, std::vector<std::string>> UicOptions; std::vector<std::string> UicSearchPaths; cmsys::RegularExpression UicRegExpInclude; // -- Rcc bool RccSettingsChanged; bool RccRunFailed; - std::vector<std::string> RccSources; - std::map<std::string, std::string> RccOptions; - std::map<std::string, std::vector<std::string>> RccInputs; + std::vector<RccJob> RccJobs; }; #endif |