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