From 9fa13b2c5f43d6fbaeb4360ac54391a91b3e9e54 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 28 Nov 2018 17:05:08 +0100 Subject: Make quiet builds really quiet The change does a couple of things: - Sets the distutils / setuptools --verbose option to 0 - Sets the distutils / setuptools --quiet option to 1 - The options above end up calling distutils.log.set_verbosity(0) - Passes the QUIET_BUILD cmake option from setup.py to every CMake invocation, when --quiet is passed to setup.py - Sets the CMAKE_INSTALL_MESSAGE variable to silence messages regarding installation of files - Sets the CMAKE_RULE_MESSAGES variable to disable progress report in makefiles when building each source file - Overrides the CMake message function, not to display STATUS / info / untyped messages (still displays warnings and errors) - Changes the build / install elapsed time messages to always be printed even in quiet mode - Reverts the previously introduced set_quiet function in utils, because log.set_verbosity() now takes care of silencing those messages As a result, there's a lot less clutter when doing a quiet build. Warnings, errors and shiboken output is still displayed. Change-Id: Ie05c593ce7dc0aa04554c2d2859ce655233ddb9f Reviewed-by: Christian Tismer Reviewed-by: Qt CI Bot Reviewed-by: Friedemann Kleint --- sources/pyside2/CMakeLists.txt | 52 +++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 13 deletions(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 25598bb5e..1d563fb44 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -15,6 +15,25 @@ include(helpers) option(USE_PYTHON_VERSION "Use specific python version to build pyside2." "") +# Don't display "up-to-date / install" messages when installing, to reduce visual clutter. +if (QUIET_BUILD) + set(CMAKE_INSTALL_MESSAGE NEVER) +endif() + +# Override message not to display info messages when doing a quiet build. +if (QUIET_BUILD) + function(message) + list(GET ARGV 0 MessageType) + if (MessageType STREQUAL FATAL_ERROR OR + MessageType STREQUAL SEND_ERROR OR + MessageType STREQUAL WARNING OR + MessageType STREQUAL AUTHOR_WARNING) + list(REMOVE_AT ARGV 0) + _message(${MessageType} "${ARGV}") + endif() + endfunction() +endif() + if (USE_PYTHON_VERSION) find_package(PythonInterp ${USE_PYTHON_VERSION} REQUIRED) find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED) @@ -252,7 +271,26 @@ include(PySideModules) macro(COLLECT_MODULE_IF_FOUND shortname) set(name "Qt5${shortname}") - find_package(${name}) + + # Determine essential/optional/missing + set(module_state "missing") + list(FIND ALL_ESSENTIAL_MODULES "${shortname}" essentialIndex) + if(${essentialIndex} EQUAL -1) + list(FIND ALL_OPTIONAL_MODULES "${shortname}" optionalIndex) + if(NOT ${optionalIndex} EQUAL -1) + set(module_state "optional") + endif() + else() + set(module_state "essential") + endif() + + # Silence warnings when optional packages are not found when doing a quiet build. + set(quiet_argument "") + if (QUIET_BUILD AND "${module_state}" STREQUAL "optional") + set(quiet_argument "QUIET") + endif() + + find_package(${name} ${quiet_argument}) # If package is found, _name_found will be equal to 1 set(_name_found "${name}_FOUND") # _name_dir will keep the path to the directory where the CMake rules were found @@ -276,18 +314,6 @@ macro(COLLECT_MODULE_IF_FOUND shortname) get_filename_component(_module_dir "${${_name_dir}}" ABSOLUTE) string(FIND "${_module_dir}" "${_core_abs_dir}" found_basepath) - # Determine essential/optional/missing - set(module_state "missing") - list(FIND ALL_ESSENTIAL_MODULES "${shortname}" essentialIndex) - if(${essentialIndex} EQUAL -1) - list(FIND ALL_OPTIONAL_MODULES "${shortname}" optionalIndex) - if(NOT ${optionalIndex} EQUAL -1) - set(module_state "optional") - endif() - else() - set(module_state "essential") - endif() - # If the module was found, and also the module path is the same as the # Qt5Core base path, we will generate the list with the modules to be installed set(looked_in_message ". Looked in: ${${_name_dir}}") -- cgit v1.2.3