diff options
author | Alexey Minnekhanov <a.minnekhanov@omprussia.ru> | 2018-05-29 18:29:53 +0300 |
---|---|---|
committer | Alexey Min <alexey.min@gmail.com> | 2018-05-31 11:10:15 +0300 |
commit | 0dc051905ae97a48e0b40f6fcf3151b4e919264d (patch) | |
tree | 9e842085e9409568702f8c4524803da8d8dc3b82 | |
parent | 73f8256b0deba1a04e445237484e70156afb3f0a (diff) | |
download | extra-cmake-modules-5.47.0-rc1.tar.gz extra-cmake-modules-5.47.0-rc1.tar.bz2 |
Android toolchain: allow to specify extra libs manuallyv5.47.0-rc1v5.47.0
Summary: Add new variable ANDROID_EXTRA_LIBS, which can contain list of full paths to libs to include in resulting APK file. This can be used to include plugins that are not directly liked to executable, for example OpenSSL libs for QtNetwork SSL/HTTPS support.
Test Plan: Build project with -DANDROID_EXTRA_LIBS="/path/to/lib.so;/path/to/other_lib.so". Build without it. In both cases verify APK contents.
Reviewers: apol
Reviewed By: apol
Subscribers: kde-buildsystem, kde-frameworks-devel
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D13198
-rw-r--r-- | toolchain/Android.cmake | 2 | ||||
-rw-r--r-- | toolchain/ECMAndroidDeployQt.cmake | 2 | ||||
-rw-r--r-- | toolchain/specifydependencies.cmake | 7 |
3 files changed, 10 insertions, 1 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 517aabec..30d82a66 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -53,6 +53,8 @@ # directories in the NDK. Default: ``armeabi-v7a``. # ``ANDROID_SDK_BUILD_TOOLS_REVISION`` # The build tools version to use. Default: ``21.1.1``. +# ``ANDROID_EXTRA_LIBS`` +# The ";"-separated list of full paths to libs to include in resulting APK. # # For integrating other libraries which are not part of the Android toolchain, # like Qt5, and installed to a separate prefix on the host system, the install diff --git a/toolchain/ECMAndroidDeployQt.cmake b/toolchain/ECMAndroidDeployQt.cmake index 721cdce7..f3e960cd 100644 --- a/toolchain/ECMAndroidDeployQt.cmake +++ b/toolchain/ECMAndroidDeployQt.cmake @@ -57,7 +57,7 @@ function(ecm_androiddeployqt QTANDROID_EXPORTED_TARGET ECM_ADDITIONAL_FIND_ROOT_ COMMAND cmake -E copy_directory "${ANDROID_APK_DIR}" "${EXPORT_DIR}" COMMAND cmake -E copy "$<TARGET_FILE:${QTANDROID_EXPORTED_TARGET}>" "${EXECUTABLE_DESTINATION_PATH}" COMMAND LANG=C cmake "-DTARGET=$<TARGET_FILE:${QTANDROID_EXPORTED_TARGET}>" -P ${_CMAKE_ANDROID_DIR}/hasMainSymbol.cmake - COMMAND LANG=C cmake -DINPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json.in" -DOUTPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json" "-DTARGET=$<TARGET_FILE:${QTANDROID_EXPORTED_TARGET}>" "-DOUTPUT_DIR=$<TARGET_FILE_DIR:${QTANDROID_EXPORTED_TARGET}>" "-DEXPORT_DIR=${CMAKE_INSTALL_PREFIX}" "-DECM_ADDITIONAL_FIND_ROOT_PATH=\"${ECM_ADDITIONAL_FIND_ROOT_PATH}\"" -P ${_CMAKE_ANDROID_DIR}/specifydependencies.cmake + COMMAND LANG=C cmake -DINPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json.in" -DOUTPUT_FILE="${QTANDROID_EXPORTED_TARGET}-deployment.json" "-DTARGET=$<TARGET_FILE:${QTANDROID_EXPORTED_TARGET}>" "-DOUTPUT_DIR=$<TARGET_FILE_DIR:${QTANDROID_EXPORTED_TARGET}>" "-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 $<TARGET_FILE_DIR:Qt5::qmake>/androiddeployqt --gradle --input "${QTANDROID_EXPORTED_TARGET}-deployment.json" --output "${EXPORT_DIR}" --deployment bundled ${arguments} ) diff --git a/toolchain/specifydependencies.cmake b/toolchain/specifydependencies.cmake index a1bc4202..9cab3f2d 100644 --- a/toolchain/specifydependencies.cmake +++ b/toolchain/specifydependencies.cmake @@ -21,6 +21,13 @@ foreach(line ${lines}) endif() endforeach() +if (ANDROID_EXTRA_LIBS) + foreach (extralib ${ANDROID_EXTRA_LIBS}) + message(STATUS "manually specified extra library: " ${extralib}) + list(APPEND extralibs ${extralib}) + endforeach() +endif() + if(extralibs) string(REPLACE ";" "," libs "${extralibs}") set(extralibs "\"android-extra-libs\": \"${libs}\",") |