[CMake] MacOSX, Qt plugins and BundleUtilities -- not building proper bundle?

Michael Jackson mike.jackson at bluequartz.net
Mon Oct 25 12:05:48 EDT 2010


On Oct 25, 2010, at 11:58 AM, kent williams wrote:

> Like everyone else I started here to build my Qt app with CMake:
> http://www.cmake.org/Wiki/BundleUtilitiesExample
>
> Like a lot of things in CMake this involves copying a bunch of brittle
> CMake code into your CMakeLists.txt, and seems like it has too many
> moving parts and failure points, but hey, we shouldn't look a gift
> horse in the mouth, right?
>
> Well, now I understand a little better than when I started about what
> is going on, and I don't think the right things are happening, when it
> comes to plugins.
>
> There is this code:
>
> #--------------------------------------------------------------------------------
> # Install needed Qt plugins by copying directories from the qt  
> installation
> # One can cull what gets copied by using 'REGEX "..." EXCLUDE'
> INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION
> ${plugin_dest_dir}/plugins COMPONENT Runtime)
>
> I don't know what to make of this, because according to CMake
> documentation, this should recursively copy the imageformats directory
> into the app bundle.  But when I examine the created bundle
> <appname>.app/Contents/MacOS/plugins is empty.
>
> But when fixup_bundle does its magic, it copies all the imageformat
> shared libraries into <appname>.app/Contents/MacOS/plugins
>
> And furthermore, could the Qt.conf file be used to better organize an
> app bundle?  At this point it gets created as an empty file in
> <appname>.app/Contents/Resources/qt.conf
> According to http://doc.qt.nokia.com/4.7/qt-conf.html
>
> I could just buck up and do the work to get my app bundle organized
> properly, but I think this is something that should probably be part
> of the CMake distribution -- there should be a more streamlined,
> simpler way to deploy proper app bundles.

So my question would be what is "proper". Are you just deploying an  
Application to other "users" versus "developers"? Users will never see  
or care about the insides. Developers may be a bit more exacting in  
their standards.

I have scripts that find all the qt image format plugins, create CMake  
variables for them and then use those variables to populate the proper  
scripts to copy them from the Qt installation into the app bundle. I  
just stick them in *.app/Contents/plugins/imageformats/* and have an  
empty qt.conf file put in the *.app/Contents/Resources directory. Qt  
Frameworks go in *.app/Contents/Frameworks. Not sure what is not  
"proper" about that.

I do agree that some the packaging code is "brittle". I guess some of  
us have done this enough times that we have our own set of CMake files  
that does all of this setup for BundleUtilities.

The other issue that I run into is with my own plugins and naming. The  
Qt Plugins you are looking for very specific names and know where to  
copy those. With your own plugins you need to watch the naming or you  
may end up with them copied into the wrong location. Just FYI if that  
is something you are doing.

___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net
BlueQuartz Software               Dayton, Ohio






More information about the CMake mailing list