diff options
Diffstat (limited to 'toolchain/Android.cmake')
-rw-r--r-- | toolchain/Android.cmake | 114 |
1 files changed, 68 insertions, 46 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 8272ef9d..55d2ca81 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -1,57 +1,79 @@ #.rst: # AndroidToolchain -# ------------------- +# ---------------- # -# Enable easy compilation of cmake projects on Android +# Enable easy compilation of cmake projects on Android. # # By using this android toolchain, the projects will be set up to compile the # specified project targeting an Android platform, depending on its input. # Furthermore, if desired, an APK can be directly generated by using the -# androiddeployqt tool. -# -# Note: Requires CMake 3.1 -# -# How to use it? -# -------------- -# First of all, to make use of this toolchain file it's required to specify the -# CMAKE_TOOLCHAIN_FILE variable pointing to AndroidToolchain.cmake. -# -# Then, there's many settings that we may want to specify under what circumstances -# the project will be built. This will be done through environment variables: -# - ANDROID_NDK: points to the NDK root path -# - ANDROID_SDK_ROOT: points to the SDK root path -# -# Also there's some cache variables we can pass as well to narrow down the -# preferred settings: -# - ANDROID_NDK: Points to the NDK root, defaults to the environment variable -# with the same name. -# - ANDROID_SDK_ROOT: Points to the Android SDK root, defaults to the environment -# variable with the same name. -# - ANDROID_ARCHITECTURE: Specifies the used architecture, "arm" by default. See -# arch-* directory. -# - ANDROID_TOOLCHAIN: Specifies the toolchain to be used. Defaults to -# "arm-linux-androideabi". See <ndk>/toolchains/ directory. -# - ANDROID_ABI: Specifies the ABI to be used. Defaults to "armeabi-v7a". See -# <ndk>/sources/cxx-stl/gnu-libstdc++/*/libs/ directories. -# - ANDROID_GCC_VERSION: Specifies the GCC version. Defaults to "4.9". -# - ANDROID_API_LEVEL: Specifies the API level to require. Defaults to "14". See -# http://developer.android.com/guide/topics/manifest/uses-sdk-element.html -# - ANDROID_SDK_BUILD_TOOLS_REVISION: Specifies the build tools version to be used. -# Defaults to "21.1.1". -# -# Once we have the application built, we will want to generate an APK that we -# can run on an Android device. To this end we've integrated androiddeployqt so -# this can be done easily. This won't work with non-qt projects. -# To make use of the APK generation, we'll define QTANDROID_EXPORTED_TARGET with -# the target we want to have exported. -# Additionally, we'll need to specify a ANDROID_APK_DIR with the base information -# to set the project up. For more information see: -# https://qt-project.org/doc/qt-5-snapshot/deployment-android.html -# -# Once set up, after building, make create-apk-<target_name> will process this -# input and generate an apk that can be found inside the build directory: -# ${CMAKE_BINARY_DIR}/<target_name>_build_apk/bin/QtApp-*.apk. +# `androiddeployqt <http://doc.qt.io/qt-5/deployment-android.html>`_ tool. # +# .. note:: +# +# This module requires CMake 3.1. +# +# Since 1.7.0. +# +# Usage +# ===== +# +# To use this file, you need to set the ``CMAKE_TOOLCHAIN_FILE`` to point to +# ``AndroidToolchain.cmake`` on the command line:: +# +# cmake -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/AndroidToolchain.cmake +# +# You will also need to provide the locations of the Android NDK and SDK. This +# can be done on the commandline or with environment variables; in either case +# the variable names are: +# +# ``ANDROID_NDK`` +# The NSK root path. +# ``ANDROID_SDK_ROOT`` +# The SSK root path. +# +# Additional options are specified as cache variables (eg: on the command line): +# +# ``ANDROID_ARCHITECTURE`` +# The architecture to compile for. Default: ``arm``. +# ``ANDROID_TOOLCHAIN`` +# The toolchain to use. See the ``toolchains`` directory of the NDK. +# Default: ``arm-linux-androideabi``. +# ``ANDROID_ABI`` +# The ABI to use. See the ``sources/cxx-stl/gnu-libstdc++/*/libs`` +# directories in the NDK. Default: ``armeabi-v7a``. +# ``ANDROID_GCC_VERSION`` +# The GCC version to use. Default: ``4.9``. +# ``ANDROID_API_LEVEL`` +# The `API level +# <http://developer.android.com/guide/topics/manifest/uses-sdk-element.html>`_ +# to require. Default: ``14``. +# ``ANDROID_SDK_BUILD_TOOLS_REVISION`` +# The build tools version to use. Default: ``21.1.1``. +# +# Deploying Qt Applications +# ========================= +# +# After building the application, you will need to generate an APK that can be +# deployed to an Android device. This module integrates androiddeployqt support +# to help with this for Qt-based projects. To enable this, set the +# ``QTANDROID_EXPORTED_TARGET`` variable to the target you wish to export as an +# APK, as well as ``ANDROID_APK_DIR`` to a directory containing some basic +# information. This will create a ``create-apk-<target>`` target that will +# generate the APK file. See the `Qt on Android deployment documentation +# <http://doc.qt.io/qt-5/deployment-android.html>`_ for more information. +# +# For example, you could do:: +# +# cmake \ +# -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/AndroidToolchain.cmake \ +# -DQTANDROID_EXPORTED_TARGET=myapp \ +# -DANDROID_APK_DIR=myapp-apk +# make +# make create-apk-myapp +# +# The APK would then be found in ``myapp_build_apk/bin`` in the build directory. + # ============================================================================= # Copyright 2014 Aleix Pol i Gonzalez <aleixpol@kde.org> # |