![]() |
Home · Examples |
A overview of items to be aware of when developing Qt applications on Mac OS X
This detail is typically not important to Qt application developers. Qt is cross-platform across Carbon and Cocoa, and Qt applications behave the same way when configured for either one. Eventually, the Carbon version will be discontinued. This is something to keep in mind when you consider writing code directly against native APIs.
The current binary for Qt is built for Carbon. If you want to choose which framework Qt will use, you must build from scratch. Carbon or Cocoa is chosen when configuring the package for building. The configure process selects Carbon by default, to specify Cocoa use the -cocoa flag. configure for a 64-bit architecture using one of the -arch flags (see Universal Binaries).
Currently, Apple's GCC 4.0.1 is used by default. When building on 10.5, Apple's GCC 4.2 is also available and selectable with the configure flag: -platform macx-g++42. GCC 3.x will not work. Experimental LLVM-GCC support is available by passing in the -platform macx-llvm flag.
The following table summarizes the different versions of Mac OS X and what capabilities are used by Qt.
10.3 | Panther | Carbon | 32 | PPC | No |
10.4 | Tiger | Carbon | 32 | PPC/Intel | Yes |
10.5 | Leopard | Carbon | 32 | PPC/Intel | Yes |
10.5 | Leopard | Cocoa | 32/64 | PPC/Intel | Yes |
Universal binaries are used to bundle binaries for more than one architecture into a single package, simplifying deployment and distribution. When running an application the operating system will select the most appropriate architecture. Universal binaries support the following architectures; they can be added to the build at configure time using the -arch arguments:
Intel, 32-bit | -arch x86 |
Intel, 64-bit | -arch x86_64 |
PPC, 32-bit | -arch ppc |
PPC, 64-bit | -arch ppc64 |
Note: The -arch flags at configure time only affect how Qt is built. Applications are by default built for the 32-bit architecture you are currently on. To build a universal binary, add the architectures to the CONFIG variable in the .pro file:
CONFIG += x86 ppc x86_64 ppc64
The result of the build process is an application bundle, which is a directory structure that contains the actual application executable. The application can be launched by double-clicking it in Finder, or by referring directly to its executable from the command line, i. e. myApp.app/Contents/MacOS/myApp.
If you wish to have a command-line tool that does not use the GUI (e.g., moc, uic or ls), you can tell qmake not to execute the bundle creating steps by removing it from the CONFIG in your .pro file:
CONFIG -= app_bundle
Some restrictions apply:
Mac applications are typically deployed as self-contained application bundles. The application bundle contains the application executable as well as dependencies such as the Qt libraries, plugins, translations and other resources you may need. Third party libraries like Qt are normally not installed system-wide; each application provides its own copy.
The most common way to distribute applications is to provide a compressed disk image (.dmg file) that the user can mount in Finder. The Mac deployment tool can be used to create the self-contained bundles, and optionally also create a .dmg archive. See the Mac deployment guide for more information about deployment. It is also possible to use an installer wizard. More information on this option can be found in Apple's documentation.
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Jambi 4.5.2_01 |