From 3b20ef911eb83b7bd37315ace682e0e6bc6195d9 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 1 Oct 2015 01:25:03 +0200 Subject: Remove workaround to delay execution on Android * Remove get_property calls on targets, this way we don't need to be called right before configuration time. * Removes EOFHook Instead we process it at generation time using the link.txt file (which is probably another hack) REVIEW: 125084 --- toolchain/Android.cmake | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'toolchain/Android.cmake') diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 9b104747..a60771bc 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -174,38 +174,16 @@ if(DEFINED QTANDROID_EXPORTED_TARGET AND NOT TARGET ${CREATEAPK_TARGET_NAME}) find_package(Qt5Core REQUIRED) - function(EOFHook) - if(CMAKE_PARENT_LIST_FILE STREQUAL "") - generate_deployment_file() - endif() - endfunction() - - function(generate_deployment_file) - get_property(_DEPENDENCIES TARGET ${QTANDROID_EXPORTED_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES) - set(_DEPS_LIST) - foreach(_DEP IN LISTS _DEPENDENCIES) - if(NOT _DEP MATCHES "Qt5::.*") - get_property(_DEP_LOCATION TARGET ${_DEP} PROPERTY "LOCATION_${CMAKE_BUILD_TYPE}") - list(APPEND _DEPS_LIST ${_DEP_LOCATION}) - endif() - endforeach() - string(REPLACE ";" "," _DEPS "${_DEPS_LIST}") - configure_file("${_CMAKE_ANDROID_DIR}/deployment-file.json.in" "${QTANDROID_EXPORTED_TARGET}-deployment.json") - endfunction() - #we want to call the function after the project has been set up - variable_watch(CMAKE_PARENT_LIST_FILE EOFHook) - -# Create the target that will eventually generate the apk - get_filename_component(QTDIR "${Qt5Core_DIR}/../../../" ABSOLUTE) - find_program(ANDROID_DEPLOY_QT androiddeployqt HINTS "${QTDIR}/bin") set(EXPORT_DIR "${CMAKE_BINARY_DIR}/${QTANDROID_EXPORTED_TARGET}_build_apk/") set(EXECUTABLE_DESTINATION_PATH "${EXPORT_DIR}/libs/${ANDROID_ABI}/lib${QTANDROID_EXPORTED_TARGET}.so") + configure_file("${_CMAKE_ANDROID_DIR}/deployment-file.json.in" "${QTANDROID_EXPORTED_TARGET}-deployment.json.in") add_custom_target(${CREATEAPK_TARGET_NAME} - COMMAND cmake -E echo "Generating $ with ${ANDROID_DEPLOY_QT}" + COMMAND cmake -E echo "Generating $ with $/androiddeployqt" COMMAND cmake -E copy_directory "${ANDROID_APK_DIR}" "${EXPORT_DIR}" COMMAND cmake -E copy "$" "${EXECUTABLE_DESTINATION_PATH}" - COMMAND ${ANDROID_DEPLOY_QT} --input "${QTANDROID_EXPORTED_TARGET}-deployment.json" --output "${EXPORT_DIR}" --deployment bundled "\\$(ARGS)" + COMMAND cmake -DINPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json.in" -DOUTPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json" "-DTARGET_DIR=$" "-DTARGET_NAME=${QTANDROID_EXPORTED_TARGET}" -P ${_CMAKE_ANDROID_DIR}/specifydependencies.cmake + COMMAND $/androiddeployqt --input "${QTANDROID_EXPORTED_TARGET}-deployment.json" --output "${EXPORT_DIR}" --deployment bundled "\\$(ARGS)" ) else() message(STATUS "You can export a target by specifying -DQTANDROID_EXPORTED_TARGET=") -- cgit v1.2.1