linello
linello

Reputation: 8694

How to include Qt libraries with CMake inside a .app project on OSX?

I've created a Qt project using CMake as build system. I would like to include in the deployment phase, the necessary Qt frameworks

Qt3Support.framework/ QtNetwork.framework/  QtXml.framework/
QtCore.framework/     QtOpenGL.framework/   
QtGui.framework/      QtSql.framework/ 

in order to be ready to distribute my program as standalone dmg.

This is usually done with macdeployqt command but it gives me a lot of errors like this:

ERROR: "strip: for architecture x86_64 object:
/Users/rs/build/myapp.app/Contents/Frameworks/QtXmlPatterns.framework/Versions/4/QtXmlPatterns
 malformed object (unknown load command 5)

so I want to be able to do it directly in the deployment phase, is it possible?

Upvotes: 3

Views: 1505

Answers (1)

artm
artm

Reputation: 3678

I was using DeployQt4 and BundleUtilities for some time until I ran into a problem with it which wasn't easy to fix according to one of the authors.

I ended up writing a ruby script that does what BundleUtilities does barring that problem. My script has a limitation currently comparing to the BundleUtilities - it doesn't handle bundles with multiple executables. Writing the same functionality in cmake is beyond my degree of masochism (I managed to understand what BundleUtilities does and how but was appalled by the contraptions they had to use to organize data in memory).

The script itself is available here: https://github.com/artm/vision-ui-skeleton/blob/master/ruby/fixup/fixup.rb

It is used from cmake at the bottom of: https://github.com/artm/vision-ui-skeleton/blob/master/cmake/QArtmRelease.cmake

It works with ruby that comes with OSX 10.6.x and probably higher.

Upvotes: 2

Related Questions