From e28dc3b1d8863bc39e9f7545beb50a2f35fd2647 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 14 Jun 2018 16:14:57 +0200 Subject: Autogen: Add CMAKE_AUTOGEN_VERBOSE variable support Setting CMAKE_AUTOGEN_VERBOSE enables verbose output during AUTOMOC, AUTOUIC and AUTORCC generation. --- Source/cmQtAutoGenInitializer.cxx | 16 +++++++++++++++- Source/cmQtAutoGenInitializer.h | 1 + Source/cmQtAutoGenerator.cxx | 22 +++++++++++++++++++--- Source/cmQtAutoGenerator.h | 11 +++++++---- Source/cmQtAutoGeneratorMocUic.cxx | 1 + Source/cmQtAutoGeneratorRcc.cxx | 1 + 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 34196d9..37155fa 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -210,6 +210,19 @@ void cmQtAutoGenInitializer::InitCustomTargets() cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); + // Verbosity + { + this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE"); + if (!this->Verbosity.empty()) { + unsigned long iVerb = 0; + if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) { + // Non numeric verbosity + this->Verbosity = + cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0"; + } + } + } + // Configurations this->MultiConfig = globalGen->IsMultiConfig(); this->ConfigDefault = makefile->GetConfigurations(this->ConfigsList); @@ -944,6 +957,7 @@ void cmQtAutoGenInitializer::SetupCustomTargets() ofs << "# Meta\n"; CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); CWrite("AM_PARALLEL", this->Parallel); + CWrite("AM_VERBOSITY", this->Verbosity); ofs << "# Directories\n"; CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR")); @@ -1036,7 +1050,7 @@ void cmQtAutoGenInitializer::SetupCustomTargets() // Write ofs << "# Configurations\n"; CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); - + CWrite("ARCC_VERBOSITY", this->Verbosity); ofs << "# Settings file\n"; if (this->MultiConfig) { std::map settingsFiles; diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 5fbf0cb..813c680 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -83,6 +83,7 @@ private: std::string ConfigDefault; std::vector ConfigsList; std::string Parallel; + std::string Verbosity; // Names std::string AutogenTargetName; std::string AutogenFolder; diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 7aa792f..64ce0e3 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -17,9 +17,14 @@ // -- Class methods -void cmQtAutoGenerator::Logger::SetVerbose(bool value) +void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value) { - Verbose_ = value; + unsigned long verbosity = 0; + if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) { + if (this->Verbosity_ < verbosity) { + this->Verbosity_ = static_cast(verbosity); + } + } } void cmQtAutoGenerator::Logger::SetColorOutput(bool value) @@ -632,7 +637,18 @@ cmQtAutoGenerator::cmQtAutoGenerator() : FileSys_(&Logger_) { // Initialize logger - Logger_.SetVerbose(cmSystemTools::HasEnv("VERBOSE")); + { + 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(iVerbose)); + } else { + // Non numeric verbosity + Logger_.SetVerbose(cmSystemTools::IsOn(verbose.c_str())); + } + } + } { std::string colorEnv; cmSystemTools::GetEnv("COLOR", colorEnv); diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 4e38413..75143f5 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -33,8 +33,11 @@ public: { public: // -- Verbosity - bool Verbose() const { return this->Verbose_; } - void SetVerbose(bool value); + 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; } bool ColorOutput() const { return this->ColorOutput_; } void SetColorOutput(bool value); // -- Log info @@ -56,8 +59,8 @@ public: private: std::mutex Mutex_; - bool volatile Verbose_ = false; - bool volatile ColorOutput_ = false; + unsigned int Verbosity_ = 0; + bool ColorOutput_ = false; }; /// @brief Thread safe file system interface diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index f196b97..a6b0247 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1222,6 +1222,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) } // -- Meta + Log().RaiseVerbosity(InfoGet("AM_VERBOSITY")); Base_.MultiConfig = InfoGetBool("AM_MULTI_CONFIG"); { unsigned long num = Base_.NumThreads; diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 3064895..e49599f 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -70,6 +70,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) } // - Configurations + Log().RaiseVerbosity(InfoGet("ARCC_VERBOSITY")); MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG"); // - Directories -- cgit v0.12 From aa7d8a092caa32c0003071eed46fe0bf6539bed5 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 19 Jun 2018 19:18:48 +0200 Subject: Autogen: Enable CMAKE_AUTOGEN_VERBOSE in all tests --- Tests/QtAutogen/RerunMocBasic/CMakeLists.txt | 1 + Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt | 1 + Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt | 1 + Tests/QtAutogen/RerunRccDepends/CMakeLists.txt | 1 + Tests/QtAutogen/TestMacros.cmake | 1 + 5 files changed, 5 insertions(+) diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt index 0bb0339..6fad80c 100644 --- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt @@ -16,6 +16,7 @@ try_compile(MOC_RERUN "${mocBasicSrcDir}" MocBasic CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt index 8a89b38..b5287c1 100644 --- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt @@ -19,6 +19,7 @@ try_compile(MOC_PLUGIN "${mocPlugSrcDir}" MocPlugin CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt index f09865d..4dc24fe 100644 --- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt @@ -19,6 +19,7 @@ try_compile(RCC_DEPENDS "${rccDepSD}" RccConfigChange CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt index 52e2488..4268de2 100644 --- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -21,6 +21,7 @@ try_compile(RCC_DEPENDS "${rccDepSD}" RccDepends CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake index bc7c7e2..8e4bea2 100644 --- a/Tests/QtAutogen/TestMacros.cmake +++ b/Tests/QtAutogen/TestMacros.cmake @@ -4,6 +4,7 @@ if(NOT _isMultiConfig) # Set in Tests/CMakeLists.txt list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$") endif() list(APPEND Autogen_BUILD_OPTIONS + "-DCMAKE_AUTOGEN_VERBOSE=1" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" ) -- cgit v0.12 From 6651aab2aba71e273c05ff5d75bd718a4a690e67 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 19 Jun 2018 18:18:23 +0200 Subject: Autogen: Add documentation for CMAKE_AUTOGEN_VERBOSE --- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_AUTOGEN_VERBOSE.rst | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 Help/variable/CMAKE_AUTOGEN_VERBOSE.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index fde1aab..451bd23 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -290,6 +290,7 @@ Variables that Control the Build /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_AUTOGEN_PARALLEL + /variable/CMAKE_AUTOGEN_VERBOSE /variable/CMAKE_AUTOMOC /variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES /variable/CMAKE_AUTOMOC_DEPEND_FILTERS diff --git a/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst b/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst new file mode 100644 index 0000000..bad9cf2 --- /dev/null +++ b/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst @@ -0,0 +1,13 @@ +CMAKE_AUTOGEN_VERBOSE +--------------------- + +Sets the verbosity of :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and +:prop_tgt:`AUTORCC`. A positive integer value or a true boolean value +lets the ``AUTO*`` generators output additional processing information. + +Setting :variable:`CMAKE_AUTOGEN_VERBOSE` has the same effect +as setting the ``VERBOSE`` environment variable during +generation (e.g. by calling ``make VERBOSE=1``). +The extra verbosity is limited to the ``AUTO*`` generators though. + +By default :variable:`CMAKE_AUTOGEN_VERBOSE` is unset. -- cgit v0.12 From 5b85ef5cd05741ccf7240f095f633802cc834ebe Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 19 Jun 2018 18:38:06 +0200 Subject: Autogen: Add release notes for CMAKE_AUTOGEN_VERBOSE --- Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst diff --git a/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst b/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst new file mode 100644 index 0000000..da559cc --- /dev/null +++ b/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst @@ -0,0 +1,6 @@ +CMAKE_AUTOGEN_VERBOSE +--------------------- + +* The new variable :variable:`CMAKE_AUTOGEN_VERBOSE` allows + to increase the verbosity of :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and + :prop_tgt:`AUTORCC` from within CMakeLists.txt. -- cgit v0.12