Android: Initial support for arm64-v8a, x86_64, mips64 architectures.

The new default compler is gcc 4.9, it is needed to compile
64 architectures.

Change-Id: I7ccbac7615b6dc20f5b0441908590de7d4a2e8cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
This commit is contained in:
BogDan Vatra 2014-10-30 14:03:00 +02:00 committed by Jędrzej Nowacki
parent 34cab65e8d
commit 6d2e28b59d
3 changed files with 65 additions and 18 deletions

28
configure vendored
View File

@ -784,7 +784,7 @@ CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
CFG_DEFAULT_ANDROID_PLATFORM=android-9 CFG_DEFAULT_ANDROID_PLATFORM=android-9
CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.8 CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.9
CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -2598,7 +2598,8 @@ Android options:
-android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.)
(default \$ANDROID_NDK_HOST) (default \$ANDROID_NDK_HOST)
-android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips) -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips,
arm64-v8a, x86_64, mips64)
(default $CFG_DEFAULT_ANDROID_TARGET_ARCH) (default $CFG_DEFAULT_ANDROID_TARGET_ARCH)
-android-toolchain-version ..... Sets the android toolchain version -android-toolchain-version ..... Sets the android toolchain version
@ -3202,27 +3203,46 @@ QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`
TEST_COMPILER=$QMAKE_CONF_COMPILER TEST_COMPILER=$QMAKE_CONF_COMPILER
if [ "$XPLATFORM_ANDROID" = "yes" ] ; then if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
ANDROID_NDK_TOOLCHAIN_PREFIX=
ANDROID_NDK_TOOLS_PREFIX= ANDROID_NDK_TOOLS_PREFIX=
ANDROID_PLATFORM_ARCH= ANDROID_PLATFORM_ARCH=
case $CFG_DEFAULT_ANDROID_TARGET_ARCH in case $CFG_DEFAULT_ANDROID_TARGET_ARCH in
armeabi*) armeabi*)
ANDROID_NDK_TOOLS_PREFIX=arm-linux-androideabi ANDROID_NDK_TOOLS_PREFIX=arm-linux-androideabi
ANDROID_NDK_TOOLCHAIN_PREFIX=arm-linux-androideabi
ANDROID_PLATFORM_ARCH=arch-arm ANDROID_PLATFORM_ARCH=arch-arm
;; ;;
x86) x86)
ANDROID_NDK_TOOLS_PREFIX=x86 ANDROID_NDK_TOOLS_PREFIX=i686-linux-android
ANDROID_NDK_TOOLCHAIN_PREFIX=x86
ANDROID_PLATFORM_ARCH=arch-x86 ANDROID_PLATFORM_ARCH=arch-x86
;; ;;
mips) mips)
ANDROID_NDK_TOOLS_PREFIX=mipsel-linux-android ANDROID_NDK_TOOLS_PREFIX=mipsel-linux-android
ANDROID_NDK_TOOLCHAIN_PREFIX=mipsel-linux-android
ANDROID_PLATFORM_ARCH=arch-mips ANDROID_PLATFORM_ARCH=arch-mips
;; ;;
arm64-v8a)
ANDROID_NDK_TOOLS_PREFIX=aarch64-linux-android
ANDROID_NDK_TOOLCHAIN_PREFIX=aarch64-linux-android
ANDROID_PLATFORM_ARCH=arch-arm64
;;
mips64)
ANDROID_NDK_TOOLS_PREFIX=mips64el-linux-android
ANDROID_NDK_TOOLCHAIN_PREFIX=mips64el-linux-android
ANDROID_PLATFORM_ARCH=arch-mips64
;;
x86_64)
ANDROID_NDK_TOOLS_PREFIX=x86_64-linux-android
ANDROID_NDK_TOOLCHAIN_PREFIX=x86_64
ANDROID_PLATFORM_ARCH=arch-x86_64
;;
*) *)
echo "ERROR: Unknown android arch $CFG_DEFAULT_ANDROID_TARGET_ARCH" echo "ERROR: Unknown android arch $CFG_DEFAULT_ANDROID_TARGET_ARCH"
exit 1 exit 1
;; ;;
esac esac
QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLS_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++ QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLCHAIN_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++
TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/" TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/"
if [ "$CFG_ANDROID_STYLE_ASSETS" = "yes" ]; then if [ "$CFG_ANDROID_STYLE_ASSETS" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets" QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets"

View File

@ -51,14 +51,20 @@ isEmpty(ANDROID_TARGET_ARCH): ANDROID_TARGET_ARCH = $$DEFAULT_ANDROID_TARGET_ARC
NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX) NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX)
isEmpty(NDK_TOOLCHAIN_PREFIX) { isEmpty(NDK_TOOLCHAIN_PREFIX) {
equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86 equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86
else: equals(ANDROID_TARGET_ARCH, x86_64): NDK_TOOLCHAIN_PREFIX = x86_64
else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android
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
else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
} }
NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX) NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX)
isEmpty(NDK_TOOLS_PREFIX) { isEmpty(NDK_TOOLS_PREFIX) {
equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLS_PREFIX = i686-linux-android equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLS_PREFIX = i686-linux-android
else: equals(ANDROID_TARGET_ARCH, x86_64): NDK_TOOLS_PREFIX = x86_64-linux-android
else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLS_PREFIX = mipsel-linux-android else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLS_PREFIX = mipsel-linux-android
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
else: NDK_TOOLS_PREFIX = arm-linux-androideabi else: NDK_TOOLS_PREFIX = arm-linux-androideabi
} }
@ -66,7 +72,10 @@ NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION)
isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION
equals(ANDROID_TARGET_ARCH, x86): ANDROID_ARCHITECTURE = x86 equals(ANDROID_TARGET_ARCH, x86): ANDROID_ARCHITECTURE = x86
else: equals(ANDROID_TARGET_ARCH, x86_64): ANDROID_ARCHITECTURE = x86_64
else: equals(ANDROID_TARGET_ARCH, mips): ANDROID_ARCHITECTURE = mips else: equals(ANDROID_TARGET_ARCH, mips): ANDROID_ARCHITECTURE = mips
else: equals(ANDROID_TARGET_ARCH, mips64): ANDROID_ARCHITECTURE = mips64
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): ANDROID_ARCHITECTURE = arm64
else: ANDROID_ARCHITECTURE = arm else: ANDROID_ARCHITECTURE = arm
!equals(NDK_TOOLCHAIN_VERSION, 4.4.3): ANDROID_CXXSTL_SUFFIX = -$$NDK_TOOLCHAIN_VERSION !equals(NDK_TOOLCHAIN_VERSION, 4.4.3): ANDROID_CXXSTL_SUFFIX = -$$NDK_TOOLCHAIN_VERSION
@ -98,6 +107,9 @@ QMAKE_ANDROID_PLATFORM_LIBDIR = $$ANDROID_PLATFORM_PATH/lib
ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH 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 ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \
QMAKE_ANDROID_PLATFORM_LIBDIR = $${QMAKE_ANDROID_PLATFORM_LIBDIR}64
# modifications to g++.conf # modifications to g++.conf
QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
@ -105,25 +117,43 @@ equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
else: equals(ANDROID_TARGET_ARCH, armeabi): \ else: equals(ANDROID_TARGET_ARCH, armeabi): \
QMAKE_CFLAGS = -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack QMAKE_CFLAGS = -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): \
QMAKE_CFLAGS = -ffunction-sections -funwind-tables -fstack-protector -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
else: equals(ANDROID_TARGET_ARCH, x86): \ else: equals(ANDROID_TARGET_ARCH, x86): \
QMAKE_CFLAGS = -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack QMAKE_CFLAGS = -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
else: equals(ANDROID_TARGET_ARCH, x86_64): \
QMAKE_CFLAGS = -ffunction-sections -funwind-tables -fstack-protector -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
else: equals(ANDROID_TARGET_ARCH, mips): \ else: equals(ANDROID_TARGET_ARCH, mips): \
QMAKE_CFLAGS = -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -O2 -fomit-frame-pointer -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack QMAKE_CFLAGS = -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -O2 -fomit-frame-pointer -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
else: equals(ANDROID_TARGET_ARCH, mips64): \
QMAKE_CFLAGS = -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fomit-frame-pointer -funswitch-loops -finline-limit=300 -DANDROID -Werror -Wa,--noexecstack
QMAKE_CFLAGS_WARN_ON = -Wall -Wno-psabi -W QMAKE_CFLAGS_WARN_ON = -Wall -Wno-psabi -W
QMAKE_CFLAGS_WARN_OFF = -Wno-psabi QMAKE_CFLAGS_WARN_OFF = -Wno-psabi
equals(ANDROID_TARGET_ARCH, x86) { equals(ANDROID_TARGET_ARCH, x86) {
QMAKE_CFLAGS_RELEASE = -O2 QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -gdwarf-2 -O2 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
QMAKE_CFLAGS_DEBUG = -g -gdwarf-2 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
} else: equals(ANDROID_TARGET_ARCH, mips) { } else: equals(ANDROID_TARGET_ARCH, mips) {
QMAKE_CFLAGS_RELEASE = -O2 QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -gdwarf-2 -O2 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
QMAKE_CFLAGS_DEBUG = -g -gdwarf-2 -fno-omit-frame-pointer QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
} else: equals(ANDROID_TARGET_ARCH, mips64) {
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
} else: equals(ANDROID_TARGET_ARCH, arm64-v8a) {
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
} else { # arm } else { # arm
QMAKE_CFLAGS_RELEASE = -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 QMAKE_CFLAGS_RELEASE = -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -gdwarf-2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
QMAKE_CFLAGS_DEBUG = -g -gdwarf-2 -marm -O0 -fno-omit-frame-pointer QMAKE_CFLAGS_DEBUG = -g -marm -O0 -fno-omit-frame-pointer
equals(ANDROID_TARGET_ARCH, armeabi): equals(NDK_TOOLCHAIN_VERSION, 4.8) { equals(ANDROID_TARGET_ARCH, armeabi): equals(NDK_TOOLCHAIN_VERSION, 4.8) {
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND
} else { } else {
@ -138,7 +168,7 @@ QMAKE_CFLAGS_THREAD = -D_REENTRANT
QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++ QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=gnu++0x QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=c++11
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
@ -169,10 +199,10 @@ QMAKE_LIBDIR_X11 =
QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR
QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR
equals(ANDROID_TARGET_ARCH, x86)|equals(ANDROID_TARGET_ARCH, mips): \ equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -print-libgcc-file-name")
else: \
LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -mthumb-interwork -print-libgcc-file-name") LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -mthumb-interwork -print-libgcc-file-name")
else: \
LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -print-libgcc-file-name")
LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL) LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL)

View File

@ -63,6 +63,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -165,11 +166,7 @@
#define QT_SIGNAL_ARGS int #define QT_SIGNAL_ARGS int
#define QT_SIGNAL_IGNORE SIG_IGN #define QT_SIGNAL_IGNORE SIG_IGN
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
#define QT_SOCKLEN_T socklen_t #define QT_SOCKLEN_T socklen_t
#else
#define QT_SOCKLEN_T int
#endif
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
#define QT_SNPRINTF ::snprintf #define QT_SNPRINTF ::snprintf