[oe] [meta-qt5][PATCH v2] qtbase: add a config option to optimize for size

Kwangsub Kim kwangsub.kim at qt.io
Mon Feb 19 08:53:21 UTC 2018


The '-optimize-size' option would enable the compiler to optimize
for size instead of speed. If the global compiler option already
included '-Os', this option would be enabled by default.

It would affect the whole Qt libraries and Qt applications as well.
This feature is available in Qt 5.9+.

Signed-off-by: Kwangsub Kim <kwangsub.kim at qt.io>
---
 recipes-qt/qt5/qtbase_git.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/recipes-qt/qt5/qtbase_git.bb b/recipes-qt/qt5/qtbase_git.bb
index 4f3ade2..208a755 100644
--- a/recipes-qt/qt5/qtbase_git.bb
+++ b/recipes-qt/qt5/qtbase_git.bb
@@ -147,6 +147,9 @@ PACKAGECONFIG[widgets] = "-widgets,-no-widgets"
 PACKAGECONFIG[libproxy] = "-libproxy,-no-libproxy,libproxy"
 PACKAGECONFIG[libinput] = "-libinput,-no-libinput,libinput"
 PACKAGECONFIG[journald] = "-journald,-no-journald,systemd"
+PACKAGECONFIG[optimize-size] = "-optimize-size,${QT_DEFAULT_OPTIMIZATION_FOR_SIZE}"
+
+QT_DEFAULT_OPTIMIZATION_FOR_SIZE = "${@bb.utils.contains('SELECTED_OPTIMIZATION', '-Os', '-optimize-size', '', d)}"
 
 QT_CONFIG_FLAGS_GOLD = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '-use-gold-linker', '-no-use-gold-linker', d)}"
 QT_CONFIG_FLAGS += " \
-- 
2.7.4




More information about the Openembedded-devel mailing list