android-clang: Use -Oz instead of -Os to produce smaller binaries

For clang -Os is very similar to -O2 and doesn't really reduce size much.
-Oz is usually what you want to use with clang for code reduction.

Now clang binaries are only 9% bigger than gcc's, instead of 22%.

Change-Id: Ib0ba560be26db68aeb21c13df4b151b7fbd81431
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Sérgio Martins 2017-07-28 22:20:43 +01:00
parent 286c53f217
commit b7a898b8fe

View File

@ -15,8 +15,14 @@ QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
QMAKE_CFLAGS_WARN_ON = -Wall -W QMAKE_CFLAGS_WARN_ON = -Wall -W
QMAKE_CFLAGS_WARN_OFF = QMAKE_CFLAGS_WARN_OFF =
equals(ANDROID_TARGET_ARCH, armeabi-v7a) | equals(ANDROID_TARGET_ARCH, armeabi) { equals(ANDROID_TARGET_ARCH, armeabi-v7a) | equals(ANDROID_TARGET_ARCH, armeabi) {
contains(QMAKE_COMPILER, clang) {
QMAKE_CFLAGS_RELEASE = -Oz
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Oz
} else {
QMAKE_CFLAGS_RELEASE = -Os QMAKE_CFLAGS_RELEASE = -Os
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
}
QMAKE_CFLAGS_DEBUG = -g -marm -O0 QMAKE_CFLAGS_DEBUG = -g -marm -O0
equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) { equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) {
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND