3

I have a android-ndk based app, which is built with cmake, and I want to integrate that project into an AOSP-build and have it included in the resulting android image. However there seems to be no possibility to directly start a cmake build in the AOSP build system.

For example in the android-7.1.1._r35 source tree, the zlib-external has a CMakeLists.txt, but additionally an Android.mk file, which seems to actually be used for compilation with AOSP instead of cmake. The build instructions are duplicated in both files:

external/zlib/src/CMakeLists.txt
external/zlib/Android.mk

Since the project has quite a lot of source files (~1500 cpps), I'm trying to avoid the tedious task of converting and maintaining an extra build system.

Is it possible to invoke a cmake build from the Android.mk based build system or do I have to write an Android.mk file to build my app? If cmake can be called, how do I do it?

andreas-hofmann
  • 2,378
  • 11
  • 15

2 Answers2

1

For the record, in case someone stumbles upon this in the future: There seems to be a solution, though it's hacky - see Build gradle system app as part of AOSP build for reference. This solution seems to work, but the gradle/cmake build is started directly when the makefiles are parsed.

andreas-hofmann
  • 2,378
  • 11
  • 15
0

It is not possible to build cmake projects in the AOSP build system.

Dan Albert
  • 10,079
  • 2
  • 36
  • 79
  • Thanks for your input. Do you per chance know anything about future plans to integrate CMake functionality into the build system? – andreas-hofmann May 02 '17 at 06:10
  • No plans. That's generally not the approach we take in AOSP. The system works a lot better if we just rewrite build files in our own build language rather than trying to mix and match a handful of different build systems into one build. – Dan Albert May 02 '17 at 07:33