forked from organicmaps/organicmaps
[android] Switched to C++11
This commit is contained in:
parent
bf315c3208
commit
81923eab14
4 changed files with 136 additions and 5 deletions
|
@ -129,11 +129,11 @@ endif
|
|||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
#LOCAL_CPP_FEATURES += exceptions rtti
|
||||
LOCAL_CPP_FEATURES += exceptions rtti
|
||||
|
||||
LOCAL_MODULE := mapswithme
|
||||
LOCAL_STATIC_LIBRARIES := stats_client map gui routing search storage indexer graphics platform anim geometry coding base expat freetype fribidi zlib bzip2 jansson tomcrypt protobuf
|
||||
LOCAL_CFLAGS := -ffunction-sections -fdata-sections -Wno-psabi
|
||||
LOCAL_CFLAGS := -ffunction-sections -fdata-sections -Wno-psabi -Wno-extern-c-compat
|
||||
|
||||
ifneq ($(NDK_DEBUG),1)
|
||||
ifeq ($(PRODUCTION),1)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
NDK_TOOLCHAIN_VERSION := 4.6
|
||||
NDK_TOOLCHAIN_VERSION := clang
|
||||
APP_PLATFORM := android-5
|
||||
APP_STL := c++_static
|
||||
|
||||
ifeq (x$(NDK_ABI_TO_BUILD), x)
|
||||
APP_ABI := armeabi armeabi-v7a-hard x86
|
||||
|
@ -7,7 +8,6 @@ else
|
|||
APP_ABI := $(NDK_ABI_TO_BUILD)
|
||||
endif
|
||||
|
||||
APP_STL := gnustl_static
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
APP_CFLAGS += -I$(LOCAL_PATH)/../../3party/boost \
|
||||
-I$(LOCAL_PATH)/../../3party/protobuf/src
|
||||
|
|
|
@ -14,7 +14,7 @@ CONFIGURATION="$1"
|
|||
source "$MY_PATH/build.sh"
|
||||
source "$MY_PATH/ndk_helper.sh"
|
||||
|
||||
MKSPEC="$MY_PATH/../mkspecs/android-g++"
|
||||
MKSPEC="$MY_PATH/../mkspecs/android-clang"
|
||||
QMAKE_PARAMS="CONFIG+=${CONFIGURATION}"
|
||||
SHADOW_DIR_BASE="$MY_PATH/../../../omim-android"
|
||||
|
||||
|
|
131
tools/mkspecs/android-clang/qmake.conf
Normal file
131
tools/mkspecs/android-clang/qmake.conf
Normal file
|
@ -0,0 +1,131 @@
|
|||
# NDK_ROOT should be defined for qmake
|
||||
# NDK_HOST should be defined for qmake
|
||||
# NDK_ABI optionally can be defined to armeabi, armeabi-v7a, mips or x86, by default armeabi will be used
|
||||
# NDK_PLATFORM should be android-5 or higher
|
||||
|
||||
#########################################################################
|
||||
|
||||
ANDROID_TARGET_ABI = $$(NDK_ABI)
|
||||
# by default use armv5 architecture
|
||||
isEmpty( ANDROID_TARGET_ABI ): ANDROID_TARGET_ABI = armeabi
|
||||
|
||||
ANDROID_PLATFORM = $$(NDK_PLATFORM)
|
||||
# by default use android-5 platform
|
||||
isEmpty( ANDROID_PLATFORM ): ANDROID_PLATFORM = android-5
|
||||
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
QMAKE_COMPILER = $$(NDK_ROOT)/toolchains/llvm-3.4/prebuilt/$$(NDK_HOST)/bin/clang
|
||||
QMAKE_CC = $$QMAKE_COMPILER
|
||||
QMAKE_CXX = $$(NDK_ROOT)/toolchains/llvm-3.4/prebuilt/$$(NDK_HOST)/bin/clang++
|
||||
QMAKE_LINK_C = $$QMAKE_CC
|
||||
QMAKE_LINK_C_SHLIB = $$QMAKE_CC
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
||||
|
||||
QMAKE_CFLAGS_RELEASE *= -O3 -g -DNDEBUG -DRELEASE -D_RELEASE
|
||||
QMAKE_CXXFLAGS_RELEASE *= $$QMAKE_CFLAGS_RELEASE
|
||||
QMAKE_CFLAGS_DEBUG *= -O0 -g -DDEBUG -D_DEBUG
|
||||
QMAKE_CXXFLAGS_DEBUG *= $$QMAKE_CFLAGS_DEBUG
|
||||
|
||||
BASE_CXX_INCLUDE_PATH = $$(NDK_ROOT)/sources/cxx-stl/llvm-libc++
|
||||
|
||||
# Customizations for each arch
|
||||
contains(ANDROID_TARGET_ABI, x86) {
|
||||
# x86 toolchain
|
||||
GCC_TOOLCHAIN = $$(NDK_ROOT)/toolchains/x86-4.8/prebuilt/$$(NDK_HOST)
|
||||
GCC_TARGET = i686-none-linux-android
|
||||
QMAKE_CFLAGS *= -ffunction-sections -funwind-tables -fstack-protector -fPIC -no-canonical-prefixes -fomit-frame-pointer -fstrict-aliasing
|
||||
# NOTE: x86 works only from android-9 and above!
|
||||
contains(ANDROID_PLATFORM, android-5) : ANDROID_PLATFORM = android-9
|
||||
contains(ANDROID_PLATFORM, android-8) : ANDROID_PLATFORM = android-9
|
||||
|
||||
PLATFORM_INCLUDE_PATH = $$(NDK_ROOT)/platforms/$$ANDROID_PLATFORM/arch-x86/usr/include
|
||||
ABI_INCLUDE_PATH = $$BASE_CXX_INCLUDE_PATH/../gabi++/include
|
||||
AR_FULL_PATH = $$(NDK_ROOT)/toolchains/x86-4.8/prebuilt/$$(NDK_HOST)/bin/i686-linux-android-ar
|
||||
|
||||
} else {
|
||||
|
||||
contains(ANDROID_TARGET_ABI, mips) {
|
||||
# mips toolchain
|
||||
GCC_TOOLCHAIN = $$(NDK_ROOT)/toolchains/mipsel-linux-android-4.8/prebuilt/$$(NDK_HOST)
|
||||
GCC_TARGET = mipsel-none-linux-android
|
||||
QMAKE_CFLAGS *= -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -no-canonical-prefixes -fomit-frame-pointer
|
||||
# NOTE: mips works only from android-9 and above!
|
||||
contains(ANDROID_PLATFORM, android-5) : ANDROID_PLATFORM = android-9
|
||||
contains(ANDROID_PLATFORM, android-8) : ANDROID_PLATFORM = android-9
|
||||
|
||||
PLATFORM_INCLUDE_PATH = $$(NDK_ROOT)/platforms/$$ANDROID_PLATFORM/arch-mips/usr/include
|
||||
ABI_INCLUDE_PATH = $$BASE_CXX_INCLUDE_PATH/../gabi++/include
|
||||
AR_FULL_PATH = $$(NDK_ROOT)/toolchains/mipsel-linux-android-4.8/prebuilt/$$(NDK_HOST)/bin/mipsel-linux-android-ar
|
||||
|
||||
} else {
|
||||
# armeabi or armeabi-v7a or armeabi-v7a-hard toolchains
|
||||
GCC_TOOLCHAIN = $$(NDK_ROOT)/toolchains/arm-linux-androideabi-4.8/prebuilt/$$(NDK_HOST)
|
||||
QMAKE_CFLAGS *= -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -mthumb -fomit-frame-pointer -fno-strict-aliasing
|
||||
|
||||
PLATFORM_INCLUDE_PATH = $$(NDK_ROOT)/platforms/$$ANDROID_PLATFORM/arch-arm/usr/include
|
||||
ABI_INCLUDE_PATH = $$BASE_CXX_INCLUDE_PATH/../llvm-libc++abi/libcxxabi/include
|
||||
AR_FULL_PATH = $$(NDK_ROOT)/toolchains/arm-linux-androideabi-4.8/prebuilt/$$(NDK_HOST)/bin/arm-linux-androideabi-ar
|
||||
|
||||
contains(ANDROID_TARGET_ABI, armeabi-v7a-hard) {
|
||||
GCC_TARGET = armv7-none-linux-androideabi
|
||||
QMAKE_CFLAGS *= -march=armv7-a -mfpu=vfpv3-d16 -mhard-float -D_NDK_MATH_NO_SOFTFP=1
|
||||
|
||||
} else {
|
||||
contains(ANDROID_TARGET_ABI, armeabi-v7a) {
|
||||
GCC_TARGET = armv7-none-linux-androideabi
|
||||
QMAKE_CFLAGS *= -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
|
||||
|
||||
} else {
|
||||
# armeabi (the oldest one) arch
|
||||
GCC_TARGET = armv5te-none-linux-androideabi
|
||||
QMAKE_CFLAGS *= -march=armv5te -mtune=xscale -msoft-float
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS *= -DANDROID -gcc-toolchain $$GCC_TOOLCHAIN -target $$GCC_TARGET
|
||||
QMAKE_CFLAGS *= -Wa,--noexecstack -Wformat -Werror=format-security
|
||||
# to avoid warning: empty struct has size 0 in C, size 1 in C++ in struct lconv {};
|
||||
# in android-ndk/platforms/android-5/arch-arm/usr/include/locale.h
|
||||
QMAKE_CFLAGS *= -Wno-extern-c-compat
|
||||
|
||||
QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS -std=c++11 -fexceptions -frtti
|
||||
|
||||
CONFIG *= $$ANDROID_PLATFORM hide_symbols warn_on dwarf2
|
||||
|
||||
QMAKE_CFLAGS_WARN_ON = -Wall -W
|
||||
QMAKE_CFLAGS_WARN_OFF =
|
||||
QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
|
||||
QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
|
||||
|
||||
# modifications to linux.conf
|
||||
QMAKE_AR = $$AR_FULL_PATH cqsD
|
||||
|
||||
QMAKE_INCDIR = $$BASE_CXX_INCLUDE_PATH/libcxx/include
|
||||
QMAKE_INCDIR *= $$BASE_CXX_INCLUDE_PATH/../../android/support/include
|
||||
QMAKE_INCDIR *= $$ABI_INCLUDE_PATH
|
||||
QMAKE_INCDIR *= $$PLATFORM_INCLUDE_PATH
|
||||
|
||||
#QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$ANDROID_PLATFORM_PATH/lib
|
||||
|
||||
QMAKE_TAR = tar -cf
|
||||
QMAKE_GZIP = gzip -9f
|
||||
|
||||
QMAKE_COPY = cp -f
|
||||
QMAKE_COPY_FILE = $(COPY)
|
||||
QMAKE_COPY_DIR = $(COPY) -r
|
||||
QMAKE_MOVE = mv -f
|
||||
QMAKE_DEL_FILE = rm -f
|
||||
QMAKE_DEL_DIR = rmdir
|
||||
QMAKE_STRIP = strip
|
||||
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
|
||||
QMAKE_CHK_DIR_EXISTS = test -d
|
||||
QMAKE_MKDIR = mkdir -p
|
||||
|
||||
QMAKE_PREFIX_SHLIB = lib
|
||||
QMAKE_PREFIX_STATICLIB = lib
|
||||
QMAKE_EXTENSION_STATICLIB = a
|
||||
|
||||
load(qt_config)
|
Loading…
Add table
Reference in a new issue