简体   繁体   中英

How do I make apps smaller with qmake and macdeployqt

How do I make apps smaller with qmake and macdeployqt?

I have set QT = core gui in the projects.pro file and run qmake and macdeployqt on the resulting app.

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

In total the app 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
}

This is a great article about (re)building Qt statically and dynamically to reduce its size considerably: Building Qt Static (and Dynamic) and Making it Small with GCC, Microsoft Visual Studio, and the Intel Compiler

While this is talking about Qt in the windows context, it does give some good insight into how one would go about compiling for minimal size.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM