diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-11-04 16:08:34 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-11-05 14:52:26 +0100 |
commit | 067a23f2c6f93784ffd699eedd476c82d83c430e (patch) | |
tree | 05067c0f782754e8cff003b9a40da7ee1ac1945b /src/corelib/Qt6AndroidMacros.cmake | |
parent | 2c070b6f4d24c56a37d5de71e40d435030254be9 (diff) |
Make sure that all plugin targets are built before deploying to Android
We need to make sure that all plugin targets are built and present
on the file system before running androiddeployqt. This especially
important when building executables that depend on qml modules that are
built in the project tree. This adds meta target that collects all
the plugin targets as dependencies and adds this meta target as the
dependency for the custom target that executes androiddeployqt.
TODO: We should also take into account MODULE libraries that were
added using the CMake add_library call, but since qt6_finalize_project
is not a part of 6.2 API, this will be added in follow up commit.
Pick-to: 6.2
Task-number: QTBUG-94714
Task-number: QTBUG-88841
Change-Id: I4b4596eb8ed364dbe80e2cfb0ce31cec32e7c03f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt6AndroidMacros.cmake')
-rw-r--r-- | src/corelib/Qt6AndroidMacros.cmake | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index eb8552e641..2baa764027 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -339,8 +339,18 @@ function(qt6_android_add_apk_target target) # in case DEPFILEs are not supported. # Also the target is used to copy the library that belongs to ${target} when building multi-abi # apk to the abi-specific directory. + + set(extra_deps "") + + # Plugins still might be added after creating the deployment targets. + if(NOT TARGET qt_internal_plugins) + add_custom_target(qt_internal_plugins) + endif() + # Before running androiddeployqt, we need to make sure all plugins are built. + list(APPEND extra_deps qt_internal_plugins) + add_custom_target(${target}_prepare_apk_dir ALL - DEPENDS ${target} + DEPENDS ${target} ${extra_deps} COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${target}> "${copy_target_path}/$<TARGET_FILE_NAME:${target}>" @@ -372,7 +382,7 @@ function(qt6_android_add_apk_target target) --builddir "${CMAKE_BINARY_DIR}" ${extra_args} COMMENT "Creating APK for ${target}" - DEPENDS "${target}" "${deployment_file}" + DEPENDS "${target}" "${deployment_file}" ${extra_deps} DEPFILE "${dep_intermediate_file_path}") # Create a ${target}_make_apk target to copy the apk from the intermediate to its final |