1*09467b48Spatrick# Toolchain config for Android NDK.
2*09467b48Spatrick# This is expected to be used with a standalone Android toolchain (see
3*09467b48Spatrick# docs/STANDALONE-TOOLCHAIN.html in the NDK on how to get one).
4*09467b48Spatrick#
5*09467b48Spatrick# Usage:
6*09467b48Spatrick# mkdir build; cd build
7*09467b48Spatrick# cmake ..; make
8*09467b48Spatrick# mkdir android; cd android
9*09467b48Spatrick# cmake -DLLVM_ANDROID_TOOLCHAIN_DIR=/path/to/android/ndk \
10*09467b48Spatrick#   -DCMAKE_TOOLCHAIN_FILE=../../cmake/platforms/Android.cmake ../..
11*09467b48Spatrick# make <target>
12*09467b48Spatrick
13*09467b48SpatrickSET(CMAKE_SYSTEM_NAME Linux)
14*09467b48Spatrick
15*09467b48SpatrickIF(NOT CMAKE_C_COMPILER)
16*09467b48Spatrick SET(CMAKE_C_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang)
17*09467b48SpatrickENDIF()
18*09467b48Spatrick
19*09467b48SpatrickIF(NOT CMAKE_CXX_COMPILER)
20*09467b48Spatrick SET(CMAKE_CXX_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang++)
21*09467b48SpatrickENDIF()
22*09467b48Spatrick
23*09467b48SpatrickSET(ANDROID "1" CACHE STRING "ANDROID" FORCE)
24*09467b48Spatrick
25*09467b48SpatrickSET(ANDROID_COMMON_FLAGS "-target arm-linux-androideabi --sysroot=${LLVM_ANDROID_TOOLCHAIN_DIR}/sysroot -B${LLVM_ANDROID_TOOLCHAIN_DIR}")
26*09467b48SpatrickSET(CMAKE_C_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE)
27*09467b48SpatrickSET(CMAKE_CXX_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE)
28*09467b48SpatrickSET(CMAKE_EXE_LINKER_FLAGS "-pie" CACHE STRING "toolchain_exelinkflags" FORCE)
29*09467b48Spatrick
30