Skip to content

Commit

Permalink
Specify '-optimize-size' when building Qt6
Browse files Browse the repository at this point in the history
This is a part of effort to further reduce Qt binary sizes (#822).

As far as Qt binaries are concerned, we would prefer binary sizes over
performance as these binaries are not used so often.  This is rather
important for universal binary build in macOS, where we literally
bundle two binaries.

This commit specify '-optimize-size' [1] when configuring Qt6.  The
overall results look OK-ish in macOS and rather impressive in Windows.

 macOS aarch64 release build
  QtCore:         6545752 -> 6354056 =  -191696
  QtGui:          8609112 -> 8237560 =  -371552
  QtWidgets:      7003272 -> 7136344 =  +133072
                                        -430176

 Windows x64_64 release build
  Qt6Core.dll:    5982720 -> 5190656 =  -792064
  Qt6Gui.dll:     6276096 -> 4994048 = -1282048
  Qt6Widgets.dll: 6099456 -> 5074432 = -1025024
                                       -3099136

As '-optimize-size' is something that is officially supported in Qt,
there is expected to be no observable behavior change.

 [1]: https://doc.qt.io/qt-6/configure-options.html#debug-and-release-builds

PiperOrigin-RevId: 573731405
  • Loading branch information
yukawa authored and hiroyuki-komatsu committed Oct 16, 2023
1 parent 42df7f9 commit 5757f28
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/build_tools/build_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def make_configure_options(args: argparse.Namespace) -> list[str]:

qt_configure_options = ['-opensource',
'-c++std', 'c++20',
'-optimize-size',
'-silent',
'-no-cups',
'-no-dbus',
Expand Down

0 comments on commit 5757f28

Please sign in to comment.