diff options
Diffstat (limited to 'mkspecs/unsupported/android-g++')
-rw-r--r-- | mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp | 86 | ||||
-rw-r--r-- | mkspecs/unsupported/android-g++/qmake.conf | 175 | ||||
-rw-r--r-- | mkspecs/unsupported/android-g++/qplatformdefs.h | 42 |
3 files changed, 303 insertions, 0 deletions
diff --git a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp new file mode 100644 index 0000000000..bb751eb98d --- /dev/null +++ b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglfshooks.h" + +#include <ui/DisplayInfo.h> +#include <ui/FramebufferNativeWindow.h> +#include <gui/SurfaceComposerClient.h> + +using namespace android; + +QT_BEGIN_NAMESPACE + +class QEglFSPandaHooks : public QEglFSHooks +{ +public: + virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); +private: + // androidy things + sp<android::SurfaceComposerClient> mSession; + sp<android::SurfaceControl> mControl; + sp<android::Surface> mAndroidSurface; +}; + +EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &) +{ + Q_UNUSED(size); + + mSession = new SurfaceComposerClient(); + DisplayInfo dinfo; + int status=0; + status = mSession->getDisplayInfo(0, &dinfo); + mControl = mSession->createSurface( + 0, dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_888); + SurfaceComposerClient::openGlobalTransaction(); + mControl->setLayer(0x40000000); + mControl->setAlpha(0.4); + SurfaceComposerClient::closeGlobalTransaction(); + mAndroidSurface = mControl->getSurface(); + + EGLNativeWindowType eglWindow = mAndroidSurface.get(); + return eglWindow; +} + +static QEglFSPandaHooks eglFSPandaHooks; +QEglFSHooks *platformHooks = &eglFSPandaHooks; + +QT_END_NAMESPACE diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf new file mode 100644 index 0000000000..54e6d61cee --- /dev/null +++ b/mkspecs/unsupported/android-g++/qmake.conf @@ -0,0 +1,175 @@ +ANDROID_BUILD_TOP=$$(ANDROID_BUILD_TOP) +isEmpty(ANDROID_BUILD_TOP) : error("$ANDROID_BUILD_TOP is empty. Forgot to run 'lunch'?") + +ANDROID_PRODUCT_OUT=$$(ANDROID_PRODUCT_OUT) +isEmpty(ANDROID_PRODUCT_OUT) : error("$ANDROID_PRODUCT_OUT is empty. forgot to run 'lunch'?") + +defineReplace(getAndroidBuildVar) { + thevar = $$1 + r=$$system(cd $$ANDROID_BUILD_TOP && CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core make --no-print-directory -f build/core/config.mk dumpvar-$${thevar}) + return($$r) +} + +# .qmake.cache is not available at mkspec loading time. +# not caching those is horribly slow though + +!exists($$PWD/android_build_vars) { + store_ANDROID_TOOLCHAIN_PREFIX = "ANDROID_TOOLCHAIN_PREFIX=$$getAndroidBuildVar(abs-TARGET_TOOLS_PREFIX)" + 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)" + + 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) +} + +warning(using android build env from cache in $$PWD/android_build_vars . delete this file if you changed your build env ) +exists($$PWD/android_build_vars) { + include($$PWD/android_build_vars) +} + + +MAKEFILE_GENERATOR = UNIX +TARGET_PLATFORM = unix +TEMPLATE = app +QMAKE_INCREMENTAL_STYLE = sublib + +include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) + +CONFIG = qt warn_on release link_prl +QT = core gui +DEFINES += Q_OS_LINUX_ANDROID ANDROID HAVE_ANDROID_OS +DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG QT_NO_EXCEPTIONS + + +QT_QPA_DEFAULT_PLATFORM = eglfs +EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_surfaceflinger.cpp +EGLFS_PLATFORM_HOOKS_LIBS += -lgui -lutils + + +QMAKE_CC = $${ANDROID_TOOLCHAIN_PREFIX}gcc + +QMAKE_CFLAGS = $${ANDROID_TARGET_CFLAGS} + +QMAKE_CFLAGS_WARN_ON = -Wall -Wextra +QMAKE_CFLAGS_WARN_OFF = -Wno-psabi + +QMAKE_CFLAGS_SHLIB = -fPIC +QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses +QMAKE_CFLAGS_THREAD = -D_REENTRANT +QMAKE_CFLAGS_HIDESYMS = + +QMAKE_CXX = $${ANDROID_TOOLCHAIN_PREFIX}g++ +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden + +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_LINK + +QMAKE_AR = $${ANDROID_TOOLCHAIN_PREFIX}ar cqs +QMAKE_OBJCOPY = $${ANDROID_TOOLCHAIN_PREFIX}objcopy +QMAKE_STRIP = $${ANDROID_TOOLCHAIN_PREFIX}strip +QMAKE_RANLIB = $${ANDROID_TOOLCHAIN_PREFIX}ranlib + +QMAKE_INCDIR = $${ANDROID_BUILD_TOP} \ + $${ANDROID_BUILD_TOP}/dalvik/libnativehelper/include/nativehelper \ + $${ANDROID_BUILD_TOP}/bionic \ + $${ANDROID_BUILD_TOP}/bionic/libc/include \ + $${ANDROID_BUILD_TOP}/bionic/libc/kernel/arch-arm \ + $${ANDROID_BUILD_TOP}/bionic/libc/kernel/common \ + $${ANDROID_BUILD_TOP}/bionic/libc/private \ + $${ANDROID_BUILD_TOP}/bionic/libm/include \ + $${ANDROID_BUILD_TOP}/bionic/libm/include/arm \ + $${ANDROID_BUILD_TOP}/bionic/libstdc++/include \ + $${ANDROID_BUILD_TOP}/bionic/libthread_db/include \ + $${ANDROID_BUILD_TOP}/dalvik/libnativehelper/include \ + $${ANDROID_BUILD_TOP}/external/icu4c/common/ \ + $${ANDROID_BUILD_TOP}/external/icu4c/i18n/ \ + $${ANDROID_BUILD_TOP}/external/skia/include \ + $${ANDROID_BUILD_TOP}/external/stlport/stlport \ + $${ANDROID_BUILD_TOP}/frameworks/include \ + $${ANDROID_BUILD_TOP}/frameworks/native/include \ + $${ANDROID_BUILD_TOP}/frameworks/native/include/gui \ + $${ANDROID_BUILD_TOP}/frameworks/native/opengl/include \ + $${ANDROID_BUILD_TOP}/frameworks/base/include \ + $${ANDROID_BUILD_TOP}/frameworks/base/native/include \ + $${ANDROID_BUILD_TOP}/frameworks/base/opengl/include \ + $${ANDROID_BUILD_TOP}/hardware/libhardware/include \ + $${ANDROID_BUILD_TOP}/hardware/libhardware_legacy/include \ + $${ANDROID_BUILD_TOP}/hardware/ril/include \ + $${ANDROID_BUILD_TOP}/system/core/include \ + $${ANDROID_BUILD_TOP}/system/core/include/arch/linux-arm/ \ + $${ANDROID_PRODUCT_OUT}/obj/include + +QMAKE_INCDIR += $${ANDROID_BUILD_TOP}/bionic/libc/arch-$${ANDROID_TARGET_ARCH}/include + +QMAKE_LIBDIR = ${ANDROID_PRODUCT_OUT}/obj/lib +QMAKE_INCDIR_X11 = +QMAKE_LIBDIR_X11 = +QMAKE_INCDIR_OPENGL = +QMAKE_INCDIR_OPENGL_ES1 = +QMAKE_LIBDIR_OPENGL_ES1 = +QMAKE_INCDIR_OPENGL_ES2 = +QMAKE_LIBDIR_OPENGL_ES2 = + + +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX +QMAKE_LFLAGS = $${ANDROID_TARGET_LDFLAGS} \ + -nostdlib \ + -L${ANDROID_PRODUCT_OUT}/obj/lib \ + -Wl,-rpath-link,${ANDROID_PRODUCT_OUT}/obj/lib + +QMAKE_LFLAGS_PLUGIN = -Wl,-T,${ANDROID_BUILD_TOP}/build/core/armelf.xsc \ + -Wl,-shared,-Bsymbolic + +#apparantly this file is missing from some builds. +#it does work without, but this may change in future. +#QMAKE_LFLAGS_APP = -Wl,-T,${ANDROID_BUILD_TOP}/build/core/armelf.xs \ +QMAKE_LFLAGS_APP = ${ANDROID_PRODUCT_OUT}/obj/lib/crtbegin_dynamic.o \ + ${ANDROID_PRODUCT_OUT}/obj/lib/crtend_android.o + +QMAKE_LFLAGS_SHLIB = -Wl,-T,${ANDROID_BUILD_TOP}/build/core/armelf.xsc \ + -Wl,-shared,-Bsymbolic \ + ${ANDROID_PRODUCT_OUT}/obj/lib/crtbegin_so.o \ + ${ANDROID_PRODUCT_OUT}/obj/lib/crtend_so.o + +QMAKE_LFLAGS_SONAME = +QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined +QMAKE_LFLAGS_RPATH = -Wl,-rpath= + + +QMAKE_LIBS = -lstlport -lstdc++ -llog -lz -lm -ldl -lc -lgcc + + +QMAKE_LIBS_X11 = +QMAKE_LIBS_X11SM = +QMAKE_LIBS_QT_THREAD = +QMAKE_LIBS_QT_OPENGL = +QMAKE_LIBS_QTOPIA = +QMAKE_LIBS_THREAD = +QMAKE_LIBS_OPENGL = +QMAKE_LIBS_OPENGL_QT = +QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM +QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2 $$QMAKE_LIBS + +CONFIG += linux-android-9 android-9 linux-android android + +load(qt_config) +QT_CONFIG -=accessibility + +# we don't support exceptions, but right now this has no effect +# you need to manually delete mkspecs/features/exceptions.prf +CONFIG -= exceptions +CONFIG += exceptions_off + diff --git a/mkspecs/unsupported/android-g++/qplatformdefs.h b/mkspecs/unsupported/android-g++/qplatformdefs.h new file mode 100644 index 0000000000..7fc73e9c71 --- /dev/null +++ b/mkspecs/unsupported/android-g++/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../common/android/qplatformdefs.h" |