Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Android] Invoking CMake from Gradle instead of the opposite
#1
Brick 
Copied from BB:

Also I recommend that native builds should utilize Android Build Tool's new CMake integration feature. Currently we copy and template build.gradle files, which are hard to work with inside of Android Studio because running make can overwrite my build.gradle changes, and upgrading dependencies becomes a hassle. Also, the build system limits us to compiling one native per arch at a time, which forces the Android source to be compiled multiple times if we want to target multiple architectures (even though the code is the same). We also don't benefit from the ability to make a single APK that supports multiple architectures...

I've tested the NDK integration (with ndk-build, not CMake) in my music application to compile SoundTouch and my JNI wrapper. It works well and also allows me to deploy to my x86 Android emulator without having to switch projects and do another full recompile.

So, to summarize:

[h3]Current Build System (CMake calling Gradle)[/h3]
Pros

* Simple to get the app compiled without getting into Gradle at all.
* Integrates nicely with the buildbot (probably, I haven't looked at the buildbot at all)

Cons

* Doesn't allow for an APK to have multiple architectures inside.
* Entire Android project has to be built multiple times for each architecture.
* Hard for me to work with when I have to deal with Gradle.

[h3]Proposed Build System (Gradle calling CMake)[/h3]
Pros

* Builds the app once, which saves time and disk space.
* We can export multiarch builds.
* No more manual "build.gradle.in" synchronization for me.

Cons

* Doesn't utilize CMake to start compilation, so it isn't straightforward how to build it.
* Doesn't integrate with the buildbot well. (I'm assuming... again I haven't looked into how the buildbot works)

Optimally, we would want multiarch builds, because some users have NO clue what arch their phone is. Sure, arm7 can run on aarch64, but that is optimal. x86 devices like the ZenPhone and Android x86 use libhoudini which lets arm7 code run on x86, but its really slow (no compilation cache, for example).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)