summaryrefslogtreecommitdiffstats
path: root/doc
Commit message (Expand)AuthorAgeFilesLines
* Doc update (add Tcl_OutputBuffered, remove old changebars)dkf2001-09-241-8/+14
* Another typodgp2001-09-241-2/+2
* corrected formatting error causing 'make mklinks' troubledgp2001-09-241-4/+2
* Corrected formatting error.dgp2001-09-241-2/+2
* Socket documentation improvement.dkf2001-09-191-3/+7
* Disabled all compile and execution tracing functionality in standardMiguel Sofer2001-09-171-1/+7
* * doc/gets.n:andreas_kupries2001-09-1411-41/+126
* Patch for [TIP 56], [Bug: 219384] and [Bug: 455151]: deprecate the useMiguel Sofer2001-09-131-14/+29
* * doc/OpenFileChnl.3: Added documentation for Tcl_WriteRaw andandreas_kupries2001-09-112-4/+45
* Typo.andreas_kupries2001-09-101-3/+3
* Changed the phrasing of some blocks making them easier to understand.andreas_kupries2001-09-101-37/+39
* noted 8.4 version upgrade in lsearch man pagehobbs2001-09-101-2/+2
* * doc/tclsh.1:andreas_kupries2001-09-106-8/+162
* channel-copy-fixvincentdarley2001-09-081-4/+4
* * Updated http package to version 2.4,dgp2001-09-071-2/+2
* * doc/http.n: noted -binary, charset and coding state keys.hobbs2001-09-071-8/+20
* minor fs, vfs fixesvincentdarley2001-09-043-15/+29
* doc bugfix (bug #457435)dkf2001-09-031-3/+3
* * doc/StringObj.3: added words of warning to use Tcl_ResetResulthobbs2001-08-311-17/+5
* filesystemvincentdarley2001-08-301-11/+16
* formatting correctionsdgp2001-08-251-3/+9
* documented subtlety with glob and windows pathsvincentdarley2001-08-241-1/+12
* documented path length restrictionsvincentdarley2001-08-241-1/+5
* typo fixdgp2001-08-241-2/+2
* fs updatevincentdarley2001-08-234-28/+63
* * doc/dde.n: fixed dde man page (which was totally incorrect).hobbs2001-08-221-29/+38
* corrected minor nroff transgressionshobbs2001-08-074-9/+9
* * Added note that the tclsh program is frequentlydgp2001-08-061-1/+9
* New documentation for TIP#17vincentdarley2001-07-311-0/+1195
* Changes from TIP#17 "Redo Tcl's filesystem"vincentdarley2001-07-314-9/+95
* * Corrected documentation and usage message of [pkg_mkIndex].dgp2001-07-211-2/+6
* TIP#36 implementation. Also includes cleanup for subst optiondkf2001-07-122-6/+109
* * doc/interp.n:hobbs2001-06-272-19/+51
* * generic/tcl.h:dgp2001-06-081-0/+102
* Changes from TIP#15 "Functions to List and Detail Math Functions"dkf2001-05-302-6/+68
* * Note that "tclbench" (see project "tcllib") was extended withandreas_kupries2001-05-191-1/+14
* Oops! Put it in the wrong source tree...dkf2001-05-161-95/+0
* Added some documentation for the console command.dkf2001-05-151-0/+95
* fixed minor nroff bugshobbs2001-05-031-4/+4
* by chance '\n' started a line, looking like a commenthobbs2001-05-031-3/+3
* removed extraneous 'v' from dochobbs2001-05-031-2/+2
* Fix for Bug 420186dgp2001-05-031-2/+3
* (TIP #27) Another round of CONST changes, thisKevin B Kenny2001-04-246-13/+29
* Corrected behaviour of [namespace code] (bug #219385, patch #403530)Miguel Sofer2001-04-071-2/+2
* 2001-04-07 Andreas Kupries <andreas_kupries@users.sourceforge.net>andreas_kupries2001-04-061-0/+92
* 2001-04-07 Andreas Kupries <andreas_kupries@users.sourceforge.net>andreas_kupries2001-04-063-6/+6
* Improved documentation on behaviour of read w.r.t. serial ports.dkf2001-04-061-15/+33
* 2001-04-05 Andreas Kupries <andreas_kupries@users.sourceforge.net>andreas_kupries2001-04-051-2/+2
* 2001-04-04 Andreas Kupries <andreas_kupries@users.sourceforge.net>andreas_kupries2001-04-042-0/+147
* (TIP#27) Changed a number of Tcl API's to accept "CONST char*"Kevin B Kenny2001-04-045-18/+18
LCHAIN_API "${CMAKE_MATCH_1}")
+ endif()
+endif()
+
+if(NOT CMAKE_ANDROID_NDK AND NOT CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ message(FATAL_ERROR "Android: Neither the NDK or a standalone toolchain was found.")
+endif()
+
+# Select an API.
+if(CMAKE_SYSTEM_VERSION)
+ set(_ANDROID_API_VAR CMAKE_SYSTEM_VERSION)
+elseif(CMAKE_ANDROID_API)
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_ANDROID_API}")
+ set(_ANDROID_API_VAR CMAKE_ANDROID_API)
+elseif(_ANDROID_SYSROOT_API)
+ set(CMAKE_SYSTEM_VERSION "${_ANDROID_SYSROOT_API}")
+ set(_ANDROID_API_VAR CMAKE_SYSROOT)
+elseif(_ANDROID_STANDALONE_TOOLCHAIN_API)
+ set(CMAKE_SYSTEM_VERSION "${_ANDROID_STANDALONE_TOOLCHAIN_API}")
+endif()
+if(CMAKE_SYSTEM_VERSION)
+ if(CMAKE_ANDROID_API AND NOT "x${CMAKE_ANDROID_API}" STREQUAL "x${CMAKE_SYSTEM_VERSION}")
+ message(FATAL_ERROR
+ "Android: The API specified by CMAKE_ANDROID_API='${CMAKE_ANDROID_API}' is not consistent with CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}'."
+ )
+ endif()
+ if(_ANDROID_SYSROOT_API)
+ foreach(v CMAKE_ANDROID_API CMAKE_SYSTEM_VERSION)
+ if(${v} AND NOT "x${_ANDROID_SYSROOT_API}" STREQUAL "x${${v}}")
+ message(FATAL_ERROR
+ "Android: The API specified by ${v}='${${v}}' is not consistent with CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}"
+ )
+ endif()
+ endforeach()
+ endif()
+ if(CMAKE_ANDROID_NDK AND NOT IS_DIRECTORY "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}")
+ message(FATAL_ERROR
+ "Android: The API specified by ${_ANDROID_API_VAR}='${${_ANDROID_API_VAR}}' does not exist in the NDK. "
+ "The directory:\n"
+ " ${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}\n"
+ "does not exist."
+ )
+ endif()
+elseif(CMAKE_ANDROID_NDK)
+ file(GLOB _ANDROID_APIS_1 RELATIVE "${CMAKE_ANDROID_NDK}/platforms" "${CMAKE_ANDROID_NDK}/platforms/android-[0-9]")
+ file(GLOB _ANDROID_APIS_2 RELATIVE "${CMAKE_ANDROID_NDK}/platforms" "${CMAKE_ANDROID_NDK}/platforms/android-[0-9][0-9]")
+ list(SORT _ANDROID_APIS_1)
+ list(SORT _ANDROID_APIS_2)
+ set(_ANDROID_APIS ${_ANDROID_APIS_1} ${_ANDROID_APIS_2})
+ unset(_ANDROID_APIS_1)
+ unset(_ANDROID_APIS_2)
+ if(_ANDROID_APIS STREQUAL "")
+ message(FATAL_ERROR
+ "Android: No APIs found in the NDK. No\n"
+ " ${CMAKE_ANDROID_NDK}/platforms/android-*\n"
+ "directories exist."
+ )
+ endif()
+ string(REPLACE "android-" "" _ANDROID_APIS "${_ANDROID_APIS}")
+ list(REVERSE _ANDROID_APIS)
+ list(GET _ANDROID_APIS 0 CMAKE_SYSTEM_VERSION)
+ unset(_ANDROID_APIS)
+endif()
+if(NOT CMAKE_SYSTEM_VERSION MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Android: The API specified by CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}' is not an integer.")
+endif()
+
+# https://developer.android.com/ndk/guides/abis.html
+
+set(_ANDROID_ABI_arm64-v8a_PROC "aarch64")
+set(_ANDROID_ABI_arm64-v8a_ARCH "arm64")
+set(_ANDROID_ABI_armeabi-v7a_PROC "armv7-a")
+set(_ANDROID_ABI_armeabi-v7a_ARCH "arm")
+set(_ANDROID_ABI_armeabi-v6_PROC "armv6")
+set(_ANDROID_ABI_armeabi-v6_ARCH "arm")
+set(_ANDROID_ABI_armeabi_PROC "armv5te")
+set(_ANDROID_ABI_armeabi_ARCH "arm")
+set(_ANDROID_ABI_mips_PROC "mips")
+set(_ANDROID_ABI_mips_ARCH "mips")
+set(_ANDROID_ABI_mips64_PROC "mips64")
+set(_ANDROID_ABI_mips64_ARCH "mips64")
+set(_ANDROID_ABI_x86_PROC "i686")
+set(_ANDROID_ABI_x86_ARCH "x86")
+set(_ANDROID_ABI_x86_64_PROC "x86_64")
+set(_ANDROID_ABI_x86_64_ARCH "x86_64")
+
+set(_ANDROID_PROC_aarch64_ARCH_ABI "arm64-v8a")
+set(_ANDROID_PROC_armv7-a_ARCH_ABI "armeabi-v7a")
+set(_ANDROID_PROC_armv6_ARCH_ABI "armeabi-v6")
+set(_ANDROID_PROC_armv5te_ARCH_ABI "armeabi")
+set(_ANDROID_PROC_i686_ARCH_ABI "x86")
+set(_ANDROID_PROC_mips_ARCH_ABI "mips")
+set(_ANDROID_PROC_mips64_ARCH_ABI "mips64")
+set(_ANDROID_PROC_x86_64_ARCH_ABI "x86_64")
+
+set(_ANDROID_ARCH_arm64_ABI "arm64-v8a")
+set(_ANDROID_ARCH_arm_ABI "armeabi")
+set(_ANDROID_ARCH_mips_ABI "mips")
+set(_ANDROID_ARCH_mips64_ABI "mips64")
+set(_ANDROID_ARCH_x86_ABI "x86")
+set(_ANDROID_ARCH_x86_64_ABI "x86_64")
+
+# Validate inputs.
+if(CMAKE_ANDROID_ARCH_ABI AND NOT DEFINED "_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC")
+ message(FATAL_ERROR "Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}'.")
+endif()
+if(CMAKE_SYSTEM_PROCESSOR AND NOT DEFINED "_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI")
+ message(FATAL_ERROR "Android: Unknown processor CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}'.")
+endif()
+if(_ANDROID_SYSROOT_ARCH AND NOT DEFINED "_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI")
+ message(FATAL_ERROR
+ "Android: Unknown architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}"
+ )
+endif()
+
+# Select an ABI.
+if(NOT CMAKE_ANDROID_ARCH_ABI)
+ if(CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI}")
+ elseif(_ANDROID_SYSROOT_ARCH)
+ set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI}")
+ else()
+ # https://developer.android.com/ndk/guides/application_mk.html
+ # Default is the oldest ARM ABI.
+ set(CMAKE_ANDROID_ARCH_ABI "armeabi")
+ endif()
+endif()
+set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}")
+if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_ANDROID_ARCH}")
+ message(FATAL_ERROR
+ "Android: Architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}\n"
+ "does not match architecture '${CMAKE_ANDROID_ARCH}' for the ABI '${CMAKE_ANDROID_ARCH_ABI}'."
+ )
+endif()
+
+# Select a processor.
+if(NOT CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_SYSTEM_PROCESSOR "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC}")
+endif()
+
+# If the user specified both an ABI and a processor then they might not match.
+if(NOT _ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC STREQUAL CMAKE_SYSTEM_PROCESSOR)
+ message(FATAL_ERROR "Android: The specified CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}' and CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}' is not a valid combination.")
+endif()
+
+# Save the Android-specific information in CMakeSystem.cmake.
+set(CMAKE_SYSTEM_CUSTOM_CODE "
+set(CMAKE_ANDROID_NDK \"${CMAKE_ANDROID_NDK}\")
+set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN \"${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}\")
+set(CMAKE_ANDROID_ARCH \"${CMAKE_ANDROID_ARCH}\")
+set(CMAKE_ANDROID_ARCH_ABI \"${CMAKE_ANDROID_ARCH_ABI}\")
+")
+
+# Select an ARM variant.
+if(CMAKE_ANDROID_ARCH_ABI MATCHES "^armeabi")
+ if(CMAKE_ANDROID_ARM_MODE)
+ set(CMAKE_ANDROID_ARM_MODE 1)
+ else()
+ set(CMAKE_ANDROID_ARM_MODE 0)
+ endif()
+ string(APPEND CMAKE_SYSTEM_CUSTOM_CODE
+ "set(CMAKE_ANDROID_ARM_MODE \"${CMAKE_ANDROID_ARM_MODE}\")\n"
+ )
+elseif(DEFINED CMAKE_ANDROID_ARM_MODE)
+ message(FATAL_ERROR "Android: CMAKE_ANDROID_ARM_MODE is set but is valid only for 'armeabi' architectures.")
+endif()
+
+if(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
+ if(CMAKE_ANDROID_ARM_NEON)
+ set(CMAKE_ANDROID_ARM_NEON 1)
+ else()
+ set(CMAKE_ANDROID_ARM_NEON 0)
+ endif()
+ string(APPEND CMAKE_SYSTEM_CUSTOM_CODE
+ "set(CMAKE_ANDROID_ARM_NEON \"${CMAKE_ANDROID_ARM_NEON}\")\n"
+ )
+elseif(DEFINED CMAKE_ANDROID_ARM_NEON)
+ message(FATAL_ERROR "Android: CMAKE_ANDROID_ARM_NEON is set but is valid only for 'armeabi-v7a' architecture.")
+endif()
+
+# Report the chosen architecture.
+message(STATUS "Android: Targeting API '${CMAKE_SYSTEM_VERSION}' with architecture '${CMAKE_ANDROID_ARCH}', ABI '${CMAKE_ANDROID_ARCH_ABI}', and processor '${CMAKE_SYSTEM_PROCESSOR}'")
diff --git a/Modules/Platform/Android-GNU-C.cmake b/Modules/Platform/Android-GNU-C.cmake
new file mode 100644
index 0000000..78a6a50
--- /dev/null
+++ b/Modules/Platform/Android-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-GNU)
+__android_compiler_gnu(C)
diff --git a/Modules/Platform/Android-GNU-CXX.cmake b/Modules/Platform/Android-GNU-CXX.cmake
new file mode 100644
index 0000000..41279d1
--- /dev/null
+++ b/Modules/Platform/Android-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-GNU)
+__android_compiler_gnu(CXX)
diff --git a/Modules/Platform/Android-GNU.cmake b/Modules/Platform/Android-GNU.cmake
new file mode 100644
index 0000000..58943d0
--- /dev/null
+++ b/Modules/Platform/Android-GNU.cmake
@@ -0,0 +1,43 @@
+#=============================================================================
+# Copyright 2015-2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__ANDROID_COMPILER_GNU)
+ return()
+endif()
+set(__ANDROID_COMPILER_GNU 1)
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ macro(__android_compiler_gnu lang)
+ endmacro()
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ macro(__android_compiler_gnu lang)
+ endmacro()
+ return()
+endif()
+
+include(Platform/Android-Common)
+
+include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-GNU)
+
+macro(__android_compiler_gnu lang)
+ __android_compiler_common(${lang})
+endmacro()
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
new file mode 100644
index 0000000..353dd0d
--- /dev/null
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -0,0 +1,51 @@
+#=============================================================================
+# Copyright 2015-2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this
+# module.
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ return()
+endif()
+
+if(NOT CMAKE_SYSROOT)
+ if(CMAKE_ANDROID_NDK)
+ set(CMAKE_SYSROOT "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}")
+ elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ set(CMAKE_SYSROOT "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot")
+ endif()
+endif()
+
+if(CMAKE_SYSROOT)
+ if(NOT IS_DIRECTORY "${CMAKE_SYSROOT}")
+ message(FATAL_ERROR
+ "Android: The system root directory needed for the selected Android version and architecture does not exist:\n"
+ " ${CMAKE_SYSROOT}\n"
+ )
+ endif()
+else()
+ message(FATAL_ERROR
+ "Android: No CMAKE_SYSROOT was selected."
+ )
+endif()
+
+set(CMAKE_BUILD_TYPE_INIT Debug)
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index 1bdad04..3d69733 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -1,5 +1,7 @@
include(Platform/Linux)
+set(ANDROID 1)
+
# Android has soname, but binary names must end in ".so" so we cannot append
# a version number. Also we cannot portably represent symlinks on the host.
set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
new file mode 100644
index 0000000..8bd0de9
--- /dev/null
+++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
@@ -0,0 +1,256 @@
+#=============================================================================
+# Copyright 2015-2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# In Android NDK releases there is build system toolchain selection logic in
+# these files:
+#
+# * <ndk>/build/core/init.mk
+# * <ndk>/build/core/setup-toolchain.mk
+# * <ndk>/[build/core/]toolchains/<toolchain>/{config.mk,setup.mk}
+#
+# We parse information out of the ``config.mk`` and ``setup.mk`` files below.
+#
+# There is also a "toolchains" directory with the prebuilt toolchains themselves:
+#
+# * <triple-or-arch>-<gcc-version>/prebuilt/<host>/bin/<triple>-gcc(.exe)?
+# The gcc compiler to be invoked.
+#
+# * llvm*/prebuilt/<host>/bin/clang
+# The clang compiler to be invoked with flags:
+# -target <triple>
+# -gcc-toolchain <ndk>/toolchains/<triple-or-arch>-<gcc-version>
+
+# Glob available toolchains in the NDK, restricted by any version request.
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION STREQUAL "clang")
+ set(_ANDROID_TOOL_PATTERNS "*-clang" "*-clang[0-9].[0-9]")
+elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
+ if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "^(clang)?[0-9]\\.[0-9]$")
+ message(FATAL_ERROR
+ "Android: The CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION value '${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}' "
+ "is not one of the allowed forms:\n"
+ " <major>.<minor> = GCC of specified version\n"
+ " clang<major>.<minor> = Clang of specified version\n"
+ " clang = Clang of most recent available version\n"
+ )
+ endif()
+ set(_ANDROID_TOOL_PATTERNS "*-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}")
+else()
+ set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]")
+endif()
+set(_ANDROID_CONFIG_MK_PATTERNS)
+foreach(base "build/core/toolchains" "toolchains")
+ foreach(pattern IN LISTS _ANDROID_TOOL_PATTERNS)
+ list(APPEND _ANDROID_CONFIG_MK_PATTERNS
+ "${CMAKE_ANDROID_NDK}/${base}/${pattern}/config.mk"
+ )
+ endforeach()
+endforeach()
+unset(_ANDROID_TOOL_PATTERNS)
+file(GLOB _ANDROID_CONFIG_MKS ${_ANDROID_CONFIG_MK_PATTERNS})
+unset(_ANDROID_CONFIG_MK_PATTERNS)
+
+# Find the newest toolchain version matching the ABI.
+set(_ANDROID_TOOL_NAME "")
+set(_ANDROID_TOOL_VERS 0)
+set(_ANDROID_TOOL_SETUP_MK "")
+foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS)
+ # Check that the toolchain matches the ABI.
+ file(STRINGS "${config_mk}" _ANDROID_TOOL_ABIS REGEX "^TOOLCHAIN_ABIS :=.* ${CMAKE_ANDROID_ARCH_ABI}( |$)")
+ if(NOT _ANDROID_TOOL_ABIS)
+ continue()
+ endif()
+ unset(_ANDROID_TOOL_ABIS)
+
+ # Check the version.
+ if("${config_mk}" MATCHES [[/([^/]+-(clang)?([0-9]\.[0-9]|))/config.mk$]])
+ set(_ANDROID_CUR_NAME "${CMAKE_MATCH_1}")
+ set(_ANDROID_CUR_VERS "${CMAKE_MATCH_3}")
+ if(_ANDROID_TOOL_VERS STREQUAL "")
+ # already the latest possible
+ elseif(_ANDROID_CUR_VERS STREQUAL "" OR _ANDROID_CUR_VERS VERSION_GREATER _ANDROID_TOOL_VERS)
+ set(_ANDROID_TOOL_NAME "${_ANDROID_CUR_NAME}")
+ set(_ANDROID_TOOL_VERS "${_ANDROID_CUR_VERS}")
+ string(REPLACE "/config.mk" "/setup.mk" _ANDROID_TOOL_SETUP_MK "${config_mk}")
+ endif()
+ unset(_ANDROID_CUR_TOOL)
+ unset(_ANDROID_CUR_VERS)
+ endif()
+endforeach()
+
+# Verify that we have a suitable toolchain.
+if(NOT _ANDROID_TOOL_NAME)
+ if(_ANDROID_CONFIG_MKS)
+ string(REPLACE ";" "\n " _ANDROID_TOOLS_MSG "after considering:;${_ANDROID_CONFIG_MKS}")
+ else()
+ set(_ANDROID_TOOLS_MSG "")
+ endif()
+ if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
+ string(CONCAT _ANDROID_TOOLS_MSG
+ "of the version specified by CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION:\n"
+ " ${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}\n"
+ "${_ANDROID_TOOLS_MSG}")
+ endif()
+ message(FATAL_ERROR
+ "Android: No toolchain for ABI '${CMAKE_ANDROID_ARCH_ABI}' found in the NDK:\n"
+ " ${CMAKE_ANDROID_NDK}\n"
+ "${_ANDROID_TOOLS_MSG}"
+ )
+endif()
+unset(_ANDROID_CONFIG_MKS)
+
+# For clang toolchains we still need to find a gcc toolchain.
+if(_ANDROID_TOOL_NAME MATCHES "-clang")
+ set(_ANDROID_TOOL_CLANG_NAME "${_ANDROID_TOOL_NAME}")
+ set(_ANDROID_TOOL_CLANG_VERS "${_ANDROID_TOOL_VERS}")
+ set(_ANDROID_TOOL_NAME "")
+ set(_ANDROID_TOOL_VERS "")
+else()
+ set(_ANDROID_TOOL_CLANG_NAME "")
+ set(_ANDROID_TOOL_CLANG_VERS "")
+endif()
+
+# Parse the toolchain setup.mk file to extract information we need.
+# Their content is not standardized across toolchains or NDK versions,
+# so we match known cases. Note that the parsing is stateful across
+# lines because we need to substitute for some Make variable references.
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
+ message(STATUS "loading: ${_ANDROID_TOOL_SETUP_MK}")
+endif()
+file(STRINGS "${_ANDROID_TOOL_SETUP_MK}" _ANDROID_TOOL_SETUP REGEX "^(LLVM|TOOLCHAIN)_[A-Z_]+ +:= +.*$")
+unset(_ANDROID_TOOL_SETUP_MK)
+set(_ANDROID_TOOL_PREFIX "")
+set(_ANDROID_TOOL_NAME_ONLY "")
+set(_ANDROID_TOOL_LLVM_NAME "")
+set(_ANDROID_TOOL_LLVM_VERS "")
+foreach(line IN LISTS _ANDROID_TOOL_SETUP)
+ if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
+ message(STATUS "setup.mk: ${line}")
+ endif()
+
+ if(line MATCHES [[^TOOLCHAIN_PREFIX +:= +.*/bin/([^$/ ]*) *$]])
+ # We just matched the toolchain prefix with no Make variable references.
+ set(_ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+ elseif(_ANDROID_TOOL_CLANG_NAME)
+ # For clang toolchains we need to find more information.
+ if(line MATCHES [[^TOOLCHAIN_VERSION +:= +([0-9.]+) *$]])
+ # We just matched the gcc toolchain version number. Save it for later.
+ set(_ANDROID_TOOL_VERS "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_NAME +:= +(.*\$\(TOOLCHAIN_VERSION\)) *$]])
+ # We just matched the gcc toolchain name with a version number placeholder, so substitute it.
+ # The gcc toolchain version number will have already been extracted from a TOOLCHAIN_VERSION line.
+ string(REPLACE "$(TOOLCHAIN_VERSION)" "${_ANDROID_TOOL_VERS}" _ANDROID_TOOL_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_NAME +:= +([^$/ ]+) *$]])
+ # We just matched the gcc toolchain name without version number. Save it for later.
+ set(_ANDROID_TOOL_NAME_ONLY "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_PREFIX +:= +.*/bin/(\$\(TOOLCHAIN_NAME\)-) *$]])
+ # We just matched the toolchain prefix with a name placholder, so substitute it.
+ # The gcc toolchain name will have already been extracted without version number from a TOOLCHAIN_NAME line.
+ string(REPLACE "$(TOOLCHAIN_NAME)" "${_ANDROID_TOOL_NAME_ONLY}" _ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^LLVM_VERSION +:= +([0-9.]+)$]])
+ # We just matched the llvm prebuilt binary toolchain version number. Save it for later.
+ set(_ANDROID_TOOL_LLVM_VERS "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^LLVM_NAME +:= +(llvm-\$\(LLVM_VERSION\)) *$]])
+ # We just matched the llvm prebuilt binary toolchain directory name with a version number placeholder,
+ # so substitute it. The llvm prebuilt binary toolchain version number will have already been extracted
+ # from a LLVM_VERSION line.
+ string(REPLACE "$(LLVM_VERSION)" "${_ANDROID_TOOL_LLVM_VERS}" _ANDROID_TOOL_LLVM_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^LLVM_TOOLCHAIN_PREBUILT_ROOT +:= +\$\(call get-toolchain-root.*,([^$ ]+)\) *$]])
+ # We just matched the llvm prebuilt binary toolchain directory name.
+ set(_ANDROID_TOOL_LLVM_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_ROOT +:= +\$\(call get-toolchain-root.*,(\$\(TOOLCHAIN_NAME\)-[0-9.]+)\) *$]])
+ # We just matched a placeholder for the name followed by a version number.
+ # The gcc toolchain name will have already been extracted without version number from a TOOLCHAIN_NAME line.
+ # Substitute for the placeholder to get the full gcc toolchain name.
+ string(REPLACE "$(TOOLCHAIN_NAME)" "${_ANDROID_TOOL_NAME_ONLY}" _ANDROID_TOOL_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_ROOT +:= +\$\(call get-toolchain-root.*,([^$ ]+)\) *$]])
+ # We just matched the full gcc toolchain name without placeholder.
+ set(_ANDROID_TOOL_NAME "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+endforeach()
+unset(_ANDROID_TOOL_NAME_ONLY)
+unset(_ANDROID_TOOL_LLVM_VERS)
+unset(_ANDROID_TOOL_SETUP)
+
+# Fall back to parsing the version and prefix from the tool name.
+if(NOT _ANDROID_TOOL_VERS AND "${_ANDROID_TOOL_NAME}" MATCHES "-([0-9.]+)$")
+ set(_ANDROID_TOOL_VERS "${CMAKE_MATCH_1}")
+endif()
+if(NOT _ANDROID_TOOL_PREFIX AND "${_ANDROID_TOOL_NAME}" MATCHES "^(.*-)[0-9.]+$")
+ set(_ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+endif()
+
+# Identify the host platform.
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(_ANDROID_HOST_DIR "darwin-x86_64")
+ else()
+ set(_ANDROID_HOST_DIR "darwin-x86")
+ endif()
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(_ANDROID_HOST_DIR "linux-x86_64")
+ else()
+ set(_ANDROID_HOST_DIR "linux-x86")
+ endif()
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
+ set(_ANDROID_HOST_DIR "windows-x86_64")
+ else()
+ set(_ANDROID_HOST_DIR "windows")
+ endif()
+else()
+ message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.")
+endif()
+
+# Help CMakeFindBinUtils locate things.
+set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
+
+set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS}")
+set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/${_ANDROID_TOOL_PREFIX}")
+set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
+
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+
+if(_ANDROID_TOOL_CLANG_NAME)
+ message(STATUS "Android: Selected Clang toolchain '${_ANDROID_TOOL_CLANG_NAME}' with GCC toolchain '${_ANDROID_TOOL_NAME}'")
+ set(_ANDROID_TOOL_C_COMPILER "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_LLVM_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/clang${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN ${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR})
+ set(_ANDROID_TOOL_CXX_COMPILER "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_LLVM_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/clang++${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN}")
+else()
+ message(STATUS "Android: Selected GCC toolchain '${_ANDROID_TOOL_NAME}'")
+ set(_ANDROID_TOOL_C_COMPILER "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}gcc${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_COMPILER "${_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX}g++${_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+endif()
+
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
+ message(STATUS "_ANDROID_TOOL_NAME=${_ANDROID_TOOL_NAME}")
+ message(STATUS "_ANDROID_TOOL_VERS=${_ANDROID_TOOL_VERS}")
+ message(STATUS "_ANDROID_TOOL_PREFIX=${_ANDROID_TOOL_PREFIX}")
+ message(STATUS "_ANDROID_TOOL_CLANG_NAME=${_ANDROID_TOOL_CLANG_NAME}")
+ message(STATUS "_ANDROID_TOOL_CLANG_VERS=${_ANDROID_TOOL_CLANG_VERS}")
+ message(STATUS "_ANDROID_TOOL_LLVM_NAME=${_ANDROID_TOOL_LLVM_NAME}")
+endif()
+
+unset(_ANDROID_TOOL_NAME)
+unset(_ANDROID_TOOL_VERS)
+unset(_ANDROID_TOOL_PREFIX)
+unset(_ANDROID_TOOL_CLANG_NAME)
+unset(_ANDROID_TOOL_CLANG_VERS)
+unset(_ANDROID_TOOL_LLVM_NAME)
+unset(_ANDROID_HOST_DIR)
diff --git a/Modules/Platform/Android/Determine-Compiler-Standalone.cmake b/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
new file mode 100644
index 0000000..64d4ccf
--- /dev/null
+++ b/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
@@ -0,0 +1,69 @@
+#=============================================================================
+# Copyright 2015-2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+set(_ANDROID_TOOL_C_COMPILER "")
+set(_ANDROID_TOOL_CXX_COMPILER "")
+set(_ANDROID_TOOL_PREFIX "")
+file(GLOB _gcc "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/*-gcc${_ANDROID_HOST_EXT}")
+foreach(gcc IN LISTS _gcc)
+ if("${gcc}" MATCHES "/bin/([^/]*)gcc${_ANDROID_HOST_EXT}$")
+ set(_ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+ break()
+ endif()
+endforeach()
+
+if(NOT _ANDROID_TOOL_PREFIX)
+ message(FATAL_ERROR
+ "Android: No '*-gcc' compiler found in CMAKE_ANDROID_STANDALONE_TOOLCHAIN:\n"
+ " ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}"
+ )
+endif()
+
+# Help CMakeFindBinUtils locate things.
+set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
+
+execute_process(
+ COMMAND "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}gcc${_ANDROID_HOST_EXT}" -dumpversion
+ OUTPUT_VARIABLE _gcc_version
+ ERROR_VARIABLE _gcc_error
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+if(_gcc_version MATCHES "^([0-9]+\\.[0-9]+)")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${CMAKE_MATCH_1}")
+else()
+ message(FATAL_ERROR
+ "Android: Failed to extract the standalone toolchain version. The command:\n"
+ " '${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}gcc${_ANDROID_HOST_EXT}' '-dumpversion'\n"
+ "produced output:\n"
+ " ${_gcc_version}\n"
+ )
+endif()
+
+set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}")
+set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
+
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+
+if(EXISTS "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_C_COMPILER "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}")
+ set(_ANDROID_TOOL_CXX_COMPILER "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang++${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}")
+else()
+ set(_ANDROID_TOOL_C_COMPILER "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}gcc${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_COMPILER "${_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX}g++${_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+endif()
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
new file mode 100644
index 0000000..65223dc
--- /dev/null
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -0,0 +1,80 @@
+#=============================================================================
+# Copyright 2015-2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__ANDROID_DETERMINE_COMPILER)
+ return()
+endif()
+set(__ANDROID_DETERMINE_COMPILER 1)
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ macro(__android_determine_compiler lang)
+ endmacro()
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ macro(__android_determine_compiler lang)
+ endmacro()
+ return()
+endif()
+
+# Identify the host platform.
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ set(_ANDROID_HOST_EXT "")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ set(_ANDROID_HOST_EXT "")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(_ANDROID_HOST_EXT ".exe")
+else()
+ message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.")
+endif()
+
+if(CMAKE_ANDROID_NDK)
+ include(Platform/Android/Determine-Compiler-NDK)
+elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ include(Platform/Android/Determine-Compiler-Standalone)
+else()
+ set(_ANDROID_TOOL_C_COMPILER "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "")
+ set(_ANDROID_TOOL_CXX_COMPILER "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "")
+endif()
+
+unset(_ANDROID_HOST_EXT)
+
+macro(__android_determine_compiler lang)
+ if(_ANDROID_TOOL_${lang}_COMPILER)
+ set(CMAKE_${lang}_COMPILER "${_ANDROID_TOOL_${lang}_COMPILER}")
+ set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN "${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}")
+
+ # Save the Android-specific information in CMake${lang}Compiler.cmake.
+ set(CMAKE_${lang}_COMPILER_CUSTOM_CODE "
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_VERSION}\")
+set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN \"${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}\")
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_PREFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_PREFIX}\")
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_SUFFIX}\")
+")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
new file mode 100644
index 0000000..3ff1fe5
--- /dev/null
+++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
@@ -0,0 +1,8 @@
+# <ndk>/build/core/toolchains/aarch64-linux-android-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake
new file mode 100644
index 0000000..538ec2f
--- /dev/null
+++ b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake
@@ -0,0 +1,6 @@
+# <ndk>/build/core/toolchains/aarch64-linux-android-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake
new file mode 100644
index 0000000..4fc3009
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake
@@ -0,0 +1,20 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "armv5te-none-linux-androideabi")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv5te"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -msoft-float"
+ " -mtune=xscale"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-armeabi-GNU.cmake b/Modules/Platform/Android/abi-armeabi-GNU.cmake
new file mode 100644
index 0000000..10cac00
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-GNU.cmake
@@ -0,0 +1,18 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv5te"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -msoft-float"
+ " -mtune=xscale"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
new file mode 100644
index 0000000..15f1d4a
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
@@ -0,0 +1,19 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "armv6-none-linux-androideabi")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv6"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake
new file mode 100644
index 0000000..7492de0
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake
@@ -0,0 +1,17 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv6"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
new file mode 100644
index 0000000..3a3efb3
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
@@ -0,0 +1,29 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "armv7-none-linux-androideabi")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv7-a"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+if(CMAKE_ANDROID_ARM_NEON)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=neon")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=vfpv3-d16")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_LDFLAGS
+ " -Wl,--fix-cortex-a8"
+ )
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake
new file mode 100644
index 0000000..d27e37e
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake
@@ -0,0 +1,27 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv7-a"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+if(CMAKE_ANDROID_ARM_NEON)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=neon")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=vfpv3-d16")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+string(APPEND _ANDROID_ABI_INIT_LDFLAGS
+ " -Wl,--fix-cortex-a8"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-common-Clang.cmake b/Modules/Platform/Android/abi-common-Clang.cmake
new file mode 100644