From a70e9a0162f7814b33af0cfe6d7f67731ba7cce4 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 11 May 2020 15:49:03 +0200 Subject: [android] Allow specifying APK install location Summary: This allows `make create-apk` to directly write the APK to /output instead of the cp-with-prefix step in /opt/helpers/create-apk. It's also useful for manual development builds where one would need to copy it to some output location manually or for CI setups that expect the output in a certain location. If ANDROID_APK_INSTALL_DIR is not set the current behaviour is kept. Reviewers: #frameworks, #android, apol, vkrause Reviewed By: #android, apol Subscribers: kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D29631 --- toolchain/Android.cmake | 3 ++- toolchain/ECMAndroidDeployQt.cmake | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'toolchain') diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 63b40e70..5f1d96f8 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -90,7 +90,8 @@ # make # make create-apk-myapp # -# The APK would then be found in ``myapp_build_apk/bin`` in the build directory. +# You can specify the APK output directory by setting ``ANDROID_APK_OUTPUT_DIR``. +# Otherwise the APK can be found in ``myapp_build_apk/`` in the build directory. # # The create-apk-myapp target will be able to take an ARGS parameter with further # arguments for androiddeployqt. For example, one can use:: diff --git a/toolchain/ECMAndroidDeployQt.cmake b/toolchain/ECMAndroidDeployQt.cmake index 09518763..d5f70336 100644 --- a/toolchain/ECMAndroidDeployQt.cmake +++ b/toolchain/ECMAndroidDeployQt.cmake @@ -66,6 +66,10 @@ function(ecm_androiddeployqt QTANDROID_EXPORTED_TARGET ECM_ADDITIONAL_FIND_ROOT_ add_custom_target(create-apk) endif() + if (NOT DEFINED ANDROID_APK_OUTPUT_DIR) + set(ANDROID_APK_OUTPUT_DIR ${EXPORT_DIR}) + endif() + set(CREATEAPK_TARGET_NAME "create-apk-${QTANDROID_EXPORTED_TARGET}") add_custom_target(${CREATEAPK_TARGET_NAME} COMMAND cmake -E echo "Generating $ with $/androiddeployqt" @@ -74,11 +78,11 @@ function(ecm_androiddeployqt QTANDROID_EXPORTED_TARGET ECM_ADDITIONAL_FIND_ROOT_ COMMAND cmake -E copy "$" "${EXECUTABLE_DESTINATION_PATH}" COMMAND LANG=C cmake "-DTARGET=$" -P ${_CMAKE_ANDROID_DIR}/hasMainSymbol.cmake COMMAND LANG=C cmake -DINPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json.in2" -DOUTPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json" "-DTARGET=$" "-DOUTPUT_DIR=$" "-DEXPORT_DIR=${CMAKE_INSTALL_PREFIX}" "-DECM_ADDITIONAL_FIND_ROOT_PATH=\"${ECM_ADDITIONAL_FIND_ROOT_PATH}\"" "-DANDROID_EXTRA_LIBS=\"${ANDROID_EXTRA_LIBS}\"" -P ${_CMAKE_ANDROID_DIR}/specifydependencies.cmake - COMMAND $/androiddeployqt --gradle --input "${QTANDROID_EXPORTED_TARGET}-deployment.json" --apk "${EXPORT_DIR}/${QTANDROID_EXPORTED_TARGET}-${CMAKE_ANDROID_ARCH_ABI}.apk" --output "${EXPORT_DIR}" --deployment bundled ${arguments} + COMMAND $/androiddeployqt --gradle --input "${QTANDROID_EXPORTED_TARGET}-deployment.json" --apk "${ANDROID_APK_OUTPUT_DIR}/${QTANDROID_EXPORTED_TARGET}-${CMAKE_ANDROID_ARCH_ABI}.apk" --output "${EXPORT_DIR}" --deployment bundled ${arguments} ) add_custom_target(install-apk-${QTANDROID_EXPORTED_TARGET} - COMMAND adb install -r "${EXPORT_DIR}/${QTANDROID_EXPORTED_TARGET}-${CMAKE_ANDROID_ARCH_ABI}.apk" + COMMAND adb install -r "${ANDROID_APK_OUTPUT_DIR}/${QTANDROID_EXPORTED_TARGET}-${CMAKE_ANDROID_ARCH_ABI}.apk" ) add_dependencies(create-apk ${CREATEAPK_TARGET_NAME}) endfunction() -- cgit v1.2.1