Home | History | Annotate | Download | only in android-cmake

Lines Matching full:cmake

1 # android-cmake
3 CMake is great, and so is Android. This is a collection of CMake scripts that may be useful to the Android NDK community. It is based on experience from porting OpenCV library to Android: http://opencv.org/platforms/android.html
5 Main goal is to share these scripts so that devs that use CMake as their build system may easily compile native code for Android.
9 cmake -DCMAKE_TOOLCHAIN_FILE=android.toolchain.cmake \
14 cmake --build .
18 cmake -DCMAKE_TOOLCHAIN_FILE=android.toolchain.cmake -DANDROID_NDK=<ndk_path> -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" <source_path> && cmake --build .
22 1. Value of `ANDROID_NDK` CMake variable;
24 1. Search under paths from `ANDROID_NDK_SEARCH_PATHS` CMake variable;
31 To build a cmake-based C/C++ project for Android you need:
34 * CMake (>= v2.6.3, >= v2.8.9 recommended) http://www.cmake.org/download
38 ## Difference from traditional CMake
45 So don't even try other targets that can be found in CMake documentation and don't forget to explicitly specify `Release` or `Debug` because CMake builds without a build configuration by default.
51 * `Release` builds without debug info (without `-g`) (because _ndk-build_ always creates a stripped version but cmake delays this for `install/strip` target);
54 * No builds for multiple platforms (e.g. building for both arm and x86 require to run cmake twice with different parameters);
64 Similarly to the NDK build system _android-cmake_ allows to select between several compiler toolchains and target platforms. Most of the options can be set either as cmake arguments: `-D<NAME>=<VALUE>` or as environment variables:
146 _android-cmake_ defines `ANDROID` CMake variable which can be used to add Android-specific stuff:
174 When crosscompiling CMake `find_*` commands are normally expected to find libraries and packages belonging to the same build target. So _android-cmake_ configures CMake to search in Android-specific paths only and ignore your host system locations. So
180 However sometimes you need to locate a host package even when cross-compiling. For example you can be searching for your documentation generator. The _android-cmake_ recommends you to use `find_host_package` and `find_host_program` macro defined in the `android.toolchain.cmake`:
217 * Ensure you are using CMake newer than 2.8.9;
220 * Pass `-GNinja` to `cmake` alongside with other arguments (or choose Ninja generator in `cmake-gui`).
232 * Run `make.exe` or `cmake --build .` for single-threaded build.
236 The _android-cmake_ should correctly handle projects with assembler sources (`*.s` or `*.S`). But if you still facing problems with assembler then try to upgrade your CMake to version newer than 2.8.5