• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
14SET(CMAKE_C_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang)
15SET(CMAKE_CXX_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang++)
16SET(ANDROID "1" CACHE STRING "ANDROID" FORCE)
17
18SET(ANDROID_COMMON_FLAGS "-target arm-linux-androideabi --sysroot=${LLVM_ANDROID_TOOLCHAIN_DIR}/sysroot -B${LLVM_ANDROID_TOOLCHAIN_DIR} -mllvm -arm-enable-ehabi")
19SET(CMAKE_C_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE)
20SET(CMAKE_CXX_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE)
21SET(CMAKE_LINK_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_linkflags" FORCE)
22