Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
}
like image 254
Daniel O Avatar asked Jul 03 '11 12:07

Daniel O


2 Answers

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.

like image 110
jsherer Avatar answered Nov 15 '22 08:11

jsherer


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

like image 21
spraff Avatar answered Nov 15 '22 08:11

spraff