Qt Mac OS应用程序部署缺失框架 [英] Qt Mac OS Application deployment missing framework

查看:136
本文介绍了Qt Mac OS应用程序部署缺失框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Qt macdeployqt 部署我的 C ++ 应用程序

I use Qt and macdeployqt to deploy my C++ app.

它在包应用中包含 OpenGL和Qt Frameworks ,但错过了其他一些(即: SDL ),如果 SDL框架不存在,该应用程序在其他系统上不起作用。这是我的pro文件

It include OpenGL and Qt Frameworks in the bundle app but miss some others (ie : SDL) and the app doesn't work on others system if the SDL framework is absent. Here's my pro file

QT      += core
QT  += xml
QT  += opengl
QT      += gui

TARGET = StripTest
CONFIG   += console
TEMPLATE = app


#Main app
SOURCES += main.cpp \
    StripWindow.cpp \
    MainWindow.cpp \

HEADERS += StripWindow.h \
    MainWindow.h\

#Graphics
SOURCES += \
    ../../libs/PhGraphic/SDLMain.cpp \

INCLUDEPATH +=  ../../libs \
        /Library/Frameworks/ \

LIBS += -framework SDL -framework SDL_image -framework SDL_ttf

应该编译框架吗?

编辑:如果我在包上手动复制框架,问题是没有解决的。它必须出现在 / Library / Frameworks /

Edit : the problem isn't solved if I copy the framework manually on the bundle. It has to be present on /Library/Frameworks/

推荐答案

macdeployqt将只复制和修复所需的Qt框架到您的应用程序。

macdeployqt will only copy and fix up the required Qt Frameworks to your application.

如果在应用程序的可执行文件(在软件包的Contents / MacOS文件夹中)运行otool -L,您将看到库框架被引用来自。

If you run "otool -L" on your application's executable (in the Contents/MacOS folder of the bundle), you'll see where the library frameworks are being referenced from.

与.pro文件中列出的Qt相比,其他库将需要将它们复制到应用程序包的Frameworks文件夹中,然后运行命令install_name_tool来更新应用程序引用它们的路径。

Other libraries than those from Qt, listed in the .pro file, will need you to copy them in to the Frameworks folder of the application bundle and then run the command install_name_tool to update the paths of where the application references them.

我建议您创建一个批处理脚本,在编译Qt OSX时作为后处理事件运行应用程式。

I suggest you create a batch script for this, to run as a post-process event when compiling Qt OSX apps.

这篇关于Qt Mac OS应用程序部署缺失框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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