Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: missing features in CMake vs ndk-build

I'm migrating from ndk-build to CMake (it better integrates with Android Studio, and would enable us to have a single CMakeLists.txt for all platforms).

Unfortunately, our projects use some features of Android.mk that I'm not being able to replicate with CMake. More specifically:

  • TARGET_ARCH: we use this to include different pre-compiled binaries. How can I find the target arch with CMake?

  • LOCAL_ARM_MODE: is this even available in CMake?

like image 554
amfcosta Avatar asked Dec 30 '16 11:12

amfcosta


1 Answers

EDIT:

When using Gradle, CMAKE_ANDROID_ARCH_ABI is not set! Use CMAKE_ANDROID_ARCH or ANDROID_ABI.

ORIGINAL:

After a bit more of Google, I've found the answer here: https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android-with-the-ndk

  • CMAKE_ANDROID_ARCH_ABI or CMAKE_ANDROID_ARCH are similar to the ndk-build TARGET_ARCH.
  • CMAKE_ANDROID_ARM_MODE allows setting the ARM mode (setting it to ON targets 32-bit ARM processors, while to OFF targets 16-bit Thumb processors).
like image 162
amfcosta Avatar answered Oct 04 '22 19:10

amfcosta