From Rafa Gaitan, "I'm attaching also a new version of the toolchain with support for the r10c ndk. This fixes some CMake Warnings and allows to use the toolchain in macosx."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14558 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
e5f5c30e4d
commit
b7067ad988
@ -1,5 +1,5 @@
|
|||||||
# Copyright (c) 2010-2011, Ethan Rublee
|
# Copyright (c) 2010-2011, Ethan Rublee
|
||||||
# Copyright (c) 2011-2013, Andrey Kamaev
|
# Copyright (c) 2011-2014, Andrey Kamaev
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -12,9 +12,9 @@
|
|||||||
# this list of conditions and the following disclaimer in the documentation
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
# and/or other materials provided with the distribution.
|
# and/or other materials provided with the distribution.
|
||||||
#
|
#
|
||||||
# 3. The name of the copyright holders may be used to endorse or promote
|
# 3. Neither the name of the copyright holder nor the names of its
|
||||||
# products derived from this software without specific prior written
|
# contributors may be used to endorse or promote products derived from this
|
||||||
# permission.
|
# software without specific prior written permission.
|
||||||
#
|
#
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
@ -29,13 +29,10 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Android CMake toolchain file, for use with the Android NDK r5-r9
|
# Android CMake toolchain file, for use with the Android NDK r5-r10c
|
||||||
# Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
|
# Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
|
||||||
# See home page: https://github.com/taka-no-me/android-cmake
|
# See home page: https://github.com/taka-no-me/android-cmake
|
||||||
#
|
#
|
||||||
# The file is mantained by the OpenCV project. The latest version can be get at
|
|
||||||
# http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
|
|
||||||
#
|
|
||||||
# Usage Linux:
|
# Usage Linux:
|
||||||
# $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
|
# $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
|
||||||
# $ mkdir build && cd build
|
# $ mkdir build && cd build
|
||||||
@ -50,7 +47,7 @@
|
|||||||
#
|
#
|
||||||
# Usage Windows:
|
# Usage Windows:
|
||||||
# You need native port of make to build your project.
|
# You need native port of make to build your project.
|
||||||
# Android NDK r7 (or newer) already has make.exe on board.
|
# Android NDK r7 (and newer) already has make.exe on board.
|
||||||
# For older NDK you have to install it separately.
|
# For older NDK you have to install it separately.
|
||||||
# For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
|
# For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
|
||||||
#
|
#
|
||||||
@ -76,36 +73,54 @@
|
|||||||
# used by ndk-build tool from Android NDK.
|
# used by ndk-build tool from Android NDK.
|
||||||
#
|
#
|
||||||
# Possible targets are:
|
# Possible targets are:
|
||||||
# "armeabi" - matches to the NDK ABI with the same name.
|
# "armeabi" - ARMv5TE based CPU with software floating point operations
|
||||||
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
|
# "armeabi-v7a" - ARMv7 based devices with hardware FPU instructions
|
||||||
# "armeabi-v7a" - matches to the NDK ABI with the same name.
|
# this ABI target is used by default
|
||||||
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
|
|
||||||
# "armeabi-v7a with NEON" - same as armeabi-v7a, but
|
# "armeabi-v7a with NEON" - same as armeabi-v7a, but
|
||||||
# sets NEON as floating-point unit
|
# sets NEON as floating-point unit
|
||||||
# "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
|
||||||
# "x86" - matches to the NDK ABI with the same name.
|
# "x86" - IA-32 instruction set
|
||||||
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
|
# "mips" - MIPS32 instruction set
|
||||||
# "mips" - matches to the NDK ABI with the same name.
|
#
|
||||||
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
|
# 64-bit ABIs for NDK r10 and newer:
|
||||||
|
# "arm64-v8a" - ARMv8 AArch64 instruction set
|
||||||
|
# "x86_64" - Intel64 instruction set (r1)
|
||||||
|
# "mips64" - MIPS64 instruction set (r6)
|
||||||
#
|
#
|
||||||
# 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.
|
||||||
|
# Note: building for "android-L" requires explicit configuration.
|
||||||
#
|
#
|
||||||
# ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 - the name of compiler
|
# ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 - the name of compiler
|
||||||
# toolchain to be used. The list of possible values depends on the NDK
|
# toolchain to be used. The list of possible values depends on the NDK
|
||||||
# version. For NDK r8c the possible values are:
|
# version. For NDK r10c the possible values are:
|
||||||
#
|
#
|
||||||
# * arm-linux-androideabi-4.4.3
|
# * aarch64-linux-android-4.9
|
||||||
|
# * aarch64-linux-android-clang3.4
|
||||||
|
# * aarch64-linux-android-clang3.5
|
||||||
# * arm-linux-androideabi-4.6
|
# * arm-linux-androideabi-4.6
|
||||||
# * arm-linux-androideabi-clang3.1
|
# * arm-linux-androideabi-4.8
|
||||||
# * mipsel-linux-android-4.4.3
|
# * arm-linux-androideabi-4.9 (default)
|
||||||
|
# * arm-linux-androideabi-clang3.4
|
||||||
|
# * arm-linux-androideabi-clang3.5
|
||||||
|
# * mips64el-linux-android-4.9
|
||||||
|
# * mips64el-linux-android-clang3.4
|
||||||
|
# * mips64el-linux-android-clang3.5
|
||||||
# * mipsel-linux-android-4.6
|
# * mipsel-linux-android-4.6
|
||||||
# * mipsel-linux-android-clang3.1
|
# * mipsel-linux-android-4.8
|
||||||
# * x86-4.4.3
|
# * mipsel-linux-android-4.9
|
||||||
|
# * mipsel-linux-android-clang3.4
|
||||||
|
# * mipsel-linux-android-clang3.5
|
||||||
# * x86-4.6
|
# * x86-4.6
|
||||||
# * x86-clang3.1
|
# * x86-4.8
|
||||||
|
# * x86-4.9
|
||||||
|
# * x86-clang3.4
|
||||||
|
# * x86-clang3.5
|
||||||
|
# * x86_64-4.9
|
||||||
|
# * x86_64-clang3.4
|
||||||
|
# * x86_64-clang3.5
|
||||||
#
|
#
|
||||||
# ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
|
# ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
|
||||||
# instead of Thumb. Is not available for "x86" (inapplicable) and
|
# instead of Thumb. Is not available for "x86" (inapplicable) and
|
||||||
@ -181,8 +196,9 @@
|
|||||||
# 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 X86 or MIPS or ARM64_V8A or X86_64 or MIPS64
|
||||||
# exclusive. NEON option will be set true if VFP is set to NEON.
|
# will be set true, mutually 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.
|
||||||
@ -190,138 +206,49 @@
|
|||||||
# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
|
# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_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:
|
|
||||||
# - initial version December 2010
|
|
||||||
# - April 2011
|
|
||||||
# [+] added possibility to build with NDK (without standalone toolchain)
|
|
||||||
# [+] support cross-compilation on Windows (native, no cygwin support)
|
|
||||||
# [+] added compiler option to force "char" type to be signed
|
|
||||||
# [+] added toolchain option to compile to 32-bit ARM instructions
|
|
||||||
# [+] added toolchain option to disable SWIG search
|
|
||||||
# [+] added platform "armeabi-v7a with VFPV3"
|
|
||||||
# [~] ARM_TARGETS renamed to ARM_TARGET
|
|
||||||
# [+] EXECUTABLE_OUTPUT_PATH is set by toolchain (required on Windows)
|
|
||||||
# [~] Fixed bug with ANDROID_API_LEVEL variable
|
|
||||||
# [~] turn off SWIG search if it is not found first time
|
|
||||||
# - May 2011
|
|
||||||
# [~] ANDROID_LEVEL is renamed to ANDROID_API_LEVEL
|
|
||||||
# [+] ANDROID_API_LEVEL is detected by toolchain if not specified
|
|
||||||
# [~] added guard to prevent changing of output directories on the first
|
|
||||||
# cmake pass
|
|
||||||
# [~] toolchain exits with error if ARM_TARGET is not recognized
|
|
||||||
# - June 2011
|
|
||||||
# [~] default NDK path is updated for version r5c
|
|
||||||
# [+] variable CMAKE_SYSTEM_PROCESSOR is set based on ARM_TARGET
|
|
||||||
# [~] toolchain install directory is added to linker paths
|
|
||||||
# [-] removed SWIG-related stuff from toolchain
|
|
||||||
# [+] added macro find_host_package, find_host_program to search
|
|
||||||
# packages/programs on the host system
|
|
||||||
# [~] fixed path to STL library
|
|
||||||
# - July 2011
|
|
||||||
# [~] fixed options caching
|
|
||||||
# [~] search for all supported NDK versions
|
|
||||||
# [~] allowed spaces in NDK path
|
|
||||||
# - September 2011
|
|
||||||
# [~] updated for NDK r6b
|
|
||||||
# - November 2011
|
|
||||||
# [*] rewritten for NDK r7
|
|
||||||
# [+] x86 toolchain support (experimental)
|
|
||||||
# [+] added "armeabi-v6 with VFP" ABI for ARMv6 processors.
|
|
||||||
# [~] improved compiler and linker flags management
|
|
||||||
# [+] support different build flags for Release and Debug configurations
|
|
||||||
# [~] by default compiler flags the same as used by ndk-build (but only
|
|
||||||
# where reasonable)
|
|
||||||
# [~] ANDROID_NDK_TOOLCHAIN_ROOT is splitted to ANDROID_STANDALONE_TOOLCHAIN
|
|
||||||
# and ANDROID_TOOLCHAIN_ROOT
|
|
||||||
# [~] ARM_TARGET is renamed to ANDROID_ABI
|
|
||||||
# [~] ARMEABI_NDK_NAME is renamed to ANDROID_NDK_ABI_NAME
|
|
||||||
# [~] ANDROID_API_LEVEL is renamed to ANDROID_NATIVE_API_LEVEL
|
|
||||||
# - January 2012
|
|
||||||
# [+] added stlport_static support (experimental)
|
|
||||||
# [+] added special check for cygwin
|
|
||||||
# [+] filtered out hidden files (starting with .) while globbing inside NDK
|
|
||||||
# [+] automatically applied GLESv2 linkage fix for NDK revisions 5-6
|
|
||||||
# [+] added ANDROID_GET_ABI_RAWNAME to get NDK ABI names by CMake flags
|
|
||||||
# - February 2012
|
|
||||||
# [+] updated for NDK r7b
|
|
||||||
# [~] fixed cmake try_compile() command
|
|
||||||
# [~] Fix for missing install_name_tool on OS X
|
|
||||||
# - March 2012
|
|
||||||
# [~] fixed incorrect C compiler flags
|
|
||||||
# [~] fixed CMAKE_SYSTEM_PROCESSOR change on ANDROID_ABI change
|
|
||||||
# [+] improved toolchain loading speed
|
|
||||||
# [+] added assembler language support (.S)
|
|
||||||
# [+] allowed preset search paths and extra search suffixes
|
|
||||||
# - April 2012
|
|
||||||
# [+] updated for NDK r7c
|
|
||||||
# [~] fixed most of problems with compiler/linker flags and caching
|
|
||||||
# [+] added option ANDROID_FUNCTION_LEVEL_LINKING
|
|
||||||
# - May 2012
|
|
||||||
# [+] updated for NDK r8
|
|
||||||
# [+] added mips architecture support
|
|
||||||
# - August 2012
|
|
||||||
# [+] updated for NDK r8b
|
|
||||||
# [~] all intermediate files generated by toolchain are moved to CMakeFiles
|
|
||||||
# [~] libstdc++ and libsupc are removed from explicit link libraries
|
|
||||||
# [+] added CCache support (via NDK_CCACHE environment or cmake variable)
|
|
||||||
# [+] added gold linker support for NDK r8b
|
|
||||||
# [~] fixed mips linker flags for NDK r8b
|
|
||||||
# - September 2012
|
|
||||||
# [+] added NDK release name detection (see ANDROID_NDK_RELEASE)
|
|
||||||
# [+] added support for all C++ runtimes from NDK
|
|
||||||
# (system, gabi++, stlport, gnustl)
|
|
||||||
# [+] improved warnings on known issues of NDKs
|
|
||||||
# [~] use gold linker as default if available (NDK r8b)
|
|
||||||
# [~] globally turned off rpath
|
|
||||||
# [~] compiler options are aligned with NDK r8b
|
|
||||||
# - October 2012
|
|
||||||
# [~] fixed C++ linking: explicitly link with math library (OpenCV #2426)
|
|
||||||
# - November 2012
|
|
||||||
# [+] updated for NDK r8c
|
|
||||||
# [+] added support for clang compiler
|
|
||||||
# - December 2012
|
|
||||||
# [+] suppress warning about unused CMAKE_TOOLCHAIN_FILE variable
|
|
||||||
# [+] adjust API level to closest compatible as NDK does
|
|
||||||
# [~] fixed ccache full path search
|
|
||||||
# [+] updated for NDK r8d
|
|
||||||
# [~] compiler options are aligned with NDK r8d
|
|
||||||
# - March 2013
|
|
||||||
# [+] updated for NDK r8e (x86 version)
|
|
||||||
# [+] support x86_64 version of NDK
|
|
||||||
# - April 2013
|
|
||||||
# [+] support non-release NDK layouts (from Linaro git and Android git)
|
|
||||||
# [~] automatically detect if explicit link to crtbegin_*.o is needed
|
|
||||||
# - June 2013
|
|
||||||
# [~] fixed stl include path for standalone toolchain made by NDK >= r8c
|
|
||||||
# - July 2013
|
|
||||||
# [+] updated for NDK r9
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
|
||||||
|
|
||||||
cmake_minimum_required( VERSION 2.6.3 )
|
cmake_minimum_required( VERSION 2.6.3 )
|
||||||
|
|
||||||
|
# Urho3D: on Windows Cygwin-based NDK tools may fail in the linking phase with too long command line. Turn on response files to avoid this
|
||||||
|
if( CMAKE_HOST_WIN32 )
|
||||||
|
set( CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
|
||||||
|
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
|
||||||
|
endif()
|
||||||
|
|
||||||
if( DEFINED CMAKE_CROSSCOMPILING )
|
if( DEFINED CMAKE_CROSSCOMPILING )
|
||||||
# subsequent toolchain loading is not really needed
|
# subsequent toolchain loading is not really needed
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( CMAKE_TOOLCHAIN_FILE )
|
if( CMAKE_TOOLCHAIN_FILE )
|
||||||
# touch toolchain variable only to suppress "unused variable" warning
|
# touch toolchain variable to suppress "unused variable" warning
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# inherit settings in recursive loads
|
||||||
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
||||||
if( _CMAKE_IN_TRY_COMPILE )
|
if( _CMAKE_IN_TRY_COMPILE )
|
||||||
include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
|
include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# this one is important
|
# this one is important
|
||||||
set( CMAKE_SYSTEM_NAME Linux )
|
if( CMAKE_VERSION VERSION_GREATER "3.0.99" )
|
||||||
|
set( CMAKE_SYSTEM_NAME Android )
|
||||||
|
else()
|
||||||
|
set( CMAKE_SYSTEM_NAME Linux )
|
||||||
|
endif()
|
||||||
|
|
||||||
# this one not so much
|
# this one not so much
|
||||||
set( CMAKE_SYSTEM_VERSION 1 )
|
set( CMAKE_SYSTEM_VERSION 1 )
|
||||||
|
|
||||||
# rpath makes low sence for Android
|
# rpath makes low sence for Android
|
||||||
|
set( CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "" )
|
||||||
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} -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
# NDK search paths
|
||||||
|
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10c -r10b -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 )
|
||||||
@ -335,13 +262,22 @@ if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
|
|||||||
set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
|
set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# known ABIs
|
||||||
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_mipsel "mips" )
|
set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
|
||||||
|
set( ANDROID_SUPPORTED_ABIS_mips "mips" )
|
||||||
|
set( ANDROID_SUPPORTED_ABIS_mips64 "mips64" )
|
||||||
|
|
||||||
set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
|
# API level defaults
|
||||||
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
|
# Urho3D: default to API 12
|
||||||
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
|
set( ANDROID_DEFAULT_NDK_API_LEVEL 12 )
|
||||||
|
set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21 )
|
||||||
|
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 12)
|
||||||
|
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21 )
|
||||||
|
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 12 )
|
||||||
|
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21 )
|
||||||
|
|
||||||
|
|
||||||
macro( __LIST_FILTER listvar regex )
|
macro( __LIST_FILTER listvar regex )
|
||||||
@ -417,7 +353,7 @@ macro( __INIT_VARIABLE var_name )
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro( __DETECT_NATIVE_API_LEVEL _var _path )
|
macro( __DETECT_NATIVE_API_LEVEL _var _path )
|
||||||
SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*$" )
|
SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*.*$" )
|
||||||
FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
|
FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
|
||||||
if( NOT __apiFileContent )
|
if( NOT __apiFileContent )
|
||||||
message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
|
message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
|
||||||
@ -467,7 +403,7 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
# detect current host platform
|
# detect current host platform
|
||||||
if( NOT DEFINED ANDROID_NDK_HOST_X64 AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
|
if( NOT DEFINED ANDROID_NDK_HOST_X64 AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64" OR CMAKE_HOST_APPLE) )
|
||||||
set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
|
set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
|
||||||
mark_as_advanced( ANDROID_NDK_HOST_X64 )
|
mark_as_advanced( ANDROID_NDK_HOST_X64 )
|
||||||
endif()
|
endif()
|
||||||
@ -529,12 +465,15 @@ if( ANDROID_NDK )
|
|||||||
set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
|
set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
|
||||||
set( BUILD_WITH_ANDROID_NDK True )
|
set( BUILD_WITH_ANDROID_NDK True )
|
||||||
if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
|
if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
|
||||||
file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
|
file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX "r[0-9]+[a-z]?" )
|
||||||
string( REGEX MATCH r[0-9]+[a-z]? ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
|
string( REGEX MATCH "r([0-9]+)([a-z]?)" ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
|
||||||
else()
|
else()
|
||||||
set( ANDROID_NDK_RELEASE "r1x" )
|
set( ANDROID_NDK_RELEASE "r1x" )
|
||||||
set( ANDROID_NDK_RELEASE_FULL "unreleased" )
|
set( ANDROID_NDK_RELEASE_FULL "unreleased" )
|
||||||
endif()
|
endif()
|
||||||
|
string( REGEX REPLACE "r([0-9]+)([a-z]?)" "\\1*1000" ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE}" )
|
||||||
|
string( FIND " abcdefghijklmnopqastuvwxyz" "${CMAKE_MATCH_2}" __ndkReleaseLetterNum )
|
||||||
|
math( EXPR ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE_NUM}+${__ndkReleaseLetterNum}" )
|
||||||
elseif( ANDROID_STANDALONE_TOOLCHAIN )
|
elseif( ANDROID_STANDALONE_TOOLCHAIN )
|
||||||
get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
|
get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
|
||||||
# try to detect change
|
# try to detect change
|
||||||
@ -615,12 +554,18 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
|
|||||||
if( NOT __availableToolchainMachines )
|
if( NOT __availableToolchainMachines )
|
||||||
message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
|
message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
|
||||||
endif()
|
endif()
|
||||||
if( __availableToolchainMachines MATCHES i686 )
|
if( __availableToolchainMachines MATCHES x86_64 )
|
||||||
|
set( __availableToolchainArchs "x86_64" )
|
||||||
|
elseif( __availableToolchainMachines MATCHES i686 )
|
||||||
set( __availableToolchainArchs "x86" )
|
set( __availableToolchainArchs "x86" )
|
||||||
|
elseif( __availableToolchainMachines MATCHES aarch64 )
|
||||||
|
set( __availableToolchainArchs "arm64" )
|
||||||
elseif( __availableToolchainMachines MATCHES arm )
|
elseif( __availableToolchainMachines MATCHES arm )
|
||||||
set( __availableToolchainArchs "arm" )
|
set( __availableToolchainArchs "arm" )
|
||||||
|
elseif( __availableToolchainMachines MATCHES mips64el )
|
||||||
|
set( __availableToolchainArchs "mips64" )
|
||||||
elseif( __availableToolchainMachines MATCHES mipsel )
|
elseif( __availableToolchainMachines MATCHES mipsel )
|
||||||
set( __availableToolchainArchs "mipsel" )
|
set( __availableToolchainArchs "mips" )
|
||||||
endif()
|
endif()
|
||||||
execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
|
execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
|
||||||
OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
|
OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||||
@ -636,24 +581,44 @@ endif()
|
|||||||
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
|
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
|
||||||
foreach( __toolchain ${${__availableToolchainsLst}} )
|
foreach( __toolchain ${${__availableToolchainsLst}} )
|
||||||
if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
|
if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
|
||||||
string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
|
SET( __toolchainVersionRegex "^TOOLCHAIN_VERSION[\t ]+:=[\t ]+(.*)$" )
|
||||||
|
FILE( STRINGS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}/setup.mk" __toolchainVersionStr REGEX "${__toolchainVersionRegex}" )
|
||||||
|
if( __toolchainVersionStr )
|
||||||
|
string( REGEX REPLACE "${__toolchainVersionRegex}" "\\1" __toolchainVersionStr "${__toolchainVersionStr}" )
|
||||||
|
string( REGEX REPLACE "-clang3[.][0-9]$" "-${__toolchainVersionStr}" __gcc_toolchain "${__toolchain}" )
|
||||||
|
else()
|
||||||
|
string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
|
||||||
|
endif()
|
||||||
|
unset( __toolchainVersionStr )
|
||||||
|
unset( __toolchainVersionRegex )
|
||||||
else()
|
else()
|
||||||
set( __gcc_toolchain "${__toolchain}" )
|
set( __gcc_toolchain "${__toolchain}" )
|
||||||
endif()
|
endif()
|
||||||
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
|
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
|
||||||
if( __machine )
|
if( __machine )
|
||||||
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 x86_64 )
|
||||||
|
set( __arch "x86_64" )
|
||||||
|
elseif( __machine MATCHES i686 )
|
||||||
set( __arch "x86" )
|
set( __arch "x86" )
|
||||||
|
elseif( __machine MATCHES aarch64 )
|
||||||
|
set( __arch "arm64" )
|
||||||
elseif( __machine MATCHES arm )
|
elseif( __machine MATCHES arm )
|
||||||
set( __arch "arm" )
|
set( __arch "arm" )
|
||||||
|
elseif( __machine MATCHES mips64el )
|
||||||
|
set( __arch "mips64" )
|
||||||
elseif( __machine MATCHES mipsel )
|
elseif( __machine MATCHES mipsel )
|
||||||
set( __arch "mipsel" )
|
set( __arch "mips" )
|
||||||
|
else()
|
||||||
|
set( __arch "" )
|
||||||
|
endif()
|
||||||
|
#message("machine: !${__machine}!\narch: !${__arch}!\nversion: !${__version}!\ntoolchain: !${__toolchain}!\n")
|
||||||
|
if (__arch)
|
||||||
|
list( APPEND __availableToolchainMachines "${__machine}" )
|
||||||
|
list( APPEND __availableToolchainArchs "${__arch}" )
|
||||||
|
list( APPEND __availableToolchainCompilerVersions "${__version}" )
|
||||||
|
list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
|
||||||
endif()
|
endif()
|
||||||
list( APPEND __availableToolchainMachines "${__machine}" )
|
|
||||||
list( APPEND __availableToolchainArchs "${__arch}" )
|
|
||||||
list( APPEND __availableToolchainCompilerVersions "${__version}" )
|
|
||||||
list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
|
|
||||||
endif()
|
endif()
|
||||||
unset( __gcc_toolchain )
|
unset( __gcc_toolchain )
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -685,6 +650,7 @@ if( BUILD_WITH_ANDROID_NDK )
|
|||||||
endif()
|
endif()
|
||||||
__LIST_FILTER( __availableToolchainsLst "^[.]" )
|
__LIST_FILTER( __availableToolchainsLst "^[.]" )
|
||||||
__LIST_FILTER( __availableToolchainsLst "llvm" )
|
__LIST_FILTER( __availableToolchainsLst "llvm" )
|
||||||
|
__LIST_FILTER( __availableToolchainsLst "renderscript" )
|
||||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
|
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
|
||||||
if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
|
if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
|
||||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
|
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
|
||||||
@ -728,28 +694,45 @@ if( ANDROID_ABI STREQUAL "x86" )
|
|||||||
set( X86 true )
|
set( X86 true )
|
||||||
set( ANDROID_NDK_ABI_NAME "x86" )
|
set( ANDROID_NDK_ABI_NAME "x86" )
|
||||||
set( ANDROID_ARCH_NAME "x86" )
|
set( ANDROID_ARCH_NAME "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 true )
|
||||||
|
set( X86_64 true )
|
||||||
|
set( ANDROID_NDK_ABI_NAME "x86_64" )
|
||||||
|
set( ANDROID_ARCH_NAME "x86_64" )
|
||||||
|
set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
|
||||||
|
set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
|
||||||
|
elseif( ANDROID_ABI STREQUAL "mips64" )
|
||||||
|
set( MIPS64 true )
|
||||||
|
set( ANDROID_NDK_ABI_NAME "mips64" )
|
||||||
|
set( ANDROID_ARCH_NAME "mips64" )
|
||||||
|
set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
|
||||||
|
set( CMAKE_SYSTEM_PROCESSOR "mips64" )
|
||||||
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" )
|
||||||
set( ANDROID_ARCH_NAME "mips" )
|
set( ANDROID_ARCH_NAME "mips" )
|
||||||
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 "arm64-v8a" )
|
||||||
|
set( ARM64_V8A true )
|
||||||
|
set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
|
||||||
|
set( ANDROID_ARCH_NAME "arm64" )
|
||||||
|
set( ANDROID_LLVM_TRIPLE "aarch64-none-linux-android" )
|
||||||
|
set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
|
||||||
|
set( VFPV3 true )
|
||||||
|
set( NEON true )
|
||||||
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" )
|
||||||
set( ANDROID_ARCH_NAME "arm" )
|
set( ANDROID_ARCH_NAME "arm" )
|
||||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
|
||||||
set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
|
set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
|
||||||
set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
|
set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
|
||||||
elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
|
elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
|
||||||
set( ARMEABI_V6 true )
|
set( ARMEABI_V6 true )
|
||||||
set( ANDROID_NDK_ABI_NAME "armeabi" )
|
set( ANDROID_NDK_ABI_NAME "armeabi" )
|
||||||
set( ANDROID_ARCH_NAME "arm" )
|
set( ANDROID_ARCH_NAME "arm" )
|
||||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
|
||||||
set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
|
set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
|
||||||
set( CMAKE_SYSTEM_PROCESSOR "armv6" )
|
set( CMAKE_SYSTEM_PROCESSOR "armv6" )
|
||||||
# need always fallback to older platform
|
# need always fallback to older platform
|
||||||
@ -758,14 +741,12 @@ elseif( ANDROID_ABI STREQUAL "armeabi-v7a")
|
|||||||
set( ARMEABI_V7A true )
|
set( ARMEABI_V7A true )
|
||||||
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
||||||
set( ANDROID_ARCH_NAME "arm" )
|
set( ANDROID_ARCH_NAME "arm" )
|
||||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
|
||||||
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
||||||
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
||||||
elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
|
elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
|
||||||
set( ARMEABI_V7A true )
|
set( ARMEABI_V7A true )
|
||||||
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
||||||
set( ANDROID_ARCH_NAME "arm" )
|
set( ANDROID_ARCH_NAME "arm" )
|
||||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
|
||||||
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
||||||
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
||||||
set( VFPV3 true )
|
set( VFPV3 true )
|
||||||
@ -773,7 +754,6 @@ elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
|
|||||||
set( ARMEABI_V7A true )
|
set( ARMEABI_V7A true )
|
||||||
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
||||||
set( ANDROID_ARCH_NAME "arm" )
|
set( ANDROID_ARCH_NAME "arm" )
|
||||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
|
||||||
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
||||||
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
||||||
set( VFPV3 true )
|
set( VFPV3 true )
|
||||||
@ -807,7 +787,7 @@ if( ANDROID_TOOLCHAIN_NAME )
|
|||||||
To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
|
To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
|
||||||
endif()
|
endif()
|
||||||
list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
|
list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
|
||||||
if( NOT __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
|
if( NOT __toolchainArch STREQUAL ANDROID_ARCH_NAME )
|
||||||
message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
|
message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
@ -818,7 +798,7 @@ else()
|
|||||||
math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
|
math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
|
||||||
foreach( __idx RANGE ${__availableToolchainsCount} )
|
foreach( __idx RANGE ${__availableToolchainsCount} )
|
||||||
list( GET __availableToolchainArchs ${__idx} __toolchainArch )
|
list( GET __availableToolchainArchs ${__idx} __toolchainArch )
|
||||||
if( __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
|
if( __toolchainArch STREQUAL ANDROID_ARCH_NAME )
|
||||||
list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
|
list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
|
||||||
string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
|
string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
|
||||||
if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
|
if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
|
||||||
@ -847,15 +827,16 @@ 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}" )
|
string( REPLACE "android-" "" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
|
||||||
|
string( STRIP "${ANDROID_NATIVE_API_LEVEL}" ANDROID_NATIVE_API_LEVEL )
|
||||||
# adjust API level
|
# adjust API level
|
||||||
set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
|
set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
|
||||||
foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
|
foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
|
||||||
if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
|
if( (__level LESS ANDROID_NATIVE_API_LEVEL OR __level STREQUAL ANDROID_NATIVE_API_LEVEL) AND NOT __level LESS __real_api_level )
|
||||||
set( __real_api_level ${__level} )
|
set( __real_api_level ${__level} )
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
|
if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL STREQUAL __real_api_level )
|
||||||
message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
|
message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
|
||||||
set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
|
set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
|
||||||
endif()
|
endif()
|
||||||
@ -867,7 +848,7 @@ if( __levelIdx EQUAL -1 )
|
|||||||
else()
|
else()
|
||||||
if( BUILD_WITH_ANDROID_NDK )
|
if( BUILD_WITH_ANDROID_NDK )
|
||||||
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
|
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
|
||||||
if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
|
if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL AND NOT __realApiLevel GREATER 9000 )
|
||||||
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." )
|
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()
|
endif()
|
||||||
unset( __realApiLevel )
|
unset( __realApiLevel )
|
||||||
@ -884,8 +865,8 @@ unset( __levelIdx )
|
|||||||
# remember target ABI
|
# remember target ABI
|
||||||
set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
|
set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
|
||||||
if( CMAKE_VERSION VERSION_GREATER "2.8" )
|
if( CMAKE_VERSION VERSION_GREATER "2.8" )
|
||||||
list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
|
list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME} )
|
||||||
set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
|
set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME}} )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@ -1027,7 +1008,7 @@ if( "${ANDROID_TOOLCHAIN_NAME}" STREQUAL "standalone-clang" )
|
|||||||
string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
|
string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
|
||||||
elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
|
elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
|
||||||
string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
|
string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
|
||||||
string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
|
string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-${ANDROID_COMPILER_VERSION}" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
|
||||||
if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
|
if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
|
||||||
message( FATAL_ERROR "Could not find the Clang compiler driver" )
|
message( FATAL_ERROR "Could not find the Clang compiler driver" )
|
||||||
endif()
|
endif()
|
||||||
@ -1060,7 +1041,7 @@ if( BUILD_WITH_ANDROID_NDK )
|
|||||||
set( ANDROID_EXCEPTIONS ON )
|
set( ANDROID_EXCEPTIONS ON )
|
||||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
|
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
|
||||||
elseif( ANDROID_STL MATCHES "gabi" )
|
elseif( ANDROID_STL MATCHES "gabi" )
|
||||||
if( ANDROID_NDK_RELEASE STRLESS "r7" )
|
if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
|
||||||
message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
|
message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
|
||||||
endif()
|
endif()
|
||||||
set( ANDROID_RTTI ON )
|
set( ANDROID_RTTI ON )
|
||||||
@ -1068,12 +1049,12 @@ if( BUILD_WITH_ANDROID_NDK )
|
|||||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
|
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
|
||||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
|
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
|
||||||
elseif( ANDROID_STL MATCHES "stlport" )
|
elseif( ANDROID_STL MATCHES "stlport" )
|
||||||
if( NOT ANDROID_NDK_RELEASE STRLESS "r8d" )
|
if( NOT ANDROID_NDK_RELEASE_NUM LESS 8004 ) # before r8d
|
||||||
set( ANDROID_EXCEPTIONS ON )
|
set( ANDROID_EXCEPTIONS ON )
|
||||||
else()
|
else()
|
||||||
set( ANDROID_EXCEPTIONS OFF )
|
set( ANDROID_EXCEPTIONS OFF )
|
||||||
endif()
|
endif()
|
||||||
if( ANDROID_NDK_RELEASE STRLESS "r7" )
|
if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
|
||||||
set( ANDROID_RTTI OFF )
|
set( ANDROID_RTTI OFF )
|
||||||
else()
|
else()
|
||||||
set( ANDROID_RTTI ON )
|
set( ANDROID_RTTI ON )
|
||||||
@ -1132,15 +1113,7 @@ endif()
|
|||||||
# case of shared STL linkage
|
# case of shared STL linkage
|
||||||
if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
|
if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
|
||||||
string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
|
string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
|
||||||
if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
|
# TODO: check if .so file exists before the renaming
|
||||||
get_filename_component( __libstlname "${__libstl}" NAME )
|
|
||||||
execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
|
|
||||||
if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
|
|
||||||
message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
|
|
||||||
endif()
|
|
||||||
unset( __fileCopyProcess )
|
|
||||||
unset( __libstlname )
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@ -1207,7 +1180,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( X86_64 OR MIPS64 OR ARM64_V8A )
|
||||||
|
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 )
|
||||||
@ -1215,7 +1192,7 @@ 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 )
|
set( CMAKE_CXX_SIZEOF_DATA_PTR ${CMAKE_C_SIZEOF_DATA_PTR} )
|
||||||
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 )
|
||||||
@ -1256,7 +1233,14 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# NDK flags
|
# NDK flags
|
||||||
if( ARMEABI OR ARMEABI_V7A )
|
if (ARM64_V8A )
|
||||||
|
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -ffunction-sections -funwind-tables" )
|
||||||
|
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
|
||||||
|
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer -fno-strict-aliasing" )
|
||||||
|
if( NOT ANDROID_COMPILER_IS_CLANG )
|
||||||
|
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
|
||||||
|
endif()
|
||||||
|
elseif( ARMEABI OR ARMEABI_V7A)
|
||||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
|
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
|
||||||
if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
|
if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
|
||||||
set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
|
set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
|
||||||
@ -1272,7 +1256,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" )
|
||||||
@ -1281,7 +1265,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" )
|
||||||
@ -1360,7 +1344,7 @@ if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# variables controlling optional build flags
|
# variables controlling optional build flags
|
||||||
if (ANDROID_NDK_RELEASE STRLESS "r7")
|
if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
|
||||||
# libGLESv2.so in NDK's prior to r7 refers to missing external symbols.
|
# libGLESv2.so in NDK's prior to r7 refers to missing external symbols.
|
||||||
# So this flag option is required for all projects using OpenGL from native.
|
# So this flag option is required for all projects using OpenGL from native.
|
||||||
__INIT_VARIABLE( ANDROID_SO_UNDEFINED VALUES ON )
|
__INIT_VARIABLE( ANDROID_SO_UNDEFINED VALUES ON )
|
||||||
@ -1376,7 +1360,7 @@ __INIT_VARIABLE( ANDROID_RELRO VALUES ON )
|
|||||||
set( ANDROID_NO_UNDEFINED ${ANDROID_NO_UNDEFINED} CACHE BOOL "Show all undefined symbols as linker errors" )
|
set( ANDROID_NO_UNDEFINED ${ANDROID_NO_UNDEFINED} CACHE BOOL "Show all undefined symbols as linker errors" )
|
||||||
set( ANDROID_SO_UNDEFINED ${ANDROID_SO_UNDEFINED} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
|
set( ANDROID_SO_UNDEFINED ${ANDROID_SO_UNDEFINED} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
|
||||||
set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
|
set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
|
||||||
set( ANDROID_GOLD_LINKER ${ANDROID_GOLD_LINKER} CACHE BOOL "Enables gold linker (only avaialble for NDK r8b for ARM and x86 architectures on linux-86 and darwin-x86 hosts)" )
|
set( ANDROID_GOLD_LINKER ${ANDROID_GOLD_LINKER} CACHE BOOL "Enables gold linker" )
|
||||||
set( ANDROID_NOEXECSTACK ${ANDROID_NOEXECSTACK} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
|
set( ANDROID_NOEXECSTACK ${ANDROID_NOEXECSTACK} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
|
||||||
set( ANDROID_RELRO ${ANDROID_RELRO} CACHE BOOL "Enables RELRO - a memory corruption mitigation technique" )
|
set( ANDROID_RELRO ${ANDROID_RELRO} CACHE BOOL "Enables RELRO - a memory corruption mitigation technique" )
|
||||||
mark_as_advanced( ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_FUNCTION_LEVEL_LINKING ANDROID_GOLD_LINKER ANDROID_NOEXECSTACK ANDROID_RELRO )
|
mark_as_advanced( ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_FUNCTION_LEVEL_LINKING ANDROID_GOLD_LINKER ANDROID_NOEXECSTACK ANDROID_RELRO )
|
||||||
@ -1411,9 +1395,9 @@ if( ANDROID_FUNCTION_LEVEL_LINKING )
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
|
if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
|
||||||
if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE STRGREATER "r8b") AND (ARMEABI OR ARMEABI_V7A OR X86) )
|
if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE_NUM GREATER 8002) AND (ARMEABI OR ARMEABI_V7A OR X86) )
|
||||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
|
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
|
||||||
elseif( ANDROID_NDK_RELEASE STRGREATER "r8b")
|
elseif( ANDROID_NDK_RELEASE_NUM GREATER 8002 ) # after r8b
|
||||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
|
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
|
||||||
elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
|
elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
|
||||||
message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
|
message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
|
||||||
@ -1437,13 +1421,7 @@ if( ANDROID_RELRO )
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( ANDROID_COMPILER_IS_CLANG )
|
if( ANDROID_COMPILER_IS_CLANG )
|
||||||
set( ANDROID_CXX_FLAGS "-Qunused-arguments ${ANDROID_CXX_FLAGS}" )
|
set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" )
|
||||||
if( ARMEABI_V7A AND NOT ANDROID_FORCE_ARM_BUILD )
|
|
||||||
set( ANDROID_CXX_FLAGS_RELEASE "-target thumbv7-none-linux-androideabi ${ANDROID_CXX_FLAGS_RELEASE}" )
|
|
||||||
set( ANDROID_CXX_FLAGS_DEBUG "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS_DEBUG}" )
|
|
||||||
else()
|
|
||||||
set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
|
|
||||||
endif()
|
|
||||||
if( BUILD_WITH_ANDROID_NDK )
|
if( BUILD_WITH_ANDROID_NDK )
|
||||||
set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
|
set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
|
||||||
endif()
|
endif()
|
||||||
@ -1452,8 +1430,9 @@ endif()
|
|||||||
# cache flags
|
# cache flags
|
||||||
set( CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags" )
|
set( CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags" )
|
||||||
set( CMAKE_C_FLAGS "" CACHE STRING "c flags" )
|
set( CMAKE_C_FLAGS "" CACHE STRING "c flags" )
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "c++ Release flags" )
|
# Urho3D: optimise for size
|
||||||
set( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "c Release flags" )
|
set( CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG" CACHE STRING "c++ Release flags" )
|
||||||
|
set( CMAKE_C_FLAGS_RELEASE "-Os -DNDEBUG" CACHE STRING "c Release flags" )
|
||||||
set( CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c++ Debug flags" )
|
set( CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c++ Debug flags" )
|
||||||
set( CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c Debug flags" )
|
set( CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c Debug flags" )
|
||||||
set( CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared linker flags" )
|
set( CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared linker flags" )
|
||||||
@ -1505,7 +1484,8 @@ endif()
|
|||||||
|
|
||||||
# global includes and link directories
|
# global includes and link directories
|
||||||
include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
|
include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
|
||||||
link_directories( "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
|
get_filename_component(__android_install_path "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ABSOLUTE) # avoid CMP0015 policy warning
|
||||||
|
link_directories( "${__android_install_path}" )
|
||||||
|
|
||||||
# detect if need link crtbegin_so.o explicitly
|
# detect if need link crtbegin_so.o explicitly
|
||||||
if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
|
if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
|
||||||
@ -1554,9 +1534,22 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
|
|||||||
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" )
|
# Urho3D: All libraries are first generated in CMake default binary directory and only the main target library is later copied to below output path by Urho3D own build script
|
||||||
|
set( ANDROID_LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" FORCE )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# copy shaed stl library to build directory
|
||||||
|
if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
|
||||||
|
get_filename_component( __libstlname "${__libstl}" NAME )
|
||||||
|
execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
|
||||||
|
if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
|
||||||
|
message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
|
||||||
|
endif()
|
||||||
|
unset( __fileCopyProcess )
|
||||||
|
unset( __libstlname )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# set these global flags for cmake client scripts to change behavior
|
# set these global flags for cmake client scripts to change behavior
|
||||||
set( ANDROID True )
|
set( ANDROID True )
|
||||||
set( BUILD_ANDROID True )
|
set( BUILD_ANDROID True )
|
||||||
@ -1689,8 +1682,8 @@ 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", "x86", "mips", "arm64-v8a", "x86_64", "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,15,16,17,18,19,21 (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
|
||||||
# ANDROID_NO_UNDEFINED : ON/OFF
|
# ANDROID_NO_UNDEFINED : ON/OFF
|
||||||
@ -1723,17 +1716,21 @@ 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", "mips", "arm64-v8a", "x86_64", "mips64" depending on ANDROID_ABI
|
||||||
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9; set only for NDK
|
# ANDROID_NDK_RELEASE : from r5 to r10c; set only for NDK
|
||||||
# ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
|
# ANDROID_NDK_RELEASE_NUM : numeric ANDROID_NDK_RELEASE version (1000*major+minor)
|
||||||
|
# ANDROID_ARCH_NAME : "arm", "x86", "mips", "arm64", "x86_64", "mips64" 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
|
||||||
# ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
|
# ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
|
||||||
@ -1741,7 +1738,8 @@ endif()
|
|||||||
# ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
|
# ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
|
||||||
#
|
#
|
||||||
# Secondary (less stable) read-only variables:
|
# Secondary (less stable) read-only variables:
|
||||||
# ANDROID_COMPILER_VERSION : GCC version used
|
# ANDROID_COMPILER_VERSION : GCC version used (not Clang version)
|
||||||
|
# ANDROID_CLANG_VERSION : version of clang compiler if clang is used
|
||||||
# ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
|
# ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
|
||||||
# ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
|
# ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
|
||||||
# ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
|
# ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
|
||||||
@ -1752,7 +1750,6 @@ endif()
|
|||||||
# ANDROID_RTTI : if rtti is enabled by the runtime
|
# ANDROID_RTTI : if rtti is enabled by the runtime
|
||||||
# ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
|
# ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
|
||||||
# ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
|
# ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
|
||||||
# ANDROID_CLANG_VERSION : version of clang compiler if clang is used
|
|
||||||
# ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
|
# ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
|
||||||
#
|
#
|
||||||
# Defaults:
|
# Defaults:
|
||||||
@ -1762,4 +1759,3 @@ endif()
|
|||||||
# ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
|
# ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
|
||||||
# ANDROID_SUPPORTED_ABIS_${ARCH}
|
# ANDROID_SUPPORTED_ABIS_${ARCH}
|
||||||
# ANDROID_SUPPORTED_NDK_VERSIONS
|
# ANDROID_SUPPORTED_NDK_VERSIONS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user