CMake: Add deployment hooks for the generic deploy tool
Add a way to run code after qt_deploy_runtime_dependencies has finished its job. Motivation: To deploy QtWebEngine-specific assets we must call a QtWebEngine-specific deployment function that is defined in the QtWebEngineCore module. Qt modules (and other code) can now register a deployment hook with _qt_internal_add_deployment_hook(my_hook). The function my_hook will be called at the end of _qt_internal_generic_deployqt. The function my_hook will be called with all arguments that were passed to _qt_internal_generic_deployqt plus a list of resolved dependencies. The hook can use this list of dependencies to decide whether to deploy files. Pick-to: 6.5 Task-number: QTBUG-119077 Change-Id: I07ab2f6b3a0ea399b43409b4a0498dbf2f52664f Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 21bf313ce65e248793f36363a510539f6e658771) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 5065fb780f4ef15fe0a2a41fd40359f6ac0287c2)
This commit is contained in:
parent
09609103b4
commit
8a00f0e175
@ -153,6 +153,34 @@ function(_qt_internal_get_rpath_origin out_var)
|
|||||||
set(${out_var} ${rpath_origin} PARENT_SCOPE)
|
set(${out_var} ${rpath_origin} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Add a function to the list of deployment hooks.
|
||||||
|
# The hooks are run at the end of _qt_internal_generic_deployqt.
|
||||||
|
#
|
||||||
|
# Every hook is passed the parameters of _qt_internal_generic_deployqt plus the following:
|
||||||
|
# RESOLVED_DEPENDENCIES: list of resolved dependencies that were installed.
|
||||||
|
function(_qt_internal_add_deployment_hook function_name)
|
||||||
|
set_property(GLOBAL APPEND PROPERTY QT_INTERNAL_DEPLOYMENT_HOOKS "${function_name}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Run all registered deployment hooks.
|
||||||
|
function(_qt_internal_run_deployment_hooks)
|
||||||
|
get_property(hooks GLOBAL PROPERTY QT_INTERNAL_DEPLOYMENT_HOOKS)
|
||||||
|
foreach(hook IN LISTS hooks)
|
||||||
|
if(NOT COMMAND "${hook}")
|
||||||
|
message(AUTHOR_WARNING "'${hook}' is not a command but was added as deployment hook.")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
if(CMAKE_VERSION GREATER_EQUAL "3.19")
|
||||||
|
cmake_language(CALL "${hook}" ${ARGV})
|
||||||
|
else()
|
||||||
|
set(temp_file ".qt-run-deploy-hook.cmake")
|
||||||
|
file(WRITE "${temp_file}" "${hook}(${ARGV})")
|
||||||
|
include(${temp_file})
|
||||||
|
file(REMOVE "${temp_file}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(_qt_internal_generic_deployqt)
|
function(_qt_internal_generic_deployqt)
|
||||||
set(no_value_options
|
set(no_value_options
|
||||||
NO_TRANSLATIONS
|
NO_TRANSLATIONS
|
||||||
@ -273,6 +301,8 @@ function(_qt_internal_generic_deployqt)
|
|||||||
if(NOT arg_NO_TRANSLATIONS)
|
if(NOT arg_NO_TRANSLATIONS)
|
||||||
qt6_deploy_translations()
|
qt6_deploy_translations()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
_qt_internal_run_deployment_hooks(${ARGV} RESOLVED_DEPENDENCIES ${resolved})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(qt6_deploy_runtime_dependencies)
|
function(qt6_deploy_runtime_dependencies)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user