如何使用 qmake 和 macdeployqt 缩小应用程序
如何使用 qmake 和 macdeployqt 缩小应用程序?
我已在项目 .pro 文件中设置 QT = core gui 并在生成的应用程序上运行 qmake 和 macdeployqt。
问题是该程序捆绑了 QtNetwork、QtScript、QtSvg 等。我尝试设置 QT -= network script svg (然后 make clean、rm -rf *.app、qmake、make)。
该应用程序总共有 32 MB。
。轮廓:
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
}
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
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一篇关于(重新)静态和动态构建 Qt 以显着减小其大小的精彩文章:使用 GCC、Microsoft Visual Studio 和 Intel 编译器构建 Qt 静态(和动态)并使其小型化
虽然这是在谈论 Windows 中的 Qt上下文,它确实深入了解如何进行最小尺寸的编译。
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.
您可以随后在 构建后步骤。 Qt 库本身默认共享。
You could strip the binary afterwards in a post-build step. The Qt libraries themselves are shared by default.