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 13 SET(CMAKE_SYSTEM_NAME Linux) 14 15 IF(NOT CMAKE_C_COMPILER) 16 SET(CMAKE_C_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang) 17 ENDIF() 18 19 IF(NOT CMAKE_CXX_COMPILER) 20 SET(CMAKE_CXX_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang++) 21 ENDIF() 22 23 SET(ANDROID "1" CACHE STRING "ANDROID" FORCE) 24 25 SET(ANDROID_COMMON_FLAGS "-target arm-linux-androideabi --sysroot=${LLVM_ANDROID_TOOLCHAIN_DIR}/sysroot -B${LLVM_ANDROID_TOOLCHAIN_DIR} -mllvm -arm-enable-ehabi") 26 SET(CMAKE_C_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE) 27 SET(CMAKE_CXX_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE) 28 SET(CMAKE_LINK_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_linkflags" FORCE) 29