How to create a Bundle Library (mh_bundle) with qmake on Mac OS X?
I’m a newbee to Qt and qmake and I like to know if it’s possible to instruct qmake
to build a “Bundle Library” (mh_bundle) under Mac OS X using the TEMPLATE
and CONFIG variables? I already managed to make a “Dynamic Library” (mh_dylib)
and a “Framework” (mh_dylib). If there is no direct solution, how is the best way to
achieve this goal?
Thank you, any help is very appreciated!
There is no switch in qmake directly. You can manipulate the linker flags in your .pro file like this:
- # plugin necessary because otherwise compatibility
- # version parameters are added, which are not
- # supported with bundles
- CONFIG += plugin
- QMAKE_LFLAGS_PLUGIN -= -dynamiclib
- QMAKE_LFLAGS_PLUGIN += -bundle
You can tweak other qmake variables too, eg. for setting the name and extension of the generated file.
Thanks for your reply. This configuration really solved my problem.
You mentioned that I can tweak other qmake variables for setting
the name and extension of the generated file. I tried different ones
but the name of the bundle library seems to have always the same
pattern like lib[TARGET].dylib
Do you know which qmake variables I have to use to change that?
I am using qmake to create an xcode project from a .pro file. The command I am using is
qmake -spec macx-xcode File.pro
What settings in the .pro file should I use so that the mach-o-type is bundle in the generated XCode project. I have used all the options as suggested in this thread and more but at most I get dylib.
If I use lib Template and lib_bundle CONFIG then I get framework after building the XCode project.
The config suggested in this thread above only makes a dylib but does not create a bundle.
As posted in this thread [developer.qt.nokia.com] you should do this:
- rm -rf makefilename.xcodeproj
- rm Info.plist
- qmake -spec macx-g++ File.pro