如何使用qmake和macdeployqt使应用程序更小 [英] How do I make apps smaller with qmake and macdeployqt

查看:180
本文介绍了如何使用qmake和macdeployqt使应用程序更小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用qmake和macdeployqt使应用程序更小?

How do I make apps smaller with qmake and macdeployqt?

我在项目.pro文件中设置了QT = core gui,并在生成的应用程序上运行qmake和macdeployqt.

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

问题是程序正在捆绑QtNetwork,QtScript,QtSvg等.我尝试设置QT-=网络脚本svg(然后进行清理,rm -rf * .app,qmake,make).

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).

该应用总计32 MB.

In total the app is 32 MB.

.pro文件:

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
}

推荐答案

这是一篇很棒的文章,内容涉及以静态和动态方式(重新)构建Qt以显着减小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

尽管这是在Windows上下文中谈论Qt的内容,但它确实为如何以最小的大小进行编译提供了很好的见识.

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.

这篇关于如何使用qmake和macdeployqt使应用程序更小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆