aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-05-03 17:00:24 +0200
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-05-03 17:00:24 +0200
commite0cfec7848ba63190957e107c7ef32dbe0119c42 (patch)
treebbe700543d38547fbe427cf56deed6867e508be8
parentd914de956197c72e4df55b7b09ebae1222c5ddcf (diff)
downloadextra-cmake-modules-e0cfec7848ba63190957e107c7ef32dbe0119c42.tar.gz
extra-cmake-modules-e0cfec7848ba63190957e107c7ef32dbe0119c42.tar.bz2
Android deployment: support projects without things in share or lib/qmlv5.22.0-rc1v5.22.0
Just setting the field android-extra-plugins to an empty string resulted in androiddeployqt complaining about "External resource does not exist or not a correct directory!" so the field is completely left out now if no plugin data dirs are found. For consistency the same is done with the android-extra-libs field. REVIEW: 127700 BUG: 362578 Thanks apol for review
-rw-r--r--toolchain/Android.cmake2
-rw-r--r--toolchain/deployment-file.json.in4
-rw-r--r--toolchain/specifydependencies.cmake19
3 files changed, 22 insertions, 3 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake
index 60bd058d..20e65f87 100644
--- a/toolchain/Android.cmake
+++ b/toolchain/Android.cmake
@@ -183,7 +183,7 @@ if(DEFINED QTANDROID_EXPORTED_TARGET AND NOT TARGET ${CREATEAPK_TARGET_NAME})
COMMAND cmake -E remove_directory "${EXPORT_DIR}"
COMMAND cmake -E copy_directory "${ANDROID_APK_DIR}" "${EXPORT_DIR}"
COMMAND cmake -E copy "$<TARGET_FILE:${QTANDROID_EXPORTED_TARGET}>" "${EXECUTABLE_DESTINATION_PATH}"
- COMMAND cmake -DINPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json.in" -DOUTPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json" "-DTARGET_DIR=$<TARGET_FILE_DIR:${QTANDROID_EXPORTED_TARGET}>" "-DTARGET_NAME=${QTANDROID_EXPORTED_TARGET}" -P ${_CMAKE_ANDROID_DIR}/specifydependencies.cmake
+ COMMAND cmake -DINPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json.in" -DOUTPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json" "-DTARGET_DIR=$<TARGET_FILE_DIR:${QTANDROID_EXPORTED_TARGET}>" "-DTARGET_NAME=${QTANDROID_EXPORTED_TARGET}" "-DEXPORT_DIR=${CMAKE_INSTALL_PREFIX}" -P ${_CMAKE_ANDROID_DIR}/specifydependencies.cmake
COMMAND $<TARGET_FILE_DIR:Qt5::qmake>/androiddeployqt --input "${QTANDROID_EXPORTED_TARGET}-deployment.json" --output "${EXPORT_DIR}" --deployment bundled "\\$(ARGS)"
)
else()
diff --git a/toolchain/deployment-file.json.in b/toolchain/deployment-file.json.in
index 9367bc1b..e691e431 100644
--- a/toolchain/deployment-file.json.in
+++ b/toolchain/deployment-file.json.in
@@ -8,8 +8,8 @@
"ndk-host": "@_HOST@",
"target-architecture": "@ANDROID_ABI@",
"application-binary": "@EXECUTABLE_DESTINATION_PATH@",
- "android-extra-libs": "##EXTRALIBS##",
- "android-extra-plugins": "@CMAKE_INSTALL_PREFIX@/share,@CMAKE_INSTALL_PREFIX@/lib/qml",
+ ##EXTRALIBS##
+ ##EXTRAPLUGINS##
"android-package-source-directory": "@ANDROID_APK_DIR@",
"sdkBuildToolsRevision": "@ANDROID_SDK_BUILD_TOOLS_REVISION@"
}
diff --git a/toolchain/specifydependencies.cmake b/toolchain/specifydependencies.cmake
index 21b169ae..e01c61a7 100644
--- a/toolchain/specifydependencies.cmake
+++ b/toolchain/specifydependencies.cmake
@@ -16,7 +16,26 @@ foreach(lib IN LISTS outout) #now we filter Qt5 libraries, because Qt wants to t
endif()
endif()
endforeach()
+if(extralibs)
+ set(extralibs "\"android-extra-libs\": \"${extralibs}\",")
+endif()
+
+set(extraplugins)
+foreach(folder "share" "lib/qml") #now we check for folders with extra stuff
+ set(plugin "${EXPORT_DIR}/${folder}")
+ if(EXISTS "${plugin}")
+ if(extraplugins)
+ set(extraplugins "${extraplugins},${plugin}")
+ else()
+ set(extraplugins "${plugin}")
+ endif()
+ endif()
+endforeach()
+if(extraplugins)
+ set(extraplugins "\"android-extra-plugins\": \"${extraplugins}\",")
+endif()
file(READ "${INPUT_FILE}" CONTENTS)
string(REPLACE "##EXTRALIBS##" "${extralibs}" NEWCONTENTS "${CONTENTS}")
+string(REPLACE "##EXTRAPLUGINS##" "${extraplugins}" NEWCONTENTS "${NEWCONTENTS}")
file(WRITE "${OUTPUT_FILE}" ${NEWCONTENTS})