gpt4 book ai didi

Qt Mac 部署

转载 作者:行者123 更新时间:2023-12-04 13:09:44 25 4
gpt4 key购买 nike

将 QT 框架添加到我的 .app 包中

我正在关注 Qt 站点上关于部署的文档。
我创建了一个名为 HTTPClient.app 的应用程序

我在 Contents 下创建了 Framework 文件夹并复制了 crypto++ 和 qscintilla 和 Qt 框架,它看起来像这样:

enter image description here

然后我运行 install_name_tool -id -change

DylibFile=libqscintilla2.11.dylib
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName

加密++也是如此。我对 Qt 框架做了以下工作
DylibFile=QtCore.framework/Versions/5/QtCore
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName

DylibFile=QtWidgets.framework/Versions/5/QtWidgets
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName

DylibFile=QtGui.framework/Versions/5/QtGui
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName


DylibFile=QtSql.framework/Versions/5/QtSql
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName

DylibFile=QtNetwork.framework/Versions/5/QtNetwork
install_name_tool -id @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/Frameworks/$DylibFile
install_name_tool -change $DylibFile @executable_path/../Frameworks/$DylibFile $ProjectName.app/Contents/MacOS/$ProjectName

现在,当我运行 otool 时,我得到以下信息:

enter image description here

我得到了 crypto 和 qscintilla 路径,但 Qt 框架不应该也遵循相同的模式吗?它仍然指向原始路径

最佳答案

您可以省去担心如何使用的时间 install_name_tool通过使用提供的工具使用 Qt 框架 macdeployqt ,它位于 Qt 安装的 bin 文件夹中。

此工具将复制所需的 Qt 库并相应地设置路径。因此,假设您的路径中有 Qt bin 文件夹,您需要做的就是调用它:-

macdeployqt HTTPClient.app



请注意,它仅涉及 Qt 框架,因此您仍然必须自己处理其他框架。

关于Qt Mac 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24442358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com