b45533161e
When configuring with Qt only with one ABI, certain code paths were not triggered, which led to a few issues: - The deployment json file generated by androiddeployqt listed no architectures. - The compiled shared library did not have a lib prefix and arch suffix, which androiddeployqt during the deployment / make apk step. To fix the architectures missing in the json file, ANDROID_ABIS needs to be set in android/resolve_config.prf also in the single abi case. To get the correct file names, android.prf needs to apply the prefixes and suffixes not only in the build_pass case (multi-abi) but also in the single abi case (except for config.tests). The application-binary entry in the json file needs to be without the extra prefixes and suffixes though, so make a copy of the TARGET value to be used in the json file, before the name manipulations are applied. Pick-to: 5.15 Task-number: QTBUG-85399 Change-Id: Idde92ab7fe883636ccc65a87b91c8a3fc72eefbb Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
102 lines
4.6 KiB
Plaintext
102 lines
4.6 KiB
Plaintext
contains(TEMPLATE, ".*app"):!build_pass:!android-embedded {
|
|
|
|
defineReplace(emitString) {
|
|
return("\"$$replace(1, \\\\, \\\\)\"")
|
|
}
|
|
|
|
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\": $$emitString($$[QT_INSTALL_PREFIX]),"
|
|
|
|
# Settings from mkspecs/environment
|
|
FILE_CONTENT += " \"sdk\": $$emitString($$ANDROID_SDK_ROOT),"
|
|
FILE_CONTENT += " \"sdkBuildToolsRevision\": $$emitString($$ANDROID_SDK_BUILD_TOOLS_REVISION),"
|
|
|
|
isEmpty(NDK_ROOT): NDK_ROOT = $$(ANDROID_NDK_ROOT)
|
|
isEmpty(NDK_ROOT): NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT
|
|
FILE_CONTENT += " \"ndk\": $$emitString($$NDK_ROOT),"
|
|
|
|
FILE_CONTENT += " \"toolchain-prefix\": \"llvm\","
|
|
FILE_CONTENT += " \"tool-prefix\": \"llvm\","
|
|
|
|
NDK_HOST = $$(ANDROID_NDK_HOST)
|
|
isEmpty(NDK_HOST): NDK_HOST = $$DEFAULT_ANDROID_NDK_HOST
|
|
FILE_CONTENT += " \"ndk-host\": $$emitString($$NDK_HOST),"
|
|
|
|
for (arch, ANDROID_ABIS) {
|
|
equals(arch, x86): libs_arch = i686-linux-android
|
|
else: equals(arch, x86_64): libs_arch = x86_64-linux-android
|
|
else: equals(arch, arm64-v8a): libs_arch = aarch64-linux-android
|
|
else: libs_arch = arm-linux-androideabi
|
|
ARCHS += "$$emitString($$arch):$$emitString($$libs_arch)"
|
|
}
|
|
FILE_CONTENT += " \"architectures\": {$$join(ARCHS,", ")},"
|
|
|
|
# Explicitly set qt dependencies of application for deployment
|
|
!isEmpty(ANDROID_DEPLOYMENT_DEPENDENCIES): \
|
|
FILE_CONTENT += " \"deployment-dependencies\": $$emitString($$join(ANDROID_DEPLOYMENT_DEPENDENCIES, ",")),"
|
|
|
|
# Explicitly set external dependencies of application for deployment
|
|
!isEmpty(ANDROID_EXTRA_PLUGINS): \
|
|
FILE_CONTENT += " \"android-extra-plugins\": $$emitString($$join(ANDROID_EXTRA_PLUGINS, ",")),"
|
|
|
|
# Android-specific settings of Project
|
|
!isEmpty(ANDROID_PACKAGE_SOURCE_DIR): \
|
|
FILE_CONTENT += " \"android-package-source-directory\": $$emitString($$ANDROID_PACKAGE_SOURCE_DIR),"
|
|
|
|
# Android-specific version string
|
|
!isEmpty(ANDROID_VERSION_NAME): \
|
|
FILE_CONTENT += " \"android-version-name\": $$emitString($$ANDROID_VERSION_NAME),"
|
|
|
|
# Android-specific version number
|
|
!isEmpty(ANDROID_VERSION_CODE): \
|
|
FILE_CONTENT += " \"android-version-code\": $$emitString($$ANDROID_VERSION_CODE),"
|
|
|
|
!isEmpty(ANDROID_MIN_SDK_VERSION): \
|
|
FILE_CONTENT += " \"android-min-sdk-version\": $$emitString($$ANDROID_MIN_SDK_VERSION),"
|
|
|
|
!isEmpty(ANDROID_TARGET_SDK_VERSION): \
|
|
FILE_CONTENT += " \"android-target-sdk-version\": $$emitString($$ANDROID_TARGET_SDK_VERSION),"
|
|
|
|
!isEmpty(ANDROID_EXTRA_LIBS): \
|
|
FILE_CONTENT += " \"android-extra-libs\": $$emitString($$join(ANDROID_EXTRA_LIBS, ",")),"
|
|
|
|
qml_import_paths = $$(QML2_IMPORT_PATH)
|
|
qml_import_paths = $$split(qml_import_paths, $$DIRLIST_SEPARATOR)
|
|
qml_import_paths += $$QML_IMPORT_PATH
|
|
!isEmpty(qml_import_paths) {
|
|
FILE_CONTENT += " \"qml-import-paths\": $$emitString($$join(qml_import_paths, ",")),"
|
|
}
|
|
unset(qml_import_paths)
|
|
|
|
isEmpty(QML_ROOT_PATH): \
|
|
QML_ROOT_PATH = $$_PRO_FILE_PWD_
|
|
FILE_CONTENT += " \"qml-root-path\": $$emitString($$QML_ROOT_PATH),"
|
|
FILE_CONTENT += " \"stdcpp-path\": $$emitString($$ANDROID_STDCPP_PATH),"
|
|
!isEmpty(RESOURCES)|!isEmpty(QMLCACHE_RESOURCE_FILES) {
|
|
# Make sure that qmake generated qrc files are accounted for
|
|
load(resources_functions)
|
|
qtFlattenResources()
|
|
NEWRESOURCES = $$RESOURCES $$QMLCACHE_RESOURCE_FILES
|
|
for(resource, NEWRESOURCES) {
|
|
contains(resource, ".*qmake_qmake_immediate\\.qrc$") {
|
|
# They will be created for each architecture, since they could be different
|
|
# we need to account for all of them
|
|
for (arch, ANDROID_ABIS): \
|
|
rescopy += $$absolute_path("qmake_qmake_immediate.qrc", $$OUT_PWD/$$arch)
|
|
} else {
|
|
contains(resource, ".*\\.qrc$"): rescopy += $$absolute_path($$resource, $$_PRO_FILE_PWD_)
|
|
}
|
|
}
|
|
FILE_CONTENT += " \"qrcFiles\": $$emitString($$join(rescopy, ",")),"
|
|
}
|
|
FILE_CONTENT += ""
|
|
FILE_CONTENT += " \"application-binary\": $$emitString($$TARGET_FOR_ANDROID_DEPLOYMENT_SETTINGS)"
|
|
FILE_CONTENT += "}"
|
|
|
|
isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET_FOR_ANDROID_DEPLOYMENT_SETTINGS-deployment-settings.json
|
|
|
|
write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT)|error()
|
|
}
|