From 4feadac76e49635d17ff1265f775d2b15fe2aa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 18 Jan 2013 09:50:02 +0100 Subject: Android-eglfs: Fixed build against Android 4.0.x The header location for SurfaceComposerClient.h changed between Android 4.0 and 4.1, so we need to select based on the major and minor version. Change-Id: I7a6408f8ba3c644facca3a7e64b8d68fde9c4472 Reviewed-by: aavit Reviewed-by: Rainer Keller --- mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp | 7 ++++++- mkspecs/unsupported/android-g++/qmake.conf | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp index 0a71a5fe12..9e5049a3f3 100644 --- a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp +++ b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp @@ -43,12 +43,17 @@ #include #include -#include #include #include #include #include +#if Q_ANDROID_VERSION_MAJOR > 4 || (Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR >= 1) +#include +#else +#include +#endif + using namespace android; QT_BEGIN_NAMESPACE diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf index 7bd8f15b57..29cc709cb9 100644 --- a/mkspecs/unsupported/android-g++/qmake.conf +++ b/mkspecs/unsupported/android-g++/qmake.conf @@ -18,11 +18,13 @@ defineReplace(getAndroidBuildVar) { store_ANDROID_TARGET_CFLAGS = "ANDROID_TARGET_CFLAGS=$$getAndroidBuildVar(TARGET_GLOBAL_CFLAGS)" store_ANDROID_TARGET_LDFLAGS = "ANDROID_TARGET_LDFLAGS=$$getAndroidBuildVar(TARGET_GLOBAL_LDFLAGS)" store_ANDROID_TARGET_ARCH = "ANDROID_TARGET_ARCH=$$getAndroidBuildVar(TARGET_ARCH)" + store_ANDROID_VERSION = "ANDROID_VERSION=$$getAndroidBuildVar(PLATFORM_VERSION)" write_file(android_build_vars, store_ANDROID_TOOLCHAIN_PREFIX) write_file(android_build_vars, store_ANDROID_TARGET_CFLAGS, append) write_file(android_build_vars, store_ANDROID_TARGET_LDFLAGS, append) write_file(android_build_vars, store_ANDROID_TARGET_ARCH, append) + write_file(android_build_vars, store_ANDROID_VERSION, append) } info(using android build env from cache in $$PWD/android_build_vars . delete this file if you changed your build env ) @@ -30,6 +32,9 @@ exists($$PWD/android_build_vars) { include($$PWD/android_build_vars) } +ANDROID_VERSION_SPLIT = $$split(ANDROID_VERSION, ".") +ANDROID_VERSION_MAJOR = $$member(ANDROID_VERSION_SPLIT, 0) +ANDROID_VERSION_MINOR = $$member(ANDROID_VERSION_SPLIT, 1) MAKEFILE_GENERATOR = UNIX QMAKE_COMPILER = gcc @@ -43,6 +48,8 @@ include(../../common/gcc-base-unix.conf) CONFIG = qt warn_on release link_prl QT = core gui DEFINES += Q_OS_LINUX_ANDROID HAVE_ANDROID_OS +DEFINES += Q_ANDROID_VERSION_MAJOR=$$ANDROID_VERSION_MAJOR +DEFINES += Q_ANDROID_VERSION_MINOR=$$ANDROID_VERSION_MINOR DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG QT_NO_EXCEPTIONS #note: -DANDROID results in weird behaviour of math.h -- cgit v1.2.3