Help: Document cross compiling for Android

CMake now supports cross compiling for Android using the NDK or a
standalone toolchain.  Document the associated variables and how how to
write toolchain files for Android.
This commit is contained in:
Brad King
2016-06-20 15:48:12 -04:00
parent d7d4083025
commit 6b84df8da9
18 changed files with 375 additions and 27 deletions

View File

@@ -1,5 +1,11 @@
CMAKE_ANDROID_API
-----------------
Default value for the :prop_tgt:`ANDROID_API` target property.
See that target property for additional information.
When :ref:`Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
Edition`, this variable may be set to specify the default value for the
:prop_tgt:`ANDROID_API` target property. See that target property for
additional information.
Otherwise, when :ref:`Cross Compiling for Android`, this variable provides
the Android API version number targeted. This will be the same value as
the :variable:`CMAKE_SYSTEM_VERSION` variable for ``Android`` platforms.

View File

@@ -1,5 +1,19 @@
CMAKE_ANDROID_ARCH
------------------
Default value for the :prop_tgt:`ANDROID_ARCH` target property.
See that target property for additional information.
When :ref:`Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
Edition`, this variable may be set to specify the default value for the
:prop_tgt:`ANDROID_ARCH` target property. See that target property for
additional information.
Otherwise, when :ref:`Cross Compiling for Android`, this variable provides
the name of the Android architecture corresponding to the value of the
:variable:`CMAKE_ANDROID_ARCH_ABI` variable. The architecture name
may be one of:
* ``arm``
* ``arm64``
* ``mips``
* ``mips64``
* ``x86``
* ``x86_64``

View File

@@ -0,0 +1,17 @@
CMAKE_ANDROID_ARCH_ABI
----------------------
When :ref:`Cross Compiling for Android`, this variable specifies the
target architecture and ABI to be used. Valid values are:
* ``arm64-v8a``
* ``armeabi-v7a``
* ``armeabi-v6``
* ``armeabi``
* ``mips``
* ``mips64``
* ``x86``
* ``x86_64``
See also the :variable:`CMAKE_ANDROID_ARM_MODE` and
:variable:`CMAKE_ANDROID_ARM_NEON` variables.

View File

@@ -0,0 +1,7 @@
CMAKE_ANDROID_ARM_MODE
----------------------
When :ref:`Cross Compiling for Android` and :variable:`CMAKE_ANDROID_ARCH_ABI`
is set to one of the ``armeabi`` architectures, set ``CMAKE_ANDROID_ARM_MODE``
to ``ON`` to target 32-bit ARM processors (``-marm``). Otherwise, the
default is to target the 16-bit Thumb processors (``-mthumb``).

View File

@@ -0,0 +1,6 @@
CMAKE_ANDROID_ARM_NEON
----------------------
When :ref:`Cross Compiling for Android` and :variable:`CMAKE_ANDROID_ARCH_ABI`
is set to ``armeabi-v7a`` set ``CMAKE_ANDROID_ARM_NEON`` to ``ON`` to target
ARM NEON devices.

View File

@@ -0,0 +1,7 @@
CMAKE_ANDROID_NDK
-----------------
When :ref:`Cross Compiling for Android with the NDK`, this variable holds
the absolute path to the root directory of the NDK. The directory must
contain a ``platforms`` subdirectory holding the ``android-<api>``
directories.

View File

@@ -0,0 +1,13 @@
CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION
-----------------------------------
When :ref:`Cross Compiling for Android with the NDK`, this variable
may be set to specify the version of the toolchain to be used
as the compiler. The variable must be set to one of these forms:
* ``<major>.<minor>``: GCC of specified version
* ``clang<major>.<minor>``: Clang of specified version
* ``clang``: Clang of most recent available version
A toolchain of the requested version will be selected automatically to
match the ABI named in the :variable:`CMAKE_ANDROID_ARCH_ABI` variable.

View File

@@ -0,0 +1,6 @@
CMAKE_ANDROID_STANDALONE_TOOLCHAIN
----------------------------------
When :ref:`Cross Compiling for Android with a Standalone Toolchain`, this
variable holds the absolute path to the root directory of the toolchain.
The specified directory must contain a ``sysroot`` subdirectory.

View File

@@ -1,5 +1,36 @@
CMAKE_ANDROID_STL_TYPE
----------------------
Default value for the :prop_tgt:`ANDROID_STL_TYPE` target property.
See that target property for additional information.
When :ref:`Cross Compiling for Android with NVIDIA Nsight Tegra Visual Studio
Edition`, this variable may be set to specify the default value for the
:prop_tgt:`ANDROID_STL_TYPE` target property. See that target property
for additional information.
When :ref:`Cross Compiling for Android with the NDK`, this variable may be
set to specify the STL variant to be used. The value may be one of:
``none``
No C++ Support
``system``
Minimal C++ without STL
``gabi++_static``
GAbi++ Static
``gabi++_shared``
GAbi++ Shared
``gnustl_static``
GNU libstdc++ Static
``gnustl_shared``
GNU libstdc++ Shared
``c++_static``
LLVM libc++ Static
``c++_shared``
LLVM libc++ Shared
``stlport_static``
STLport Static
``stlport_shared``
STLport Shared
The default value is ``gnustl_static``. Note that this default differs from
the native NDK build system because CMake may be used to build projects for
Android that are not natively implemented for it and use the C++ standard
library.

View File

@@ -0,0 +1,11 @@
CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX
-------------------------------------
When :ref:`Cross Compiling for Android` this variable contains the absolute
path prefixing the toolchain GNU compiler and its binutils.
See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX`.
For example, the path to the linker is::
${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}

View File

@@ -0,0 +1,7 @@
CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX
-------------------------------------
When :ref:`Cross Compiling for Android` this variable contains the
host platform suffix of the toolchain GNU compiler and its binutils.
See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX`.