diff options
author | Ivan Solovev <[email protected]> | 2022-08-16 13:02:27 +0200 |
---|---|---|
committer | Ivan Solovev <[email protected]> | 2022-08-19 23:52:05 +0200 |
commit | 2625a3a01ae56cfbfb097e40334d159ee262a6f6 (patch) | |
tree | 885fe1d240f6a9a9a6665a1e42570c6f6fbbe76a | |
parent | 18f0484a0ed9785efe5acb4671695772e5715075 (diff) |
Add -disable-deprecated-up-to parameter to configure script
And also teach CMake to treat it properly instead of hardcoding the
version number.
[ChangeLog][Build System] The configure script now accepts a new
parameter -disable-deprecated-up-to which is used to remove all
deprecated code from API and ABI while building the libraries.
The version number must be specified in a hex format.
For example, it can be used like this:
/path/to/qt/configure -disable-deprecated-up-to 0x060500
to remove all code deprecated in Qt 6.5.0 or earlier releases.
Task-number: QTBUG-101510
Change-Id: I557cf83e29b867fa1052bb097985e144b5eaf34d
Reviewed-by: Edward Welbourne <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
-rw-r--r-- | cmake/QtFlagHandlingHelpers.cmake | 16 | ||||
-rw-r--r-- | cmake/QtPostProcessHelpers.cmake | 5 | ||||
-rw-r--r-- | cmake/QtProcessConfigureArgs.cmake | 10 | ||||
-rw-r--r-- | cmake/configure-cmake-mapping.md | 1 | ||||
-rw-r--r-- | config_help.txt | 10 |
5 files changed, 36 insertions, 6 deletions
diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake index fe9e0e072ae..708496fb85f 100644 --- a/cmake/QtFlagHandlingHelpers.cmake +++ b/cmake/QtFlagHandlingHelpers.cmake @@ -183,13 +183,17 @@ function(qt_internal_library_deprecation_level result) # QT_DISABLE_DEPRECATED_UP_TO controls which version we use as a cut-off # compiling in to the library. E.g. if it is set to QT_VERSION then no # code which was deprecated before QT_VERSION will be compiled in. - if(WIN32) - # On Windows, due to the way DLLs work, we need to export all functions, - # including the inlines - list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=0x040800") + if (NOT DEFINED QT_DISABLE_DEPRECATED_UP_TO) + if(WIN32) + # On Windows, due to the way DLLs work, we need to export all functions, + # including the inlines + list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=0x040800") + else() + # On other platforms, Qt's own compilation does need to compile the Qt 5.0 API + list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=0x050000") + endif() else() - # On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API - list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=0x050000") + list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=${QT_DISABLE_DEPRECATED_UP_TO}") endif() # QT_WARN_DEPRECATED_UP_TO controls the upper-bound of deprecation # warnings that are emitted. E.g. if it is set to 0x060500 then all use of diff --git a/cmake/QtPostProcessHelpers.cmake b/cmake/QtPostProcessHelpers.cmake index ddaa2915f44..d334741ecd9 100644 --- a/cmake/QtPostProcessHelpers.cmake +++ b/cmake/QtPostProcessHelpers.cmake @@ -685,6 +685,11 @@ endif()\n") string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "set(QT_EXTRA_RPATHS \"${QT_EXTRA_RPATHS}\" CACHE STRING \"\")\n") endif() + if(DEFINED QT_DISABLE_DEPRECATED_UP_TO) + string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS + "set(QT_DISABLE_DEPRECATED_UP_TO \"${QT_DISABLE_DEPRECATED_UP_TO}\"" + " CACHE STRING \"\")\n") + endif() # Save pkg-config feature value to be able to query it internally as soon as BuildInternals # package is loaded. This is to avoid any pkg-config package from being found when diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index b58504919a6..0830bd89779 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -43,6 +43,12 @@ function(warn_in_per_repo_build arg) endif() endfunction() +function(is_valid_qt_hex_version arg version) + if(NOT version MATCHES "^0x[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$") + message(FATAL_ERROR "Incorrect version ${version} specified for ${arg}") + endif() +endfunction() + if("${MODULE_ROOT}" STREQUAL "") # If MODULE_ROOT is not set, assume that we want to build qtbase or top-level. get_filename_component(MODULE_ROOT ".." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") @@ -125,6 +131,10 @@ while(NOT "${configure_args}" STREQUAL "") set(cmake_file_api FALSE) elseif(arg STREQUAL "-verbose") list(APPEND cmake_args "--log-level=STATUS") + elseif(arg STREQUAL "-disable-deprecated-up-to") + list(POP_FRONT configure_args version) + is_valid_qt_hex_version("${arg}" "${version}") + push("-DQT_DISABLE_DEPRECATED_UP_TO=${version}") elseif(arg STREQUAL "--") # Everything after this argument will be passed to CMake verbatim. list(APPEND cmake_args "${configure_args}") diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md index 1282c0d4844..ade65ed5ded 100644 --- a/cmake/configure-cmake-mapping.md +++ b/cmake/configure-cmake-mapping.md @@ -169,3 +169,4 @@ The following table describes the mapping of configure options to CMake argument | -libjpeg | -DFEATURE_libjpeg=ON | | | -sql-<driver> | -DFEATURE_sql_<driver>=ON | | | -sqlite [qt/system] | -DFEATURE_system_sqlite=OFF/ON | | +| -disable-deprecated-up-to <hex_version> | -DQT_DISABLE_DEPRECATED_UP_TO=<hex_version> | | diff --git a/config_help.txt b/config_help.txt index bd229c43a4d..a02d60e5ce4 100644 --- a/config_help.txt +++ b/config_help.txt @@ -141,6 +141,16 @@ Build options: -warnings-are-errors . Treat warnings as errors [no; yes if -developer-build] + -disable-deprecated-up-to <version> + Set the QT_DISABLE_DEPRECATED_UP_TO value to <version>. + QT_DISABLE_DEPRECATED_UP_TO is used to remove + deprecated methods from both API and ABI. + <version> is a hex value, for example 0x060500 can be + used to remove all code deprecated in Qt 6.5.0 or + earlier releases. + By default <version> is set to 0x040000 and 0x050000 on + Windows, and non-Windows respectively. + Build environment: -sysroot <dir> ....... Set <dir> as the target sysroot |