Enabled optimizations for Distribution configuration on Android #747
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This enables optimizations when building the
Distribution
configuration for Android, by simply copying the compile flags fromCMAKE_CXX_FLAGS_RELEASE
intoCMAKE_CXX_FLAGS_DISTRIBUTION
, which at the moment consists of-O3
and-DNDEBUG
.I'm not very familiar with Android Studio and Gradle, so I'm not sure what the deal has been until now, but I get the feeling that the
buildTypes
defined in the Gradle files are limited todebug
andrelease
, which presumably translate to something likeCMAKE_BUILD_TYPE=Debug
andCMAKE_BUILD_TYPE=Release
respectively, meaning projects likePerformanceTest
has only ever been runningRelease
on Android?In either case, when building from command-line using the NDK it seems to be like any other LLVM toolchain and you can use whatever configurations you want, and the
Distribution
configuration doesn't currently define any flags on Android, thereby omitting optimizations entirely.I wasn't sure whether to copy the flags from
CMAKE_CXX_FLAGS_RELEASE
or whether to just define them explicitly, but seeing as how none of the other configurations have defined them explicitly I opted to simply copy them.