How do I make apps smaller with qmake and macdeployqt

£可爱£侵袭症+ 提交于 2019-12-21 04:49:19

问题


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
}

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/6562725/how-do-i-make-apps-smaller-with-qmake-and-macdeployqt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!