summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/java.prf
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@digia.com>2013-03-04 10:16:42 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-05 08:31:23 +0100
commit97fcf3bc987a18f32233fea550eb4a5a22e2b822 (patch)
tree31d75557fdc4a525af8f5053db514066c63bd1bd /mkspecs/features/java.prf
parent1b582d64eb6d13e60a02ebc40956302a4864eb6c (diff)
Introducing the Qt Android port
Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'mkspecs/features/java.prf')
-rw-r--r--mkspecs/features/java.prf61
1 files changed, 61 insertions, 0 deletions
diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf
new file mode 100644
index 0000000000..05350db48d
--- /dev/null
+++ b/mkspecs/features/java.prf
@@ -0,0 +1,61 @@
+TEMPLATE = lib
+android {
+ isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT)
+ isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT
+ isEmpty(API_VERSION) {
+ API_VERSION = $$(ANDROID_API_VERSION)
+ isEmpty(API_VERSION): API_VERSION = android-10
+ }
+
+ !exists($$SDK_ROOT/platforms/$$API_VERSION/android.jar) {
+ error("The Path $$SDK_ROOT/platforms/$$API_VERSION/android.jar does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.")
+ }
+ JAVACLASSPATH += $$SDK_ROOT/platforms/$$API_VERSION/android.jar
+
+ # FIXME: This is a hack to work around some hardcoded values in the android.prf. The
+ # android.prf should be fixed and this should be removed.
+ CONFIG += android_app
+}
+
+isEmpty(CLASS_DIR): CLASS_DIR = .classes
+
+CONFIG -= qt
+
+# Without these, qmake adds a name prefix and versioning postfixes (as well as file
+# links) to the target. This is hardcoded in the qmake code, so for now we use
+# the plugin configs to get what we want.
+CONFIG += plugin no_plugin_name_prefix
+
+javac.input = JAVASOURCES
+javac.output = $$CLASS_DIR
+javac.CONFIG += combine
+javac.commands = javac -source 6 -target 6 -cp $$shell_quote($$join(JAVACLASSPATH, ":")) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
+# Force rebuild every time, because we don't know the paths of the destination files
+# as they depend on the code.
+javac.depends = FORCE
+QMAKE_EXTRA_COMPILERS += javac
+
+mkpath($$absolute_path($$CLASS_DIR, $$OUT_PWD)) | error("Aborting.")
+
+# Disable all linker flags since we are overriding the regular linker
+QMAKE_LFLAGS =
+QMAKE_CFLAGS =
+QMAKE_LFLAGS_RPATH =
+QMAKE_LFLAGS_PLUGIN =
+QMAKE_LIBS =
+QMAKE_LIBS_OPENGL_ES2 =
+QMAKE_LIBDIR =
+QMAKE_EXTENSION_SHLIB = jar
+
+# Override linker with dex (for Android) or jar (for other java builds)
+android {
+ QMAKE_LINK_O_FLAG = --output=
+ QMAKE_LINK = $$SDK_ROOT/platform-tools/dx --dex
+} else {
+ QMAKE_LINK_O_FLAG = "cf "
+ QMAKE_LINK = jar
+}
+
+# Force link step to always happen, since we are always updating the
+# .class files
+PRE_TARGETDEPS += FORCE