android: update toolchain file to support ndk 10c

Toolchain update from https://github.com/taka-no-me/android-cmake/pull/23
This commit is contained in:
Bernhard Miklautz 2014-11-13 14:59:11 +01:00
parent 7300f5efdb
commit 884ff8fffd

View File

@ -85,10 +85,16 @@
# "armeabi-v7a with VFPV3" - same as armeabi-v7a, but # "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
# sets VFPV3 as floating-point unit (has 32 registers instead of 16). # sets VFPV3 as floating-point unit (has 32 registers instead of 16).
# "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP. # "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
# "arm64-v8a" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "x86" - matches to the NDK ABI with the same name. # "x86" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation. # See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "x86_64" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "mips" - matches to the NDK ABI with the same name. # "mips" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation. # See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "mips64" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# #
# ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for. # ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
# Option is read-only when standalone toolchain is used. # Option is read-only when standalone toolchain is used.
@ -181,13 +187,13 @@
# ANDROID and BUILD_ANDROID will be set to true, you may test any of these # ANDROID and BUILD_ANDROID will be set to true, you may test any of these
# variables to make necessary Android-specific configuration changes. # variables to make necessary Android-specific configuration changes.
# #
# Also ARMEABI or ARMEABI_V7A or X86 or MIPS will be set true, mutually # Also ARMEABI or ARMEABI_V7A or ARM64_V8A or X86 or X86_64 or MIPS or MIPS64 will be set true, mutually
# exclusive. NEON option will be set true if VFP is set to NEON. # exclusive. NEON option will be set true if VFP is set to NEON.
# #
# LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android # LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
# libraries will be installed. # libraries will be installed.
# Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be # Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME} # under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}
# (depending on the target ABI). This is convenient for Android packaging. # (depending on the target ABI). This is convenient for Android packaging.
# #
# Change Log: # Change Log:
@ -303,6 +309,9 @@
# [~] fix copying of shared STL # [~] fix copying of shared STL
# - April 2014 # - April 2014
# [+] updated for NDK r9d # [+] updated for NDK r9d
# - July 2014
# [+] updated for NDK r10
# [+] arm64_v8a, x86_64, mips64 toolchain support (experimental)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6.3 ) cmake_minimum_required( VERSION 2.6.3 )
@ -335,7 +344,7 @@ endif()
# rpath makes low sence for Android # rpath makes low sence for Android
set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." ) set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" ) set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS) if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
if( CMAKE_HOST_WIN32 ) if( CMAKE_HOST_WIN32 )
file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS ) file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@ -350,12 +359,18 @@ if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
endif() endif()
set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" ) set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
set( ANDROID_SUPPORTED_ABIS_x86 "x86" ) set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
set( ANDROID_SUPPORTED_ABIS_mipsel "mips" ) set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
set( ANDROID_SUPPORTED_ABIS_mips64el "mips64" )
set( ANDROID_DEFAULT_NDK_API_LEVEL 9 ) set( ANDROID_DEFAULT_NDK_API_LEVEL 9 )
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 ) set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 ) set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 "L" )
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 "L" )
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 "L" )
macro( __LIST_FILTER listvar regex ) macro( __LIST_FILTER listvar regex )
@ -609,6 +624,9 @@ if( BUILD_WITH_ANDROID_NDK )
# try to detect change of NDK # try to detect change of NDK
if( CMAKE_AR ) if( CMAKE_AR )
string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length ) string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length )
message("${CMAKE_AR}")
message("${__length}")
message("${ANDROID_NDK_TOOLCHAINS_PATH}")
string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath ) string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK_TOOLCHAINS_PATH ) if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK_TOOLCHAINS_PATH )
message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first. message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first.
@ -659,10 +677,16 @@ macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst _
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" ) string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
if( __machine MATCHES i686 ) if( __machine MATCHES i686 )
set( __arch "x86" ) set( __arch "x86" )
elseif( __machine MATCHES x86_64 )
set( __arch "x86_64" )
elseif( __machine MATCHES arm ) elseif( __machine MATCHES arm )
set( __arch "arm" ) set( __arch "arm" )
elseif( __machine MATCHES aarch64 )
set( __arch "arm64" )
elseif( __machine MATCHES mipsel ) elseif( __machine MATCHES mipsel )
set( __arch "mipsel" ) set( __arch "mipsel" )
elseif( __machine MATCHES mips64el )
set( __arch "mips64el" )
endif() endif()
list( APPEND __availableToolchainMachines "${__machine}" ) list( APPEND __availableToolchainMachines "${__machine}" )
list( APPEND __availableToolchainArchs "${__arch}" ) list( APPEND __availableToolchainArchs "${__arch}" )
@ -746,6 +770,13 @@ if( ANDROID_ABI STREQUAL "x86" )
set( ANDROID_ARCH_FULLNAME "x86" ) set( ANDROID_ARCH_FULLNAME "x86" )
set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" ) set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "i686" ) set( CMAKE_SYSTEM_PROCESSOR "i686" )
elseif( ANDROID_ABI STREQUAL "x86_64" )
set( X86_64 true )
set( ANDROID_NDK_ABI_NAME "x86_64" )
set( ANDROID_ARCH_NAME "x86_64" )
set( ANDROID_ARCH_FULLNAME "x86_64" )
set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
elseif( ANDROID_ABI STREQUAL "mips" ) elseif( ANDROID_ABI STREQUAL "mips" )
set( MIPS true ) set( MIPS true )
set( ANDROID_NDK_ABI_NAME "mips" ) set( ANDROID_NDK_ABI_NAME "mips" )
@ -753,6 +784,13 @@ elseif( ANDROID_ABI STREQUAL "mips" )
set( ANDROID_ARCH_FULLNAME "mipsel" ) set( ANDROID_ARCH_FULLNAME "mipsel" )
set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" ) set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "mips" ) set( CMAKE_SYSTEM_PROCESSOR "mips" )
elseif( ANDROID_ABI STREQUAL "mips64" )
set( MIPS64 true )
set( ANDROID_NDK_ABI_NAME "mips64" )
set( ANDROID_ARCH_NAME "mips64" )
set( ANDROID_ARCH_FULLNAME "mips64el" )
set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "mips64" )
elseif( ANDROID_ABI STREQUAL "armeabi" ) elseif( ANDROID_ABI STREQUAL "armeabi" )
set( ARMEABI true ) set( ARMEABI true )
set( ANDROID_NDK_ABI_NAME "armeabi" ) set( ANDROID_NDK_ABI_NAME "armeabi" )
@ -793,10 +831,25 @@ elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" ) set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
set( VFPV3 true ) set( VFPV3 true )
set( NEON true ) set( NEON true )
elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
set( ARM64_V8A true )
set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
set( ANDROID_ARCH_NAME "arm64" )
set( ANDROID_ARCH_FULLNAME "arm64" )
set( ANDROID_LLVM_TRIPLE "armv8-none-linux-androideabi" )
set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
set( VFPV3 true )
set( NEON true )
else() else()
message( SEND_ERROR "Unknown ANDROID_ABI=\"${ANDROID_ABI}\" is specified." ) message( SEND_ERROR "Unknown ANDROID_ABI=\"${ANDROID_ABI}\" is specified." )
endif() endif()
if( X86_64 )
set( ANDROID_NDK_OUTPUT_ABI_NAME "x86-64" )
else()
set( ANDROID_NDK_OUTPUT_ABI_NAME ${ANDROID_NDK_ABI_NAME} )
endif()
if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" ) if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" )
# really dirty hack # really dirty hack
# it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run... # it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run...
@ -862,38 +915,40 @@ unset( __availableToolchainCompilerVersions )
# choose native API level # choose native API level
__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL ) __INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" ) if( NOT ANDROID_NATIVE_API_LEVEL STREQUAL "L" )
# adjust API level string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} ) # adjust API level
foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} ) set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level ) foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
set( __real_api_level ${__level} ) if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
endif() set( __real_api_level ${__level} )
endforeach() endif()
if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level ) endforeach()
message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'") if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} ) message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
endif() set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
unset(__real_api_level) endif()
# validate unset(__real_api_level)
list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx ) # validate
if( __levelIdx EQUAL -1 ) list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
message( SEND_ERROR "Specified Android native API level 'android-${ANDROID_NATIVE_API_LEVEL}' is not supported by your NDK/toolchain." ) if( __levelIdx EQUAL -1 )
else() message( SEND_ERROR "Specified Android native API level 'android-${ANDROID_NATIVE_API_LEVEL}' is not supported by your NDK/toolchain." )
if( BUILD_WITH_ANDROID_NDK ) else()
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" ) if( BUILD_WITH_ANDROID_NDK )
if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL ) __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." ) if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
endif()
unset( __realApiLevel )
endif()
set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
if( CMAKE_VERSION VERSION_GREATER "2.8" )
list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
endif()
endif() endif()
unset( __realApiLevel ) unset( __levelIdx )
endif()
set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
if( CMAKE_VERSION VERSION_GREATER "2.8" )
list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
endif()
endif() endif()
unset( __levelIdx )
# remember target ABI # remember target ABI
@ -1214,7 +1269,11 @@ if( ANDROID_COMPILER_IS_CLANG )
set( CMAKE_C_COMPILER_ID Clang) set( CMAKE_C_COMPILER_ID Clang)
endif() endif()
set( CMAKE_C_PLATFORM_ID Linux ) set( CMAKE_C_PLATFORM_ID Linux )
set( CMAKE_C_SIZEOF_DATA_PTR 4 ) if( ARM64_V8A OR X86_64 OR MIPS64 )
set( CMAKE_C_SIZEOF_DATA_PTR 8 )
else()
set( CMAKE_C_SIZEOF_DATA_PTR 4 )
endif()
set( CMAKE_C_HAS_ISYSROOT 1 ) set( CMAKE_C_HAS_ISYSROOT 1 )
set( CMAKE_C_COMPILER_ABI ELF ) set( CMAKE_C_COMPILER_ABI ELF )
CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU ) CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
@ -1222,7 +1281,11 @@ if( ANDROID_COMPILER_IS_CLANG )
set( CMAKE_CXX_COMPILER_ID Clang) set( CMAKE_CXX_COMPILER_ID Clang)
endif() endif()
set( CMAKE_CXX_PLATFORM_ID Linux ) set( CMAKE_CXX_PLATFORM_ID Linux )
set( CMAKE_CXX_SIZEOF_DATA_PTR 4 ) if( ARM64_V8A OR X86_64 OR MIPS64 )
set( CMAKE_CXX_SIZEOF_DATA_PTR 8 )
else()
set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
endif()
set( CMAKE_CXX_HAS_ISYSROOT 1 ) set( CMAKE_CXX_HAS_ISYSROOT 1 )
set( CMAKE_CXX_COMPILER_ABI ELF ) set( CMAKE_CXX_COMPILER_ABI ELF )
set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C ) set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
@ -1279,7 +1342,7 @@ if( ARMEABI OR ARMEABI_V7A )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" ) set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
endif() endif()
endif() endif()
elseif( X86 ) elseif( X86 OR X86_64 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" ) set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
if( NOT ANDROID_COMPILER_IS_CLANG ) if( NOT ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" ) set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
@ -1288,7 +1351,7 @@ elseif( X86 )
endif() endif()
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" ) set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer -fno-strict-aliasing" ) set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer -fno-strict-aliasing" )
elseif( MIPS ) elseif( MIPS OR MIPS64 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" ) set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" ) set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer" ) set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer" )
@ -1325,6 +1388,8 @@ elseif( ARMEABI_V6 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" ) # vfp == vfpv2 set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" ) # vfp == vfpv2
elseif( ARMEABI ) elseif( ARMEABI )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" ) set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
elseif( ARM64_V8A )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv8-a" )
endif() endif()
if( ANDROID_STL MATCHES "gnustl" AND (EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}") ) if( ANDROID_STL MATCHES "gnustl" AND (EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}") )
@ -1558,11 +1623,11 @@ set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path fo
if(NOT _CMAKE_IN_TRY_COMPILE) if(NOT _CMAKE_IN_TRY_COMPILE)
if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" ) if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" ) set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "Output directory for applications" )
else() else()
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" ) set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
endif() endif()
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" ) set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "path for android libs" )
endif() endif()
# copy shaed stl library to build directory # copy shaed stl library to build directory
@ -1639,10 +1704,16 @@ macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR )
set( ${VAR} "armeabi" ) set( ${VAR} "armeabi" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" ) elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
set( ${VAR} "armeabi-v7a" ) set( ${VAR} "armeabi-v7a" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARM64_V8A" )
set( ${VAR} "arm64-v8a" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" ) elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
set( ${VAR} "x86" ) set( ${VAR} "x86" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86_64" )
set( ${VAR} "x86_64" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" ) elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" )
set( ${VAR} "mips" ) set( ${VAR} "mips" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS64" )
set( ${VAR} "mips64" )
else() else()
set( ${VAR} "unknown" ) set( ${VAR} "unknown" )
endif() endif()
@ -1709,7 +1780,7 @@ endif()
# Variables controlling behavior or set by cmake toolchain: # Variables controlling behavior or set by cmake toolchain:
# ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips" # ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "arm64-v8a", "x86", "x86_64", "mips", "mips64"
# ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version) # ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
# ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none # ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
# ANDROID_FORBID_SYGWIN : ON/OFF # ANDROID_FORBID_SYGWIN : ON/OFF
@ -1743,16 +1814,19 @@ endif()
# ARMEABI : TRUE for arm v6 and older devices # ARMEABI : TRUE for arm v6 and older devices
# ARMEABI_V6 : TRUE for arm v6 # ARMEABI_V6 : TRUE for arm v6
# ARMEABI_V7A : TRUE for arm v7a # ARMEABI_V7A : TRUE for arm v7a
# ARM64_V8A : TRUE for arm64 v8a
# NEON : TRUE if NEON unit is enabled # NEON : TRUE if NEON unit is enabled
# VFPV3 : TRUE if VFP version 3 is enabled # VFPV3 : TRUE if VFP version 3 is enabled
# X86 : TRUE if configured for x86 # X86 : TRUE if configured for x86
# X86_64 : TRUE if configured for x86_64
# MIPS : TRUE if configured for mips # MIPS : TRUE if configured for mips
# MIPS64 : TRUE if configured for mips64
# BUILD_ANDROID : always TRUE # BUILD_ANDROID : always TRUE
# BUILD_WITH_ANDROID_NDK : TRUE if NDK is used # BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
# BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used # BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
# ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform # ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
# ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI # ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d; set only for NDK # ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d, r10; set only for NDK
# ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI # ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
# ANDROID_SYSROOT : path to the compiler sysroot # ANDROID_SYSROOT : path to the compiler sysroot
# TOOL_OS_SUFFIX : "" or ".exe" depending on host platform # TOOL_OS_SUFFIX : "" or ".exe" depending on host platform