diff options
-rw-r--r-- | Source/cmQtAutoGenerator.cxx | 52 | ||||
-rw-r--r-- | Source/cmQtAutoGenerator.h | 12 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorMocUic.cxx | 3 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorMocUic.h | 6 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorRcc.h | 11 |
5 files changed, 47 insertions, 37 deletions
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index f56f7c9..c1e6aab 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -20,6 +20,34 @@ // -- Class methods +cmQtAutoGenerator::Logger::Logger() +{ + // Initialize logger + { + std::string verbose; + if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { + unsigned long iVerbose = 0; + if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { + SetVerbosity(static_cast<unsigned int>(iVerbose)); + } else { + // Non numeric verbosity + SetVerbose(cmSystemTools::IsOn(verbose)); + } + } + } + { + std::string colorEnv; + cmSystemTools::GetEnv("COLOR", colorEnv); + if (!colorEnv.empty()) { + SetColorOutput(cmSystemTools::IsOn(colorEnv)); + } else { + SetColorOutput(true); + } + } +} + +cmQtAutoGenerator::Logger::~Logger() = default; + void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value) { unsigned long verbosity = 0; @@ -670,31 +698,7 @@ void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish() } cmQtAutoGenerator::cmQtAutoGenerator() - : FileSys_(&Logger_) { - // Initialize logger - { - std::string verbose; - if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { - unsigned long iVerbose = 0; - if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { - Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose)); - } else { - // Non numeric verbosity - Logger_.SetVerbose(cmSystemTools::IsOn(verbose)); - } - } - } - { - std::string colorEnv; - cmSystemTools::GetEnv("COLOR", colorEnv); - if (!colorEnv.empty()) { - Logger_.SetColorOutput(cmSystemTools::IsOn(colorEnv)); - } else { - Logger_.SetColorOutput(true); - } - } - // Initialize libuv loop uv_disable_stdio_inheritance(); #ifdef CMAKE_UV_SIGNAL_HACK diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 17170d7..2993946 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -31,12 +31,16 @@ public: class Logger { public: + // -- Construction + Logger(); + ~Logger(); // -- Verbosity unsigned int Verbosity() const { return this->Verbosity_; } void SetVerbosity(unsigned int value) { this->Verbosity_ = value; } void RaiseVerbosity(std::string const& value); bool Verbose() const { return (this->Verbosity_ != 0); } void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; } + // -- Color output bool ColorOutput() const { return this->ColorOutput_; } void SetColorOutput(bool value); // -- Log info @@ -258,11 +262,6 @@ public: // -- Run bool Run(std::string const& infoFile, std::string const& config); - // -- Accessors - // Logging - Logger& Log() { return Logger_; } - // File System - FileSystem& FileSys() { return FileSys_; } // InfoFile std::string const& InfoFile() const { return InfoFile_; } std::string const& InfoDir() const { return InfoDir_; } @@ -280,9 +279,6 @@ protected: virtual bool Process() = 0; private: - // -- Logging - Logger Logger_; - FileSystem FileSys_; // -- Info settings std::string InfoFile_; std::string InfoDir_; diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 0982473..607576f 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1126,7 +1126,8 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished() } cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() - : Base_(&FileSys()) + : FileSys_(&Logger_) + , Base_(&FileSys()) , Moc_(&FileSys()) { // Precompile regular expressions diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index e48d7f3..cc785a7 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -387,6 +387,9 @@ public: void ParallelMocAutoUpdated(); private: + // -- Utility accessors + Logger& Log() { return Logger_; } + FileSystem& FileSys() { return FileSys_; } // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; @@ -407,6 +410,9 @@ private: void MocGenerateCompilation(); private: + // -- Utility + Logger Logger_; + FileSystem FileSys_; // -- Settings BaseSettingsT Base_; MocSettingsT Moc_; diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h index d831f1f..ff7a02a 100644 --- a/Source/cmQtAutoGeneratorRcc.h +++ b/Source/cmQtAutoGeneratorRcc.h @@ -25,6 +25,11 @@ public: cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete; private: + // -- Utility + Logger& Log() { return Logger_; } + bool IsMultiConfig() const { return MultiConfig_; } + std::string MultiConfigOutput() const; + // -- Abstract processing interface bool Init(cmMakefile* makefile) override; bool Process() override; @@ -39,11 +44,9 @@ private: bool GenerateRcc(); bool GenerateWrapper(); - // -- Utility - bool IsMultiConfig() const { return MultiConfig_; } - std::string MultiConfigOutput() const; - private: + // -- Logging + Logger Logger_; // -- Config settings bool MultiConfig_ = false; // -- Directories |