Getting QMake to generate a proper .app

有些话、适合烂在心里 提交于 2019-12-06 07:08:08

问题


I have a large exiting C++ project involving:

  • 4 applications
  • 50+ libraries
  • 20+ third party libraries

The project uses QMake (part of Trolltech's Qt) to build the production version on Linux, but I've been playing around at building it on MacOS.

I can build in on MacOS using QMake just fine but I'm having trouble producing the final .app. It needs collecting all the third party frameworks and dynamic libraries, all the project's dynamic libraries and making sure the application finds them.

I've read online about using install_name_tool but was wondering if there's a process to automate it.

(Maybe the answer is to use XCode, see related question, but it would have issues with building uic and moc)

Thanks


回答1:


I'm sure this could be of some great help for you :

deployqt

Hope this helps !




回答2:


We have the same problem at Last.fm, I looked at DeployQt and it's not much use if you have third party libraries. In the end I wrote a perl script that generates a Makefile, which you can use to generate a .app and/or .dmg.

I uploaded it here: http://www.methylblue.com/detritus/QMake.dmg/

To use it add this to your application's pro file:

 macx*:!macx-xcode:release {
     system( QT=\'$$QT\' QMAKE_LIBDIR_QT=\'$$QMAKE_LIBDIR_QT\' $$ROOT_DIR/common/dist/mac/Makefile.dmg.pl $$DESTDIR $$VERSION $$LIBS > Makefile.dmg )
     QMAKE_EXTRA_INCLUDES += Makefile.dmg   
}

I'm sure it's not all yet portable, but it would be good for someone else to use and see if that is so.

This is basically the first official release of this code, so please send me bug reports, and also, improvements. Thanks.




回答3:


I side-stepped this problem completely by building my Qt app statically on OS X. That might not be practical for you though.



来源:https://stackoverflow.com/questions/26904/getting-qmake-to-generate-a-proper-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!