Add qmake generation of Android deployment settings

This outputs a json file with the necessary settings from qmake
so that an external build tool can easily get the settings without
having to parse the entire .pro source. Used by the androiddeployqt
tool.

Task-number: QTBUG-32856
Change-Id: I5d3ac0ab6a0350162d06b0a0bf0c9bcbd90d8b5a
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2013-09-05 13:18:15 +02:00 committed by The Qt Project
parent 4c83183e71
commit a6f1123fe5
2 changed files with 71 additions and 1 deletions

View File

@ -3,7 +3,7 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = android
QMAKE_COMPILER = gcc
CONFIG += android_install unversioned_soname
CONFIG += android_install unversioned_soname android_deployment_settings
DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG
include(../common/linux.conf)

View File

@ -0,0 +1,70 @@
contains(TEMPLATE, ".*app"):!build_pass:!android-no-sdk {
FILE_CONTENT = "{"
FILE_CONTENT += " \"description\": \"This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.\","
FILE_CONTENT += " \"qt\": \"$$[QT_INSTALL_PREFIX]\","
# Settings from mkspecs/environment
isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT)
isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT
FILE_CONTENT += " \"sdk\": \"$$SDK_ROOT\","
isEmpty(NDK_ROOT): NDK_ROOT = $$(ANDROID_NDK_ROOT)
isEmpty(NDK_ROOT): NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT
FILE_CONTENT += " \"ndk\": \"$$NDK_ROOT\","
NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX)
isEmpty(NDK_TOOLCHAIN_PREFIX) {
equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86
else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android
else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
}
FILE_CONTENT += " \"toolchain-prefix\": \"$$NDK_TOOLCHAIN_PREFIX\","
NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION)
isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION
FILE_CONTENT += " \"toolchain-version\": \"$$NDK_TOOLCHAIN_VERSION\","
NDK_HOST = $$(ANDROID_NDK_HOST)
isEmpty(NDK_HOST): NDK_HOST = $$DEFAULT_ANDROID_NDK_HOST
FILE_CONTENT += " \"ndk-host\": \"$$NDK_HOST\","
ANDROID_TARGET_ARCH = $$(ANDROID_TARGET_ARCH)
isEmpty(ANDROID_TARGET_ARCH): ANDROID_TARGET_ARCH = $$DEFAULT_ANDROID_TARGET_ARCH
FILE_CONTENT += " \"target-architecture\": \"$$ANDROID_TARGET_ARCH\","
# Explicitly set dependencies of application for deployment
!isEmpty(ANDROID_DEPLOYMENT_DEPENDENCIES): \
FILE_CONTENT += " \"deployment-dependencies\": \""$$join(ANDROID_DEPLOYMENT_DEPENDENCIES, ",")"\","
# Android-specific settings of Project
!isEmpty(ANDROID_PACKAGE_SOURCE_DIR): \
FILE_CONTENT += " \"android-package-source-directory\": \"$$ANDROID_PACKAGE_SOURCE_DIR\","
!isEmpty(ANDROID_PACKAGE): \
FILE_CONTENT += " \"android-package\": \"$$ANDROID_PACKAGE\","
!isEmpty(ANDROID_MINIMUM_VERSION): \
FILE_CONTENT += " \"android-minimum-version\": \"$$ANDROID_MINIMUM_VERSION\","
!isEmpty(ANDROID_TARGET_VERSION): \
FILE_CONTENT += " \"android-target-version\": \"$$ANDROID_TARGET_VERSION\","
!isEmpty(ANDROID_APP_NAME): \
FILE_CONTENT += " \"android-app-name\": \"$$ANDROID_APP_NAME\","
!isEmpty(ANDROID_EXTRA_LIBS): \
FILE_CONTENT += " \"android-extra-libs\": \""$$join(ANDROID_EXTRA_LIBS, ",")"\","
!isEmpty(QMAKE_SUPPORTED_ORIENTATIONS): \
FILE_CONTENT += " \"supported-orientations\": \""$$join(QMAKE_SUPPORTED_ORIENTATIONS, ",")"\","
FILE_CONTENT += " \"application-binary\": \"$$absolute_path($$DESTDIR, $$OUT_PWD)/$$TARGET\""
FILE_CONTENT += "}"
isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json
write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT) | error("Aborting.")
}