From 81931f8c54dfec572fe3cc895e51e8979975aaa3 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 14 Nov 2022 12:16:28 +0100 Subject: Add an option to select the preferred compression type for mime type db Add the '-mimetype-database-compression' command line argument that allows to select the preferred compression type for the mime type database, including 'none' compression type, which avoids mime type database compression even if respective compression APIs are present in the system. The argument has the CMake alias called 'INPUT_mimetype_database_compression'. Change-Id: I66daddae7014d109fa175a5f397e984928f4ee47 Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor Reviewed-by: Thiago Macieira --- cmake/configure-cmake-mapping.md | 2 ++ src/corelib/CMakeLists.txt | 16 +++++++++++++++- src/corelib/qt_cmdline.cmake | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md index ade65ed5de..d4a9ede75f 100644 --- a/cmake/configure-cmake-mapping.md +++ b/cmake/configure-cmake-mapping.md @@ -170,3 +170,5 @@ The following table describes the mapping of configure options to CMake argument | -sql- | -DFEATURE_sql_=ON | | | -sqlite [qt/system] | -DFEATURE_system_sqlite=OFF/ON | | | -disable-deprecated-up-to | -DQT_DISABLE_DEPRECATED_UP_TO= | | +| -mimetype-database-compression | -DINPUT_mimetype_database_compression= | Sets the compression type for mime type database. Supported | +| | | types: gzip, zstd, none. | diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 61e960dcf2..7bb3782313 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -1250,7 +1250,21 @@ if(QT_FEATURE_mimetype AND QT_FEATURE_mimetype_database) endif() endif() - if(QT_FEATURE_zstd) + if(DEFINED INPUT_mimetype_database_compression) + set(supported_compression_types zstd gzip none) + if(INPUT_mimetype_database_compression IN_LIST supported_compression_types) + set(compression_type ${INPUT_mimetype_database_compression}) + else() + message(FATAL_ERROR "Unknown mime type database compression is set:" + " ${INPUT_mimetype_database_compression}\nSupported compression types:\n" + " ${supported_compression_types}") + endif() + if(compression_type STREQUAL "zstd" AND NOT QT_FEATURE_zstd) + message(FATAL_ERROR + "zstd compression is selected for mime type database, but the 'zstd'" + " feature is disabled.") + endif() + elseif(QT_FEATURE_zstd) set(compression_type "zstd") else() set(compression_type "gzip") diff --git a/src/corelib/qt_cmdline.cmake b/src/corelib/qt_cmdline.cmake index dcf9ce946e..c82d77a60d 100644 --- a/src/corelib/qt_cmdline.cmake +++ b/src/corelib/qt_cmdline.cmake @@ -9,6 +9,7 @@ qt_commandline_option(inotify TYPE boolean) qt_commandline_option(journald TYPE boolean) qt_commandline_option(libb2 TYPE enum VALUES no qt system) qt_commandline_option(mimetype-database TYPE boolean) +qt_commandline_option(mimetype-database-compression TYPE optionalString VALUES zstd gzip none) qt_commandline_option(pcre TYPE enum VALUES no qt system) qt_commandline_option(posix-ipc TYPE boolean NAME ipc_posix) qt_commandline_option(pps TYPE boolean NAME qqnx_pps) -- cgit v1.2.3