Android: Add support for clang compiler
[ChangeLog][Android] Added support for clang compiler Task-number: QTBUG-50724 Change-Id: I6147021b814fcb230d125c4450c554a7fea8f31e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
2b9b9a38e7
commit
68f22d84ab
17
configure
vendored
17
configure
vendored
@ -3016,7 +3016,10 @@ case "$XPLATFORM" in
|
||||
*unsupported*)
|
||||
;;
|
||||
*android-g++*)
|
||||
XPLATFORM_ANDROID=yes
|
||||
XPLATFORM_ANDROID=g++
|
||||
;;
|
||||
*android-clang*)
|
||||
XPLATFORM_ANDROID=clang
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -3220,7 +3223,7 @@ if ( [ "$CFG_XCB" = "system" ] || [ "$CFG_XCB" = "qt" ] ) && [ "$CFG_XKBCOMMON"
|
||||
exit 101
|
||||
fi
|
||||
|
||||
if [ "$XPLATFORM_ANDROID" = "yes" ]; then
|
||||
if [ "$XPLATFORM_ANDROID" != "no" ]; then
|
||||
if [ "$CFG_DBUS" = "auto" ]; then
|
||||
CFG_DBUS="no"
|
||||
fi
|
||||
@ -3444,7 +3447,7 @@ QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`
|
||||
|
||||
TEST_COMPILER=$QMAKE_CONF_COMPILER
|
||||
|
||||
if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
|
||||
if [ "$XPLATFORM_ANDROID" != "no" ] ; then
|
||||
ANDROID_NDK_TOOLCHAIN_PREFIX=
|
||||
ANDROID_NDK_TOOLS_PREFIX=
|
||||
ANDROID_PLATFORM_ARCH=
|
||||
@ -3484,7 +3487,11 @@ if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
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++
|
||||
if [ "$XPLATFORM_ANDROID" = "g++" ] ; then
|
||||
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++
|
||||
else
|
||||
QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/clang++
|
||||
fi
|
||||
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
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets"
|
||||
@ -4586,7 +4593,7 @@ elif [ "$CFG_ARCH" != "mips" ]; then
|
||||
fi
|
||||
|
||||
[ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
|
||||
[ "$XPLATFORM_ANDROID" = "yes" ] && QMakeVar add styles "android"
|
||||
[ "$XPLATFORM_ANDROID" != "no" ] && QMakeVar add styles "android"
|
||||
|
||||
# check IPC support
|
||||
if ! compileTest unix/ipc_sysv "ipc_sysv" ; then
|
||||
|
32
mkspecs/android-clang/qmake.conf
Normal file
32
mkspecs/android-clang/qmake.conf
Normal file
@ -0,0 +1,32 @@
|
||||
# qmake configuration for building with android-g++
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
QMAKE_PLATFORM = android
|
||||
QMAKE_COMPILER = gcc clang llvm
|
||||
|
||||
CONFIG += android_install unversioned_soname unversioned_libname android_deployment_settings
|
||||
|
||||
include(../common/linux.conf)
|
||||
include(../common/clang.conf)
|
||||
include(../common/android-base-head.conf)
|
||||
|
||||
NDK_LLVM_PATH = $$NDK_ROOT/toolchains/llvm/prebuilt/$$NDK_HOST
|
||||
QMAKE_CC = $$NDK_LLVM_PATH/bin/clang
|
||||
QMAKE_CXX = $$NDK_LLVM_PATH/bin/clang++
|
||||
QMAKE_GCC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
QMAKE_CFLAGS = -target armv7-none-linux-androideabi
|
||||
else: equals(ANDROID_TARGET_ARCH, armeabi): \
|
||||
QMAKE_CFLAGS = -target armv5te-none-linux-androideabi
|
||||
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): \
|
||||
QMAKE_CFLAGS = -target aarch64-none-linux-android
|
||||
else: equals(ANDROID_TARGET_ARCH, x86): \
|
||||
QMAKE_CFLAGS = -target i686-none-linux-android
|
||||
else: equals(ANDROID_TARGET_ARCH, x86_64): \
|
||||
QMAKE_CFLAGS = -target x86_64-none-linux-android
|
||||
else: equals(ANDROID_TARGET_ARCH, mips): \
|
||||
QMAKE_CFLAGS += -target mipsel-none-linux-android
|
||||
else: equals(ANDROID_TARGET_ARCH, mips64): \
|
||||
QMAKE_CFLAGS = -target mips64el-none-linux-android
|
||||
|
||||
include(../common/android-base-tail.conf)
|
176
mkspecs/android-clang/qplatformdefs.h
Normal file
176
mkspecs/android-clang/qplatformdefs.h
Normal file
@ -0,0 +1,176 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the qmake spec of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** 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 The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QPLATFORMDEFS_H
|
||||
#define QPLATFORMDEFS_H
|
||||
|
||||
#define QT_QPA_DEFAULT_PLATFORM_NAME "android"
|
||||
|
||||
// Get Qt defines/settings
|
||||
|
||||
#include "qglobal.h"
|
||||
|
||||
// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
|
||||
|
||||
// 1) need to reset default environment if _BSD_SOURCE is defined
|
||||
// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
|
||||
// 3) it seems older glibc need this to include the X/Open stuff
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
// We are hot - unistd.h should have turned on the specific APIs we requested
|
||||
|
||||
#include <features.h>
|
||||
#include <pthread.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifndef QT_NO_IPV6IFNAME
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#ifdef QT_LARGEFILE_SUPPORT
|
||||
#define QT_STATBUF struct stat64
|
||||
#define QT_STATBUF4TSTAT struct stat64
|
||||
#define QT_STAT ::stat64
|
||||
#define QT_FSTAT ::fstat64
|
||||
#define QT_LSTAT ::lstat64
|
||||
#define QT_OPEN ::open64
|
||||
#define QT_TRUNCATE ::truncate64
|
||||
#define QT_FTRUNCATE ::ftruncate64
|
||||
#define QT_LSEEK ::lseek64
|
||||
#else
|
||||
#define QT_STATBUF struct stat
|
||||
#define QT_STATBUF4TSTAT struct stat
|
||||
#define QT_STAT ::stat
|
||||
#define QT_FSTAT ::fstat
|
||||
#define QT_LSTAT ::lstat
|
||||
#define QT_OPEN ::open
|
||||
#define QT_TRUNCATE ::truncate
|
||||
#define QT_FTRUNCATE ::ftruncate
|
||||
#define QT_LSEEK ::lseek
|
||||
#endif
|
||||
|
||||
#ifdef QT_LARGEFILE_SUPPORT
|
||||
#define QT_FOPEN ::fopen64
|
||||
#define QT_FSEEK ::fseeko64
|
||||
#define QT_FTELL ::ftello64
|
||||
#define QT_FGETPOS ::fgetpos64
|
||||
#define QT_FSETPOS ::fsetpos64
|
||||
#define QT_MMAP ::mmap64
|
||||
#define QT_FPOS_T fpos64_t
|
||||
#define QT_OFF_T off64_t
|
||||
#else
|
||||
#define QT_FOPEN ::fopen
|
||||
#define QT_FSEEK ::fseek
|
||||
#define QT_FTELL ::ftell
|
||||
#define QT_FGETPOS ::fgetpos
|
||||
#define QT_FSETPOS ::fsetpos
|
||||
#define QT_MMAP ::mmap
|
||||
#define QT_FPOS_T fpos_t
|
||||
#define QT_OFF_T long
|
||||
#endif
|
||||
|
||||
#define QT_STAT_REG S_IFREG
|
||||
#define QT_STAT_DIR S_IFDIR
|
||||
#define QT_STAT_MASK S_IFMT
|
||||
#define QT_STAT_LNK S_IFLNK
|
||||
#define QT_SOCKET_CONNECT ::connect
|
||||
#define QT_SOCKET_BIND ::bind
|
||||
#define QT_FILENO fileno
|
||||
#define QT_CLOSE ::close
|
||||
#define QT_READ ::read
|
||||
#define QT_WRITE ::write
|
||||
#define QT_ACCESS ::access
|
||||
#define QT_GETCWD ::getcwd
|
||||
#define QT_CHDIR ::chdir
|
||||
#define QT_MKDIR ::mkdir
|
||||
#define QT_RMDIR ::rmdir
|
||||
#define QT_OPEN_LARGEFILE O_LARGEFILE
|
||||
#define QT_OPEN_RDONLY O_RDONLY
|
||||
#define QT_OPEN_WRONLY O_WRONLY
|
||||
#define QT_OPEN_RDWR O_RDWR
|
||||
#define QT_OPEN_CREAT O_CREAT
|
||||
#define QT_OPEN_TRUNC O_TRUNC
|
||||
#define QT_OPEN_APPEND O_APPEND
|
||||
|
||||
// Directory iteration
|
||||
#define QT_DIR DIR
|
||||
|
||||
#define QT_OPENDIR ::opendir
|
||||
#define QT_CLOSEDIR ::closedir
|
||||
|
||||
#if defined(QT_LARGEFILE_SUPPORT) \
|
||||
&& defined(QT_USE_XOPEN_LFS_EXTENSIONS) \
|
||||
&& !defined(QT_NO_READDIR64)
|
||||
#define QT_DIRENT struct dirent64
|
||||
#define QT_READDIR ::readdir64
|
||||
#define QT_READDIR_R ::readdir64_r
|
||||
#else
|
||||
#define QT_DIRENT struct dirent
|
||||
#define QT_READDIR ::readdir
|
||||
#define QT_READDIR_R ::readdir_r
|
||||
#endif
|
||||
|
||||
#define QT_SOCKET_CONNECT ::connect
|
||||
#define QT_SOCKET_BIND ::bind
|
||||
|
||||
|
||||
#define QT_SIGNAL_RETTYPE void
|
||||
#define QT_SIGNAL_ARGS int
|
||||
#define QT_SIGNAL_IGNORE SIG_IGN
|
||||
|
||||
#define QT_SOCKLEN_T socklen_t
|
||||
|
||||
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
|
||||
#define QT_SNPRINTF ::snprintf
|
||||
#define QT_VSNPRINTF ::vsnprintf
|
||||
#endif
|
||||
|
||||
#endif // QPLATFORMDEFS_H
|
@ -7,201 +7,12 @@ CONFIG += android_install unversioned_soname unversioned_libname
|
||||
|
||||
include(../common/linux.conf)
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/android-base-head.conf)
|
||||
|
||||
load(device_config)
|
||||
|
||||
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
|
||||
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, 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
|
||||
}
|
||||
|
||||
NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX)
|
||||
isEmpty(NDK_TOOLS_PREFIX) {
|
||||
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, 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
|
||||
}
|
||||
|
||||
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
|
||||
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, mips64): ANDROID_ARCHITECTURE = mips64
|
||||
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): ANDROID_ARCHITECTURE = arm64
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
QMAKE_ANDROID_PLATFORM_INCDIR = $$ANDROID_PLATFORM_PATH/include
|
||||
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_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
|
||||
QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
|
||||
|
||||
# -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
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
QMAKE_CFLAGS += -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove
|
||||
else: equals(ANDROID_TARGET_ARCH, armeabi): \
|
||||
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
|
||||
|
||||
QMAKE_CFLAGS_WARN_ON = -Wall -Wno-psabi -W
|
||||
QMAKE_CFLAGS_WARN_OFF = -Wno-psabi
|
||||
equals(ANDROID_TARGET_ARCH, x86) {
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
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
|
||||
} else: equals(ANDROID_TARGET_ARCH, mips) {
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
||||
QMAKE_CFLAGS_DEBUG = -g
|
||||
} else: equals(ANDROID_TARGET_ARCH, mips64) {
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
||||
QMAKE_CFLAGS_DEBUG = -g
|
||||
} else: equals(ANDROID_TARGET_ARCH, arm64-v8a) {
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
||||
QMAKE_CFLAGS_DEBUG = -g
|
||||
} else { # arm
|
||||
QMAKE_CFLAGS_RELEASE = -Os
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
|
||||
QMAKE_CFLAGS_DEBUG = -g -marm -O0
|
||||
equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) {
|
||||
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND
|
||||
} else {
|
||||
QMAKE_CFLAGS_RELEASE += -mthumb
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -mthumb
|
||||
}
|
||||
}
|
||||
|
||||
# Don't override our options with -O3
|
||||
QMAKE_CFLAGS_OPTIMIZE_FULL =
|
||||
|
||||
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++
|
||||
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=c++11
|
||||
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_GCC = $$QMAKE_CXX
|
||||
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_LINK
|
||||
QMAKE_CFLAGS =
|
||||
|
||||
# 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
|
||||
QMAKE_NM = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-nm -P
|
||||
|
||||
QMAKE_STRIP =
|
||||
#$$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip
|
||||
|
||||
QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
||||
QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
|
||||
QMAKE_RPATHLINK = $$QMAKE_ANDROID_PLATFORM_LIBDIR
|
||||
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
|
||||
QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
|
||||
QMAKE_LFLAGS_RPATH = -Wl,-rpath=
|
||||
QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link=
|
||||
|
||||
QMAKE_LIBS_PRIVATE = -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
|
||||
QMAKE_LIBS_X11 =
|
||||
QMAKE_LIBS_THREAD =
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL =
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
|
||||
!exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
|
||||
|
||||
load(qt_config)
|
||||
|
||||
QMAKE_DEFAULT_LIBDIRS = $$QMAKE_LIBDIR
|
||||
QMAKE_DEFAULT_INCDIRS = $$QMAKE_INCDIR
|
||||
include(../common/android-base-tail.conf)
|
||||
|
78
mkspecs/common/android-base-head.conf
Normal file
78
mkspecs/common/android-base-head.conf
Normal file
@ -0,0 +1,78 @@
|
||||
load(device_config)
|
||||
|
||||
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
|
||||
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, 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
|
||||
}
|
||||
|
||||
NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX)
|
||||
isEmpty(NDK_TOOLS_PREFIX) {
|
||||
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, 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
|
||||
}
|
||||
|
||||
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
|
||||
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, mips64): ANDROID_ARCHITECTURE = mips64
|
||||
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): ANDROID_ARCHITECTURE = arm64
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
QMAKE_ANDROID_PLATFORM_INCDIR = $$ANDROID_PLATFORM_PATH/include
|
||||
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_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
|
||||
|
105
mkspecs/common/android-base-tail.conf
Normal file
105
mkspecs/common/android-base-tail.conf
Normal file
@ -0,0 +1,105 @@
|
||||
# -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
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
QMAKE_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove
|
||||
else: equals(ANDROID_TARGET_ARCH, armeabi): \
|
||||
QMAKE_CFLAGS += -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
|
||||
|
||||
QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
|
||||
QMAKE_CFLAGS_WARN_ON = -Wall -W
|
||||
QMAKE_CFLAGS_WARN_OFF =
|
||||
equals(ANDROID_TARGET_ARCH, armeabi-v7a) | equals(ANDROID_TARGET_ARCH, armeabi) {
|
||||
QMAKE_CFLAGS_RELEASE = -Os
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
|
||||
QMAKE_CFLAGS_DEBUG = -g -marm -O0
|
||||
equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) {
|
||||
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND
|
||||
} else {
|
||||
QMAKE_CFLAGS_RELEASE += -mthumb
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -mthumb
|
||||
}
|
||||
|
||||
# Don't override our options with -O3
|
||||
QMAKE_CFLAGS_OPTIMIZE_FULL =
|
||||
} else {
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
|
||||
QMAKE_CFLAGS_DEBUG = -g
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS_SHLIB = -fPIC
|
||||
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
|
||||
QMAKE_CFLAGS_THREAD = -D_REENTRANT
|
||||
QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
|
||||
QMAKE_CFLAGS_NEON = -mfpu=neon
|
||||
|
||||
QMAKE_CXXFLAGS_CXX11 = -std=c++11
|
||||
QMAKE_CXXFLAGS_CXX14 = -std=c++14
|
||||
QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
|
||||
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
|
||||
QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++14
|
||||
QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
|
||||
|
||||
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_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
|
||||
|
||||
# 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
|
||||
QMAKE_NM = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-nm -P
|
||||
|
||||
QMAKE_STRIP =
|
||||
#$$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip
|
||||
|
||||
QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
LIBGCC_PATH_FULL = $$system("$$QMAKE_GCC -mthumb-interwork -print-libgcc-file-name")
|
||||
else: \
|
||||
LIBGCC_PATH_FULL = $$system("$$QMAKE_GCC -print-libgcc-file-name")
|
||||
|
||||
LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL)
|
||||
|
||||
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
|
||||
|
||||
QMAKE_LINK = $$QMAKE_GCC
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_GCC
|
||||
QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
|
||||
QMAKE_RPATHLINK = $$QMAKE_ANDROID_PLATFORM_LIBDIR
|
||||
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
|
||||
QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
|
||||
QMAKE_LFLAGS_RPATH = -Wl,-rpath=
|
||||
QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link=
|
||||
|
||||
QMAKE_LIBS_PRIVATE = -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
|
||||
QMAKE_LIBS_X11 =
|
||||
QMAKE_LIBS_THREAD =
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL =
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
|
||||
|
||||
!exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
|
||||
|
||||
load(qt_config)
|
||||
|
||||
QMAKE_DEFAULT_LIBDIRS = $$QMAKE_LIBDIR
|
||||
QMAKE_DEFAULT_INCDIRS = $$QMAKE_INCDIR
|
Loading…
Reference in New Issue
Block a user