7c0aa83527
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>
34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
# Qt5 has a mechanism to support "device" profiles, so that people can
|
|
# specify the compiler, compiler flags and so on for a specific device.
|
|
|
|
# We leverage this mechanism in the Buildroot packaging of qt5 to
|
|
# simplify cross-compilation: we have our own "device" definition, which
|
|
# allows us to easily pass the cross-compiler paths and flags from our
|
|
# qt5.mk.
|
|
|
|
include(../common/linux_device_pre.conf)
|
|
|
|
# modifications to g++-unix.conf
|
|
QMAKE_CC = $${CROSS_COMPILE}gcc
|
|
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
|
|
QMAKE_CFLAGS_ISYSTEM =
|
|
|
|
# Architecture specific configuration
|
|
include(arch.conf)
|
|
|
|
@EGLFS_DEVICE@
|
|
|
|
include(../common/linux_device_post.conf)
|
|
load(qt_config)
|