CMake: Add NO_TRANSLATIONS option to deployment functions

Add the NO_TRANSLATIONS option to qt_deploy_runtime_dependencies and
qt_generate_deploy_app_script.  On Windows and Linux, this option
prevents the deployment of Qt translations.

[ChangeLog][CMake] Added the NO_TRANSLATIONS option to
qt_deploy_runtime_dependencies and qt_generate_deploy_app_script.

Change-Id: I9d8435e262e2ff6c7242760ddb189473af850476
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
bb10
Joerg Bornemann 2022-09-06 10:50:12 +02:00
parent 1b5462c2ac
commit 514027f43f
4 changed files with 35 additions and 3 deletions

View File

@ -113,6 +113,7 @@ endfunction()
function(_qt_internal_generic_deployqt)
set(no_value_options
NO_TRANSLATIONS
VERBOSE
)
set(single_value_options
@ -205,6 +206,11 @@ function(_qt_internal_generic_deployqt)
string(PREPEND destination "${QT_DEPLOY_PREFIX}/${arg_PLUGINS_DIR}/")
file(INSTALL ${file_path} DESTINATION ${destination})
endforeach()
# Deploy translations.
if(NOT arg_NO_TRANSLATIONS)
qt6_deploy_translations()
endif()
endfunction()
# This function is currently in Technical Preview.
@ -220,6 +226,7 @@ function(qt6_deploy_runtime_dependencies)
VERBOSE
NO_OVERWRITE
NO_APP_STORE_COMPLIANCE # TODO: Might want a better name
NO_TRANSLATIONS
)
set(single_value_options
EXECUTABLE
@ -318,6 +325,9 @@ function(qt6_deploy_runtime_dependencies)
if(NOT arg_NO_OVERWRITE)
list(APPEND tool_options --force)
endif()
if(arg_NO_TRANSLATIONS)
list(APPEND tool_options --no-translations)
endif()
elseif(__QT_DEPLOY_SYSTEM_NAME STREQUAL Darwin)
set(extra_binaries_option "-executable=")
if(NOT arg_NO_APP_STORE_COMPLIANCE)
@ -343,6 +353,10 @@ function(qt6_deploy_runtime_dependencies)
list(APPEND tool_options ADDITIONAL_${file_type} ${arg_ADDITIONAL_${file_type}})
endforeach()
if(arg_NO_TRANSLATIONS)
list(APPEND tool_options NO_TRANSLATIONS)
endif()
_qt_internal_generic_deployqt(
EXECUTABLE "${arg_EXECUTABLE}"
LIB_DIR "${arg_LIB_DIR}"

View File

@ -2671,6 +2671,7 @@ function(qt6_generate_deploy_app_script)
# package). We would add an EXECUTABLE keyword for that, which would be
# mutually exclusive with the TARGET keyword.
set(no_value_options
NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR
)
set(single_value_options
@ -2702,6 +2703,11 @@ function(qt6_generate_deploy_app_script)
FILENAME_VARIABLE file_name
)
set(common_deploy_args "")
if(arg_NO_TRANSLATIONS)
string(APPEND common_deploy_args " NO_TRANSLATIONS\n")
endif()
if(APPLE AND NOT IOS AND QT6_IS_SHARED_LIBS_BUILD)
# TODO: Handle non-bundle applications if possible.
get_target_property(is_bundle ${arg_TARGET} MACOSX_BUNDLE)
@ -2715,7 +2721,7 @@ function(qt6_generate_deploy_app_script)
CONTENT "
qt6_deploy_runtime_dependencies(
EXECUTABLE $<TARGET_FILE_NAME:${arg_TARGET}>.app
)
${common_deploy_args})
")
elseif(WIN32 AND QT6_IS_SHARED_LIBS_BUILD)
@ -2724,7 +2730,7 @@ qt6_deploy_runtime_dependencies(
qt6_deploy_runtime_dependencies(
EXECUTABLE $<TARGET_FILE:${arg_TARGET}>
GENERATE_QT_CONF
)
${common_deploy_args})
")
elseif(UNIX AND NOT APPLE AND NOT ANDROID AND QT6_IS_SHARED_LIBS_BUILD)
@ -2733,7 +2739,7 @@ qt6_deploy_runtime_dependencies(
qt6_deploy_runtime_dependencies(
EXECUTABLE $<TARGET_FILE:${arg_TARGET}>
GENERATE_QT_CONF
)
${common_deploy_args})
")
elseif(NOT arg_NO_UNSUPPORTED_PLATFORM_ERROR AND NOT QT_INTERNAL_NO_UNSUPPORTED_PLATFORM_ERROR)

View File

@ -38,6 +38,7 @@ qt_deploy_runtime_dependencies(
[VERBOSE]
[NO_OVERWRITE]
[NO_APP_STORE_COMPLIANCE]
[NO_TRANSLATIONS]
)
\endcode
@ -113,6 +114,11 @@ By default, if \c{executable} is a macOS app bundle, only Qt plugins and Qt
libraries that comply with Apple's app store requirements are deployed. The
\c{NO_APP_STORE_COMPLIANCE} option can be given to disable that constraint.
On platforms other than macOS, Qt translations are automatically deployed. To
inhibit this behavior, specify \c{NO_TRANSLATIONS}. Use
\l{qt6_deploy_translations}{qt_deploy_translations} to deploy translations in a
customized way.
\sa {qt6_generate_deploy_app_script}{qt_generate_deploy_app_script()},
qt_deploy_qt_conf(), qt_deploy_qml_imports()

View File

@ -22,6 +22,7 @@
qt_generate_deploy_app_script(
TARGET target
FILENAME_VARIABLE var_name
[NO_TRANSLATIONS]
[NO_UNSUPPORTED_PLATFORM_ERROR]
)
\endcode
@ -59,6 +60,11 @@ scenarios, are not currently supported.
Calling \c{qt_generate_deploy_app_script()} in such a case will result
in a fatal error, unless the \c{NO_UNSUPPORTED_PLATFORM_ERROR} option is given.
On platforms other than macOS, Qt translations are automatically deployed. To
inhibit this behavior, specify \c{NO_TRANSLATIONS}. Use
\l{qt6_deploy_translations}{qt_deploy_translations} to deploy translations in a
customized way.
For deploying a QML application, use
\l{qt6_generate_deploy_qml_app_script}{qt_generate_deploy_qml_app_script()}
instead.