wasm: use standard clang optimization options

These were mostly identical. Use the base clang config
and then specialize for Emscripten in a separate section.

Behavior changes: QT_CFLAGS_OPTIMIZE_SIZE is now -Oz instead
of -Os. Emscripten does not allow -Og, replace that flag
with -O2 -g.

Change-Id: I08163551ad6b84377b99f287983cc1191521055c
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
This commit is contained in:
Morten Sørvig 2022-10-07 09:53:00 +02:00 committed by Morten Johan Sørvig
parent dbf6e2db3b
commit 69033876c6

View File

@ -73,7 +73,7 @@ endif()
# TODO: Missing mkspecs flags we don't handle below: win32-clang-g++, win32-clang-msvc, rtems-base
#
# gcc and clang base
if(GCC OR CLANG AND NOT WASM)
if(GCC OR CLANG)
set(QT_CFLAGS_OPTIMIZE "-O2")
set(QT_CFLAGS_OPTIMIZE_FULL "-O3")
set(QT_CFLAGS_OPTIMIZE_DEBUG "-Og")
@ -121,12 +121,8 @@ if (QCC)
set(QT_CFLAGS_OPTIMIZE_FULL "-O3")
endif()
# Emscripten Clang
if(WASM)
set(QT_CFLAGS_OPTIMIZE "-O2")
set(QT_CFLAGS_OPTIMIZE_FULL "-O3")
set(QT_CFLAGS_OPTIMIZE_SIZE "-Os")
set(QT_CFLAGS_OPTIMIZE_DEBUG "-g2")
set(QT_CFLAGS_OPTIMIZE_DEBUG "-O2 -g") # -Og is not supported
set(QT_CFLAGS_SSE2 -O2 -msimd128 -msse -msse2)
endif()