October 3, 2010

srose srose
Lab Rat
1 posts

How to create a Bundle Library (mh_bundle) with qmake on Mac OS X?

 

Hi All,

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!

8 replies

October 19, 2010

Volker Volker
Ant Farmer
5428 posts

There is no switch in qmake directly. You can manipulate the linker flags in your .pro file like this:

  1. macx:{
  2.     # plugin necessary because otherwise compatibility
  3.     # version parameters are added, which are not
  4.     # supported with bundles
  5.     CONFIG += plugin
  6.     QMAKE_LFLAGS_PLUGIN -= -dynamiclib
  7.     QMAKE_LFLAGS_PLUGIN += -bundle
  8. }

You can tweak other qmake variables too, eg. for setting the name and extension of the generated file.

October 20, 2010

srose srose
Lab Rat
1 posts

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?

October 20, 2010

Volker Volker
Ant Farmer
5428 posts

You can change the extension like this:

  1. QMAKE_EXTENSION_SHLIB = MyFancyPlugIn

But I don’t see a way to get rid of the lib prefix. Changing QMAKE_PREFIX_SHLIB does not work. You could add a post linking command like this:

  1. QMAKE_POST_LINK = mv -f $(TARGET) awesomestuff.coolPlugin

November 9, 2010

spsingh spsingh
Lab Rat
27 posts

Hi,
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.

Thanks

November 9, 2010

Volker Volker
Ant Farmer
5428 posts

Sorry, I can’t help with that; I never used XCode together with qmake and .pro projects.

November 10, 2010

spsingh spsingh
Lab Rat
27 posts

Can you please help me figuring out how to compile pro file through qmake. I am sorry if this is mundane but I am using the following
qmake File.pro -o makefilename

The output I get is makefilename.xcodeproj which is an xcode project. How do I compile and have a make file for a pro file.
Thanks

November 10, 2010

Volker Volker
Ant Farmer
5428 posts

As posted in this thread [developer.qt.nokia.com] you should do this:

  1. rm -rf makefilename.xcodeproj
  2. rm Info.plist
  3.  
  4. qmake -spec macx-g++ File.pro

November 10, 2010

Volker Volker
Ant Farmer
5428 posts

I’ve added a Wiki page [developer.qt.nokia.com] too, since the question seems to pop up once in a while.

 
  ‹‹ Qt 4.7.0 Building Problem on Mac OS Snow Leopard      install mysql driver for qt in ubuntu ››

You must log in to post a reply. Not a member yet? Register here!