diff options
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 |