set(CMAKE_SYSTEM_NAME Android)
if(NOT $ENV{ANDROID_HOME} STREQUAL "")
  set(CMAKE_ANDROID_NDK $ENV{ANDROID_HOME}/ndk-bundle)
else()
  set(CMAKE_ANDROID_NDK $ENV{HOME}/Android/Sdk/ndk-bundle)
endif()
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
set(CMAKE_ANDROID_STL_TYPE c++_shared)
if(APPLE)
  set(CMAKE_RANLIB "${CMAKE_ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ranlib")
  set(CMAKE_AR "${CMAKE_ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ar")
endif()
