简体   繁体   English

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

[英]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.

相关问题 如何使macdeployqt使用另一个qt-installaton? - How to make macdeployqt use another qt-installaton? 当它复制到 QtWebEngineCore 框架时,如何让 macdeployqt 更改 QtWebEngineProcess.app 中的库名称 - How to make macdeployqt change the library names inside QtWebEngineProcess.app when it copies over QtWebEngineCore framework 如何在Qt 5.4.1中使用macdeployqt -codesign选项 - how to use the macdeployqt -codesign option with Qt 5.4.1 如何在Mac OSX上监视进程/应用程序或文件锁定? - How do I monitor processes/apps or file locks on Mac OSX? 无法再下载Monodevelop - 人们如何在OSX上制作MVC应用程序? - Can't download Monodevelop any more - how do people make MVC apps on OSX now? 如何通知其他Cocoa应用程序偏好被更改? - How do I signal other Cocoa apps that preferences were changed? 如何使用命令行中的Qt 5.2和qmake构建ios可执行文件? - How can I build an ios executable using Qt 5.2 and qmake from the commandline? 如何制作自己的包裹? - How do I make my own package? 如何制作具有 6 个三角形 SCNNode 的六边形? - How do I make a hexagon with 6 triangular SCNNodes? 如何通过xcode“make install”? - How do I “make install” via xcode?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM