Issue
I recently switched my Android/Application mk file to a CMakeLists.txt file.
A good portion of the code is native in c/c++ (hence why cmake's debugging ability is required).
Now though, I am comparing the two builds, and the one built with ndk is much faster ...
I have added in the "-Os" flag to the
externalNativeBuild {
cmake {
arguments "-Os"
}
}
block inside the build.gradle file.
My question is what is the differences of compilation here ?? What about ndk-build and cmake is different that would cause this ??
I feel as if this is a dumb question with a quick answer
Solution
Answering my own question here :
Since we're using cmake and not ndk-build ... Build Variant actually matters for compiling native code. Building with Release fixes the performance issue.
Note : -O2 flag is included by the android.toolchain.cmake file
Answered By - Arjun
Answer Checked By - Timothy Miller (JavaFixing Admin)