Skip to content

Commit

Permalink
Add an option to select the preferred compression type for mime type db
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
semlanik committed Dec 1, 2022
1 parent 8e9818e commit 81931f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmake/configure-cmake-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
16 changes: 15 additions & 1 deletion src/corelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/corelib/qt_cmdline.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 81931f8

Please sign in to comment.