qt5base-lts/mkspecs/features/qt_android_deps.prf
Eskil Abrahamsen Blomfeldt 522c7ba1ac Enable bundling Qt in Android package in build system
For bundling Qt, we need two things:

1. We need to build a regular .jar file out of the Java files,
so that they can be built into the app package. Dexing the
classes first (i.e. compiling the JVM bytecode to Dalvik
bytecode) is required for loading the .jar file at run-time,
but cannot be used for building it into the app, so we need
two different paths.

2. We need to specify which extra files have to be bundled for
each module (this is primarily for plugins and imports). This
is because there is no static dependency on these files, so
it cannot be detected during deployment.

Task-number: QTBUG-30751
Change-Id: I733603ee5d1c64bd7c5b9357eb5d993b9d0298f7
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-05-01 11:24:15 +02:00

75 lines
2.7 KiB
Plaintext

# W A R N I N G
# -------------
#
# This file is not part of the Qt API. It exists purely as an
# implementation detail. It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#
# Generates an xml file to match the library in lib/ listing the dependencies
# of the module on JNI-based libraries etc. Used for deployment of an Android
# app.
ANDROID_DEPENDS_DIR = $$MODULE_QMAKE_OUTDIR/lib/
DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml
!build_pass {
!isEmpty(MODULE_PLUGIN_TYPES) {
for(PLUGIN_TYPE, MODULE_PLUGIN_TYPES) {
ANDROID_BUNDLED_FILES += "plugins/$$PLUGIN_TYPE"
}
}
!isEmpty(ANDROID_JAR_DEPENDENCIES) {
for(JAR_FILE, ANDROID_JAR_DEPENDENCIES) {
INIT_CLASS = $$section(JAR_FILE, ":", 1, 1)
!isEmpty(INIT_CLASS): INIT_CLASS = "initClass=\"$$INIT_CLASS\""
JAR_FILE = $$section(JAR_FILE, ":", 0, 0)
FILE_CONTENT += "<jar file=\"$$JAR_FILE\" $$INIT_CLASS />"
}
}
!isEmpty(ANDROID_BUNDLED_JAR_DEPENDENCIES) {
for(JAR_FILE, ANDROID_BUNDLED_JAR_DEPENDENCIES) {
INIT_CLASS = $$section(JAR_FILE, ":", 1, 1)
!isEmpty(INIT_CLASS): INIT_CLASS = "initClass=\"$$INIT_CLASS\""
JAR_FILE = $$section(JAR_FILE, ":", 0, 0)
FILE_CONTENT += "<jar bundling=\"1\" file=\"$$JAR_FILE\" $$INIT_CLASS />"
}
}
!isEmpty(ANDROID_LIB_DEPENDENCIES) {
for(LIB_FILE, ANDROID_LIB_DEPENDENCIES) {
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" />"
}
}
!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
for(REPLACEMENT, ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
REPLACEMENT_FILE = $$section(REPLACEMENT, ":", 0, 0)
LIB_FILE = $$section(REPLACEMENT, ":", 1, 1)
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" replaces=\"$$REPLACEMENT_FILE\" />"
}
}
!isEmpty(ANDROID_BUNDLED_FILES) {
for (BUNDLED_FILE, ANDROID_BUNDLED_FILES) {
FILE_CONTENT += "<bundled file=\"$$BUNDLED_FILE\" />"
}
}
!isEmpty(FILE_CONTENT) {
FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>"
write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.")
}
}
!isEmpty(ANDROID_JAR_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS)|!isEmpty(ANDROID_BUNDLED_JAR_DEPENDENCIES)|!isEmpty(ANDROID_BUNDLED_FILES) {
install_dependencies_file.files = $$DEPENDENCY_FILE
install_dependencies_file.path = $$[QT_INSTALL_LIBS]
INSTALLS += install_dependencies_file
}