2013-03-04 09:16:42 +00:00
|
|
|
# qmake configuration for building with android-g++
|
2013-03-19 01:57:31 +00:00
|
|
|
MAKEFILE_GENERATOR = UNIX
|
|
|
|
QMAKE_PLATFORM = android
|
|
|
|
QMAKE_COMPILER = gcc
|
2013-03-04 09:16:42 +00:00
|
|
|
|
2014-04-23 14:26:26 +00:00
|
|
|
CONFIG += android_install unversioned_soname unversioned_libname android_deployment_settings
|
2013-03-04 09:16:42 +00:00
|
|
|
|
|
|
|
include(../common/linux.conf)
|
|
|
|
include(../common/gcc-base-unix.conf)
|
|
|
|
|
2013-04-10 08:17:30 +00:00
|
|
|
load(device_config)
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
NDK_ROOT = $$(ANDROID_NDK_ROOT)
|
|
|
|
!exists($$NDK_ROOT) {
|
|
|
|
NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT
|
|
|
|
}
|
|
|
|
|
|
|
|
NDK_HOST = $$(ANDROID_NDK_HOST)
|
|
|
|
isEmpty(NDK_HOST): NDK_HOST = $$DEFAULT_ANDROID_NDK_HOST
|
|
|
|
|
|
|
|
ANDROID_PLATFORM = $$(ANDROID_NDK_PLATFORM)
|
|
|
|
isEmpty(ANDROID_PLATFORM): ANDROID_PLATFORM = $$DEFAULT_ANDROID_PLATFORM
|
|
|
|
|
|
|
|
ANDROID_TARGET_ARCH = $$(ANDROID_TARGET_ARCH)
|
|
|
|
isEmpty(ANDROID_TARGET_ARCH): ANDROID_TARGET_ARCH = $$DEFAULT_ANDROID_TARGET_ARCH
|
|
|
|
|
|
|
|
NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX)
|
|
|
|
isEmpty(NDK_TOOLCHAIN_PREFIX) {
|
|
|
|
equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86
|
2014-10-30 12:03:00 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, x86_64): NDK_TOOLCHAIN_PREFIX = x86_64
|
2013-03-04 09:16:42 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android
|
2014-10-30 12:03:00 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, mips64): NDK_TOOLCHAIN_PREFIX = mips64el-linux-android
|
|
|
|
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): NDK_TOOLCHAIN_PREFIX = aarch64-linux-android
|
2013-03-04 09:16:42 +00:00
|
|
|
else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
|
|
|
|
}
|
|
|
|
|
|
|
|
NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX)
|
|
|
|
isEmpty(NDK_TOOLS_PREFIX) {
|
|
|
|
equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLS_PREFIX = i686-linux-android
|
2014-10-30 12:03:00 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, x86_64): NDK_TOOLS_PREFIX = x86_64-linux-android
|
2013-03-04 09:16:42 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLS_PREFIX = mipsel-linux-android
|
2014-10-30 12:03:00 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, mips64): NDK_TOOLS_PREFIX = mips64el-linux-android
|
|
|
|
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): NDK_TOOLS_PREFIX = aarch64-linux-android
|
2013-03-04 09:16:42 +00:00
|
|
|
else: NDK_TOOLS_PREFIX = arm-linux-androideabi
|
|
|
|
}
|
|
|
|
|
|
|
|
NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION)
|
|
|
|
isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION
|
|
|
|
|
|
|
|
equals(ANDROID_TARGET_ARCH, x86): ANDROID_ARCHITECTURE = x86
|
2014-10-30 12:03:00 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, x86_64): ANDROID_ARCHITECTURE = x86_64
|
2013-03-04 09:16:42 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, mips): ANDROID_ARCHITECTURE = mips
|
2014-10-30 12:03:00 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, mips64): ANDROID_ARCHITECTURE = mips64
|
|
|
|
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): ANDROID_ARCHITECTURE = arm64
|
2013-03-04 09:16:42 +00:00
|
|
|
else: ANDROID_ARCHITECTURE = arm
|
|
|
|
|
|
|
|
!equals(NDK_TOOLCHAIN_VERSION, 4.4.3): ANDROID_CXXSTL_SUFFIX = -$$NDK_TOOLCHAIN_VERSION
|
|
|
|
|
|
|
|
NDK_TOOLCHAIN = $$NDK_TOOLCHAIN_PREFIX-$$NDK_TOOLCHAIN_VERSION
|
|
|
|
NDK_TOOLCHAIN_PATH = $$NDK_ROOT/toolchains/$$NDK_TOOLCHAIN/prebuilt/$$NDK_HOST
|
|
|
|
|
2014-07-29 13:13:57 +00:00
|
|
|
|
|
|
|
ANDROID_SDK_ROOT = $$(ANDROID_SDK_ROOT)
|
|
|
|
isEmpty(ANDROID_SDK_ROOT): ANDROID_SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT
|
|
|
|
|
|
|
|
ANDROID_SDK_BUILD_TOOLS_REVISION = $$(ANDROID_BUILD_TOOLS_REVISION)
|
|
|
|
isEmpty(ANDROID_SDK_BUILD_TOOLS_REVISION) {
|
|
|
|
SDK_BUILD_TOOLS_REVISIONS = $$files($$ANDROID_SDK_ROOT/build-tools/*)
|
|
|
|
for (REVISION, SDK_BUILD_TOOLS_REVISIONS) {
|
|
|
|
BASENAME = $$basename(REVISION)
|
|
|
|
greaterThan(BASENAME, $$ANDROID_SDK_BUILD_TOOLS_REVISION): ANDROID_SDK_BUILD_TOOLS_REVISION = $$BASENAME
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
CONFIG += $$ANDROID_PLATFORM
|
|
|
|
ANDROID_PLATFORM_ROOT_PATH = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/
|
|
|
|
ANDROID_PLATFORM_PATH = $$ANDROID_PLATFORM_ROOT_PATH/usr
|
|
|
|
|
|
|
|
# used to compile platform plugins for android-4 and android-5
|
2014-10-22 07:19:23 +00:00
|
|
|
QMAKE_ANDROID_PLATFORM_INCDIR = $$ANDROID_PLATFORM_PATH/include
|
|
|
|
QMAKE_ANDROID_PLATFORM_LIBDIR = $$ANDROID_PLATFORM_PATH/lib
|
2013-03-04 09:16:42 +00:00
|
|
|
|
|
|
|
ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH
|
|
|
|
ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
|
|
|
|
|
2014-10-30 12:03:00 +00:00
|
|
|
equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \
|
|
|
|
QMAKE_ANDROID_PLATFORM_LIBDIR = $${QMAKE_ANDROID_PLATFORM_LIBDIR}64
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
# modifications to g++.conf
|
|
|
|
QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
|
|
|
|
|
2016-05-30 15:43:10 +00:00
|
|
|
# -fstack-protector-strong offers good protection against stack smashing attacks.
|
|
|
|
# It is (currently) enabled only on Android because we know for sure that Andoroid compilers supports it
|
|
|
|
QMAKE_CFLAGS = -fstack-protector-strong -DANDROID
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
2016-05-30 15:43:10 +00:00
|
|
|
QMAKE_CFLAGS += -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove
|
2013-03-04 09:16:42 +00:00
|
|
|
else: equals(ANDROID_TARGET_ARCH, armeabi): \
|
2016-05-30 15:43:10 +00:00
|
|
|
QMAKE_CFLAGS += -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-builtin-memmove
|
|
|
|
|
|
|
|
# -fno-builtin-memmove is used to workaround https://code.google.com/p/android/issues/detail?id=81692
|
2013-03-04 09:16:42 +00:00
|
|
|
|
|
|
|
QMAKE_CFLAGS_WARN_ON = -Wall -Wno-psabi -W
|
|
|
|
QMAKE_CFLAGS_WARN_OFF = -Wno-psabi
|
|
|
|
equals(ANDROID_TARGET_ARCH, x86) {
|
|
|
|
QMAKE_CFLAGS_RELEASE = -O2
|
2014-10-30 12:03:00 +00:00
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
|
|
|
QMAKE_CFLAGS_DEBUG = -g
|
|
|
|
} else: equals(ANDROID_TARGET_ARCH, x86_64) {
|
|
|
|
QMAKE_CFLAGS_RELEASE = -O2
|
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
|
|
|
QMAKE_CFLAGS_DEBUG = -g
|
2013-03-04 09:16:42 +00:00
|
|
|
} else: equals(ANDROID_TARGET_ARCH, mips) {
|
|
|
|
QMAKE_CFLAGS_RELEASE = -O2
|
2014-10-30 12:03:00 +00:00
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
2016-05-30 15:43:10 +00:00
|
|
|
QMAKE_CFLAGS_DEBUG = -g
|
2014-10-30 12:03:00 +00:00
|
|
|
} else: equals(ANDROID_TARGET_ARCH, mips64) {
|
|
|
|
QMAKE_CFLAGS_RELEASE = -O2
|
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
2016-05-30 15:43:10 +00:00
|
|
|
QMAKE_CFLAGS_DEBUG = -g
|
2014-10-30 12:03:00 +00:00
|
|
|
} else: equals(ANDROID_TARGET_ARCH, arm64-v8a) {
|
|
|
|
QMAKE_CFLAGS_RELEASE = -O2
|
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
2016-05-30 15:43:10 +00:00
|
|
|
QMAKE_CFLAGS_DEBUG = -g
|
2013-03-04 09:16:42 +00:00
|
|
|
} else { # arm
|
2016-05-30 15:43:10 +00:00
|
|
|
QMAKE_CFLAGS_RELEASE = -Os
|
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
|
|
|
|
QMAKE_CFLAGS_DEBUG = -g -marm -O0
|
2015-03-17 13:58:01 +00:00
|
|
|
equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) {
|
2013-08-14 11:22:25 +00:00
|
|
|
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND
|
2014-03-10 13:31:25 +00:00
|
|
|
} else {
|
|
|
|
QMAKE_CFLAGS_RELEASE += -mthumb
|
|
|
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -mthumb
|
|
|
|
}
|
2013-03-04 09:16:42 +00:00
|
|
|
}
|
|
|
|
|
2016-05-30 15:43:10 +00:00
|
|
|
# Don't override our options with -O3
|
|
|
|
QMAKE_CFLAGS_OPTIMIZE_FULL =
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
QMAKE_CFLAGS_SHLIB = -fPIC
|
|
|
|
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
|
|
|
|
QMAKE_CFLAGS_THREAD = -D_REENTRANT
|
|
|
|
QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
|
|
|
|
|
|
|
|
QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
|
2014-10-30 12:03:00 +00:00
|
|
|
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=c++11
|
2013-03-04 09:16:42 +00:00
|
|
|
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
|
|
|
|
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
|
|
|
|
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
|
|
|
|
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
|
|
|
|
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
|
|
|
|
|
|
|
|
# modifications to linux.conf
|
|
|
|
QMAKE_AR = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ar cqs
|
|
|
|
QMAKE_OBJCOPY = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-objcopy
|
2013-04-22 21:22:09 +00:00
|
|
|
QMAKE_NM = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-nm -P
|
2013-03-04 09:16:42 +00:00
|
|
|
|
|
|
|
QMAKE_STRIP =
|
|
|
|
#$$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip
|
|
|
|
|
|
|
|
QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
|
|
|
|
|
2014-10-30 12:03:00 +00:00
|
|
|
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
2013-03-04 09:16:42 +00:00
|
|
|
LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -mthumb-interwork -print-libgcc-file-name")
|
2014-10-30 12:03:00 +00:00
|
|
|
else: \
|
|
|
|
LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -print-libgcc-file-name")
|
2013-03-04 09:16:42 +00:00
|
|
|
|
|
|
|
LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL)
|
|
|
|
|
2016-05-25 09:22:21 +00:00
|
|
|
QMAKE_INCDIR = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR
|
|
|
|
QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH
|
|
|
|
QMAKE_INCDIR_X11 =
|
|
|
|
QMAKE_LIBDIR_X11 =
|
|
|
|
QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR
|
|
|
|
QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
QMAKE_LINK = $$QMAKE_CXX
|
|
|
|
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
|
|
|
QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
|
2014-10-22 07:19:23 +00:00
|
|
|
QMAKE_RPATHLINK = $$QMAKE_ANDROID_PLATFORM_LIBDIR
|
2013-03-04 09:16:42 +00:00
|
|
|
QMAKE_LFLAGS_APP = -Wl,--no-undefined -Wl,-z,noexecstack -shared
|
|
|
|
QMAKE_LFLAGS_SHLIB = -Wl,--no-undefined -Wl,-z,noexecstack -shared
|
|
|
|
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
|
2013-03-19 01:57:31 +00:00
|
|
|
QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
|
|
|
|
QMAKE_LFLAGS_RPATH = -Wl,-rpath=
|
|
|
|
QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link=
|
2013-03-04 09:16:42 +00:00
|
|
|
|
2013-10-15 10:26:24 +00:00
|
|
|
QMAKE_LIBS_PRIVATE = -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
|
2013-03-04 09:16:42 +00:00
|
|
|
QMAKE_LIBS_X11 =
|
|
|
|
QMAKE_LIBS_THREAD =
|
|
|
|
QMAKE_LIBS_EGL = -lEGL
|
|
|
|
QMAKE_LIBS_OPENGL =
|
2013-04-23 15:07:01 +00:00
|
|
|
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
2013-03-04 09:16:42 +00:00
|
|
|
|
2013-08-28 13:09:08 +00:00
|
|
|
!exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
|
|
|
|
|
2013-03-04 09:16:42 +00:00
|
|
|
load(qt_config)
|
2015-01-30 13:30:59 +00:00
|
|
|
|
|
|
|
QMAKE_DEFAULT_LIBDIRS = $$QMAKE_LIBDIR
|
|
|
|
QMAKE_DEFAULT_INCDIRS = $$QMAKE_INCDIR
|