Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to create a Bundle Library (mh_bundle) with qmake on Mac OS X?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Installation and Deployment
10 Posts 4 Posters 9.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    srose
    wrote on 2 Oct 2010, 23:12 last edited by
    #1

    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!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 19 Oct 2010, 11:48 last edited by
      #2

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

      @
      macx:{
      # 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.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        srose
        wrote on 20 Oct 2010, 10:48 last edited by
        #3

        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?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on 20 Oct 2010, 13:17 last edited by
          #4

          You can change the extension like this:

          @
          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:

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

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • S Offline
            S Offline
            spsingh
            wrote on 9 Nov 2010, 11:46 last edited by
            #5

            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

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on 9 Nov 2010, 20:55 last edited by
              #6

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

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • S Offline
                S Offline
                spsingh
                wrote on 10 Nov 2010, 13:43 last edited by
                #7

                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

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on 10 Nov 2010, 13:54 last edited by
                  #8

                  As posted in "this thread":http://developer.qt.nokia.com/forums/viewthread/1632/ you should do this:

                  @
                  rm -rf makefilename.xcodeproj
                  rm Info.plist
                   
                  qmake -spec macx-g++ File.pro
                  @

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on 10 Nov 2010, 14:51 last edited by
                    #9

                    I've added a "Wiki page":http://developer.qt.nokia.com/wiki/Generate_Makefiles_instead_of_XCode_projects_on_Mac_OS_X too, since the question seems to pop up once in a while.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fober
                      wrote on 15 Apr 2015, 15:15 last edited by
                      #10

                      I know the post is quite old now, however I've a solution that works with qmake version 3.0 (and XCode 6.2):
                      you should set the bundle name to the full path of your framework e.g
                      QMAKE_FRAMEWORK_BUNDLE_NAME = $$PWD/Release/yourframeworkname
                      note that the .framework extension is automatically added.
                      When linked to the framework, an application will look for it at this full path location.
                      macdeployqt could be used later to distribute your application.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved