summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-11-14 12:16:28 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2022-12-01 02:23:51 +0100
commit81931f8c54dfec572fe3cc895e51e8979975aaa3 (patch)
tree5cc9b11d958b98656e757c29baca8421640423a5
parent8e9818e6294310c33810d5a1c6b03ffbfbc07245 (diff)
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 <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--cmake/configure-cmake-mapping.md2
-rw-r--r--src/corelib/CMakeLists.txt16
-rw-r--r--src/corelib/qt_cmdline.cmake1
3 files changed, 18 insertions, 1 deletions
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-<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> | |
+| -mimetype-database-compression <type> | -DINPUT_mimetype_database_compression=<type> | 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)