servo/support/android/toolchain.cmake
John Lin fbdb2093dd Fix Android build errors on macOS.
- Add sysroot path to environment variable 'CPPFLAGS':
  When checking C preprocessor, the 'configure' script of libbacktrace uses 'CPPFLAGS' rather than 'CFLAGS' and doesn't get the correct search path. (#15758)
  This check passes on Linux because the '/lib/cpp' fallback is available there.

- Introduce CMake toolchain file for Android cross compiling:
  CMake needs several variables [1] to cross compile for Android.
  It works (accidentally) on Linux because cmake-rs sets compilers correctly and binutils for Linux & Android are pretty much the same.

[1] https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android-with-the-ndk
2017-08-10 12:12:54 +08:00

4 lines
178 B
CMake

set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_NDK $ENV{ANDROID_NDK})
set(CMAKE_ANDROID_API $ENV{NDK_ANDROID_VERSION})
set(CMAKE_ANDROID_ARCH_ABI $ENV{CMAKE_ANDROID_ARCH_ABI})