[英]How do I make apps smaller with qmake and macdeployqt
How do I make apps smaller with qmake and macdeployqt?如何使用 qmake 和 macdeployqt 使应用程序更小?
I have set QT = core gui in the projects.pro file and run qmake and macdeployqt on the resulting app.我在 projects.pro 文件中设置了 QT = core gui 并在生成的应用程序上运行 qmake 和 macdeployqt。
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).问题是程序捆绑了 QtNetwork、QtScript、QtSvg 等。我尝试设置 QT -= 网络脚本 svg(然后 make clean、rm -rf *.app、qmake、make)。
In total the app is 32 MB.该应用程序总共为 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 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.虽然这是在 windows 上下文中讨论 Qt,但它确实提供了一些关于 go 如何编译为最小尺寸的良好见解。
You could strip the binary afterwards in a post-build step .之后您可以在构建后步骤中剥离二进制文件。 The Qt libraries themselves are shared by default .
默认情况下,Qt 库本身是共享的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.