summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-01-27 16:28:47 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2022-02-01 15:06:46 +0100
commitf9e48854af4a25f13f593dd151071c8eda53b65f (patch)
tree3a9d1eabdff6a9d1c88ca20568e7e14c9dfd63ad /src
parent1b672951cadd9da8873793d8787025076293016c (diff)
Use IMPORTED_LOCATION of rcc target
Use IMPORTED_LOCATION of rcc target when generating Android deployment settings, instead of the hardcoded host path. Introduce a helper function to find the location of the imported tool target. Change-Id: Icfa51ee7a01b3f58fc4892da03055f9ed531cc0b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake
index 56faedb121..3313975022 100644
--- a/src/corelib/Qt6AndroidMacros.cmake
+++ b/src/corelib/Qt6AndroidMacros.cmake
@@ -17,6 +17,35 @@ function(_qt_internal_android_get_sdk_build_tools_revision out_var)
set(${out_var} "${android_build_tools_latest}" PARENT_SCOPE)
endfunction()
+# The function appends to the 'out_var' a 'json_property' that contains the 'tool' path. If 'tool'
+# target or its IMPORTED_LOCATION are not found the function displays warning, but is not failing
+# at the project configuring phase.
+function(_qt_internal_add_tool_to_android_deployment_settings out_var tool json_property target)
+ unset(tool_binary_path)
+ __qt_internal_get_tool_imported_location(tool_binary_path ${tool})
+ if("${tool_binary_path}" STREQUAL "")
+ # Fallback search for the tool in host bin and host libexec directories
+ find_program(tool_binary_path
+ NAMES ${tool} ${tool}.exe
+ PATHS
+ "${QT_HOST_PATH}/${QT6_HOST_INFO_BINDIR}"
+ "${QT_HOST_PATH}/${QT6_HOST_INFO_LIBEXECDIR}"
+ NO_DEFAULT_PATH
+ )
+ if(NOT tool_binary_path)
+ message(WARNING "Unable to locate ${tool}. Android package deployment of ${target}"
+ " target can be incomplete. Make sure the host Qt has ${tool} installed.")
+ return()
+ endif()
+ endif()
+
+ file(TO_CMAKE_PATH "${tool_binary_path}" tool_binary_path)
+ string(APPEND ${out_var}
+ " \"${json_property}\" : \"${tool_binary_path}\",\n")
+
+ set(${out_var} "${${out_var}}" PARENT_SCOPE)
+endfunction()
+
# Generate the deployment settings json file for a cmake target.
function(qt6_android_generate_deployment_settings target)
# Information extracted from mkspecs/features/android/android_deployment_settings.prf
@@ -241,13 +270,7 @@ function(qt6_android_generate_deployment_settings target)
" \"qml-importscanner-binary\" : \"${qml_importscanner_binary_path_native}\",\n")
# Override rcc binary path
- set(rcc_binary_path "${QT_HOST_PATH}/${QT6_HOST_INFO_LIBEXECDIR}/rcc")
- if (WIN32)
- string(APPEND rcc_binary_path ".exe")
- endif()
- file(TO_CMAKE_PATH "${rcc_binary_path}" rcc_binary_path_native)
- string(APPEND file_contents
- " \"rcc-binary\" : \"${rcc_binary_path_native}\",\n")
+ _qt_internal_add_tool_to_android_deployment_settings(file_contents rcc "rcc-binary" "${target}")
# Extra prefix paths
foreach(prefix IN LISTS CMAKE_FIND_ROOT_PATH)