summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-11-04 16:08:34 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2021-11-08 10:09:23 +0100
commit9738ef61c4e91523ba2dc41947cdf88269b1bc38 (patch)
tree353aed8784a6581aa7aced4c85b79919ee8d98ba /src
parentbd50ab137d7dd0bc8e45ab4cca150ce763dfa3e8 (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. Task-number: QTBUG-94714 Task-number: QTBUG-88841 Change-Id: I4b4596eb8ed364dbe80e2cfb0ce31cec32e7c03f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 067a23f2c6f93784ffd699eedd476c82d83c430e)
Diffstat (limited to 'src')
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake13
-rw-r--r--src/corelib/Qt6CoreMacros.cmake7
2 files changed, 18 insertions, 2 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake
index 00e7eabe5d..6f3cf66a26 100644
--- a/src/corelib/Qt6AndroidMacros.cmake
+++ b/src/corelib/Qt6AndroidMacros.cmake
@@ -322,10 +322,19 @@ function(qt6_android_add_apk_target target)
set(apk_intermediate_file_path "${apk_intermediate_dir}/${apk_file_name}")
set(dep_intermediate_file_path "${apk_intermediate_dir}/${dep_file_name}")
+ 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)
+
# This target is used by Qt Creator's Android support and by the ${target}_make_apk target
# in case DEPFILEs are not supported.
add_custom_target(${target}_prepare_apk_dir ALL
- DEPENDS ${target}
+ DEPENDS ${target} ${extra_deps}
COMMAND ${CMAKE_COMMAND}
-E copy_if_different $<TARGET_FILE:${target}>
"${apk_final_dir}/libs/${CMAKE_ANDROID_ARCH_ABI}/$<TARGET_FILE_NAME:${target}>"
@@ -349,7 +358,7 @@ function(qt6_android_add_apk_target target)
--depfile "${dep_intermediate_file_path}"
--builddir "${CMAKE_BINARY_DIR}"
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
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 76eaf4e6bc..a30e7ec9fb 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -2054,6 +2054,13 @@ function(qt6_add_plugin target)
QT_PLUGIN
QT_DEPRECATED_WARNINGS
)
+
+ if(target_type STREQUAL "MODULE_LIBRARY")
+ if(NOT TARGET qt_internal_plugins)
+ add_custom_target(qt_internal_plugins)
+ endif()
+ add_dependencies(qt_internal_plugins ${target})
+ endif()
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)