From 2135cbdfa6da743f32f3d03b0661313caecc7b16 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sat, 24 Oct 2020 17:04:22 +0200 Subject: Make androiddeployqt find libraries and QML plugins without installation This matters for libraries in the same repository as the application that also have an AAR that needs to be integrated, as well as QML plugins. For this to work we need to consider the build directory as a search prefix, and produce the exact directory layout there that androiddeployqt expects. For libraries this is then almost transparent for the application build system, the only thing that needs to be taken care of manually is putting the corresponding -android-dependencies.xml file into the right place in the build dir as well. A macro wrapping that might be an option to centralize that logic here as well in the future. For QML plugins this is transparent if you have them set up to work without installation already anyway, otherwise that setup has to be done for this to work. Example: https://invent.kde.org/pim/itinerary/-/merge_requests/28 https://invent.kde.org/frameworks/knotifications/-/merge_requests/12 would presumably also need this (not tested yet). --- toolchain/ECMAndroidDeployQt.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'toolchain/ECMAndroidDeployQt.cmake') diff --git a/toolchain/ECMAndroidDeployQt.cmake b/toolchain/ECMAndroidDeployQt.cmake index 06943390..74f4c550 100644 --- a/toolchain/ECMAndroidDeployQt.cmake +++ b/toolchain/ECMAndroidDeployQt.cmake @@ -9,6 +9,10 @@ function(ecm_androiddeployqt QTANDROID_EXPORTED_TARGET ECM_ADDITIONAL_FIND_ROOT_ set(EXECUTABLE_DESTINATION_PATH "${EXPORT_DIR}/libs/${CMAKE_ANDROID_ARCH_ABI}/lib${QTANDROID_EXPORTED_TARGET}_${CMAKE_ANDROID_ARCH_ABI}.so") endif() set(QML_IMPORT_PATHS "") + # add build directory to the search path as well, so this works without installation + if (EXISTS ${CMAKE_BINARY_DIR}/lib) + set(QML_IMPORT_PATHS ${CMAKE_BINARY_DIR}/lib) + endif() foreach(prefix ${ECM_ADDITIONAL_FIND_ROOT_PATH}) # qmlimportscanner chokes on symlinks, so we need to resolve those first get_filename_component(qml_path "${prefix}/lib/qml" REALPATH) @@ -24,13 +28,9 @@ function(ecm_androiddeployqt QTANDROID_EXPORTED_TARGET ECM_ADDITIONAL_FIND_ROOT_ set(DEFINE_QML_IMPORT_PATHS "\"qml-import-paths\": \"${QML_IMPORT_PATHS}\",") endif() - set(EXTRA_PREFIX_DIRS "") + set(EXTRA_PREFIX_DIRS "\"${CMAKE_BINARY_DIR}\"") foreach(prefix ${ECM_ADDITIONAL_FIND_ROOT_PATH}) - if (EXTRA_PREFIX_DIRS) - set(EXTRA_PREFIX_DIRS "${EXTRA_PREFIX_DIRS}, \"${prefix}\"") - else() - set(EXTRA_PREFIX_DIRS "\"${prefix}\"") - endif() + set(EXTRA_PREFIX_DIRS "${EXTRA_PREFIX_DIRS}, \"${prefix}\"") endforeach() if (Qt5Core_VERSION VERSION_LESS 5.14.0) -- cgit v1.2.1