How to reduce application size with qmake and macdeployqt

How to reduce application size with qmake and macdeployqt?

I set QT = core gui in the .pro project file and ran qmake and macdeployqt in the resulting application.

The problem is that the program bundles QtNetwork, QtScript, QtSvg, etc. I tried setting QT - = network script svg (and then doing clean, rm -rf * .app, qmake, make).

Total application is 32 MB.

.pro file:

TEMPLATE = app TARGET = throw DEPENDPATH += . INCLUDEPATH += . CONFIG += x86_64 release QT = core gui unix { CONFIG += link_pkgconfig PKGCONFIG += glib-2.0 } # Input SOURCES += main.cpp # Headers HEADERS += throw.h RESOURCES += throw.qrc ICON = throw.png mac { QMAKE_INFO_PLIST = Info.plist ICON = throw.icns } 
+6
source share
2 answers

This is a great article on (re) building Qt statically and dynamically to significantly reduce its size: Building Qt Static (and dynamic) and making it small with GCC, Microsoft Visual Studio and Intel Compiler

Although we are talking about Qt in the context of Windows, this does provide some insight into how the minimum size could be compiled.

+4
source

You can strip the binary afterwards in the post-build step . The Qt libraries themselves are shared by default .

+1
source

Source: https://habr.com/ru/post/891906/


All Articles