package/qt5/qt5base: build with correct optimization
Qt5 has predefined optimization flags depending if you're building for size, for debug etc. These flags are defined in mkspecs/common/gcc-base.conf: QMAKE_CFLAGS_OPTIMIZE = -O2 QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Og QMAKE_CFLAGS_OPTIMIZE_SIZE = -Os Then, in common/features/default_post.prf, they add those flags to QMAKE_CFLAGS_RELEASE/QMAKE_CXXFLAGS_RELEASE depending on various build options (optimize_size, optimize_full, optimize_debug): optimize_size { !isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_SIZE) { QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_SIZE QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_SIZE } } else: optimize_full { !isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_FULL) { QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL } } Since this default_post.prf is included *after* our qmake.conf file, these flags override our optimizations flags, which is not good. However, our qmake.conf file is included *after* gcc-base.conf, so we can simply reset those variables to have the empty value, and our optimization flags will be used. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> [Thomas: completely change the approach, by simply resetting the QMAKE_CFLAGS_OPTIMIZE_* variables in qmake.conf] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
0650c4c7a3
commit
7c0aa83527
@ -15,6 +15,10 @@ QMAKE_CXX = $${CROSS_COMPILE}g++
|
||||
# modifications to gcc-base.conf
|
||||
QMAKE_CFLAGS += $${BR_COMPILER_CFLAGS}
|
||||
QMAKE_CXXFLAGS += $${BR_COMPILER_CXXFLAGS}
|
||||
QMAKE_CFLAGS_OPTIMIZE =
|
||||
QMAKE_CFLAGS_OPTIMIZE_DEBUG =
|
||||
QMAKE_CFLAGS_OPTIMIZE_FULL =
|
||||
QMAKE_CFLAGS_OPTIMIZE_SIZE =
|
||||
CONFIG += nostrip
|
||||
|
||||
QMAKE_LIBS += -lrt -lpthread -ldl
|
||||
|
Loading…
Reference in New Issue
Block a user