[Solved][Moved]How to build static Mac Qt file for distribution...



  • Hi...

    I'm a bit new to Qt and really new to Qt on a Mac. I'm still getting my head around what an Apple bundle is and if that is what I really want. Add to that, I am uncertain on how to include Qt "*.ini" files as well as an SQL data base file into a bundle (if a bundle is waht I need). And if that was not enough, I am trying to read this:
    http://developer.qt.nokia.com/doc/qt-4.7/deployment-mac.html
    and am quickly getting no where.

    My background is Unix, then Windows then a little bit of Mac.

    Perhaps it is best to state what I have & need:

    1. I have a working Qt application which runs on a Window, Linux and Mac machine.
    2. All these computers are loaded up with a Qt development package.
    3. My Qt application uses a Qt *.ini file and a SQL database file.
    4. I would like to give a self contained copy of the program to the marketer who has a Mac where Qt is not installed and is never going to be installed.

    So, I'm trying to make #4 above to happen. I am reading the above web page. But I don't even know where the Mac's Qt directory is so I can't even carry out the configure step to install the Qt Static Libraries.

    Any help would be appreciated.

    -thanks



  • Don't use static libraries -- compile Qt as frameworks and use the macdeployqt script (or follow the instructions manually) to create an application bundle, containing both your application and Qt libraries.



  • @peppe
    Thanks, that worked. Although I am still struggling along in Mac land. It is very difficult to figure out where OSX puts executables. And the fact that the names of the executables in the instructions do not match what is downloaded (I am not sure if any unpacking occurred) doesn't help. I tried using the Unix/Linux updatedb and locate utilities but I am wondering if they operate the same here in Mac land. Regardless, I was able to create a "Mac bundle" (I think that's what they are called) that executed our Qt application on a Mac which (I believe) had not had any Qt support installed. Yeah!



  • A Mac OS X application bundle is just a directory with a special extension (.app in this case). From the file system view it is a directory, the Finder shows it as a file (you can view the contens by right-click on the app and choosing "show package contentes").

    The anatomy of an application is described in "Apple's Bundle Programming Guide":http://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html.

    Mac users are used to just drag an application bundle and drop it wherever they want. The usual place is the /Applications folder, but it is by no means a "must". One can happily drag the bundle to the desktop, for instance.

    In order to distribute the application, you have basically two options:

    • compress the bundle and distribute the resulting archive (eg. myapp.zip)
    • create a disk image file, copy the bundle there and distribute the disk image (a disk image is similar to an iso image)

    The ZIP alternative is easier for you, the disk image is what's more commonly but slightly more work for you.

    A quick and short way to create an image is this command line:

    @
    cd /path/to/the/dir/with-your-app
    hdiutil create -format UDBZ -quiet -srcfolder YourApp.app YourAppArchive.dmg
    @

    This will create a compressed disk image named YourAppArchive.dmg in the same folder and copies the application bundle into it. You then can distribute the dmg to your Mac users.



  • @Volker
    Thank you - that's clear enough even I can follow it. Very nice of you to take the time.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.