Developing Qt Applications on Mac OS X
|
Mac OS X Version | Cat Name | Native API Used by Qt | Bits available to address memory | CPU Architecture Supported | Development Platform |
---|---|---|---|---|---|
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 |
Carbon and Cocoa both have their advantages and disadvantages. Probably the easiest way to determine is to look at the version of Mac OS X you are targetting. If you are starting a new application and can target 10.5 and up, then please consider Cocoa only. If you have an existing application or need to target earlier versions of the operating system and do not need access to 64-bit or newer Apple technologies, then Carbon is a good fit. If your needs fall in between, you can go with a 64-bit Cocoa and 32-bit Carbon universal application with the appropriate checks in your code to choose the right path based on where you are running the application.
In 2006, Apple begin transitioning from PowerPC (PPC) to Intel (x86) systems. Both architectures are supported by Qt. The release of Mac OS X 10.5 in October 2007 added the possibility of writing and deploying 64-bit GUI applications. Qt 4.5 supports both the 32-bit (PPC and x86) and 64-bit (PPC64 and x86-64) versions of PowerPC and Intel-based systems are supported.
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:
Architecture | Flag |
---|---|
Intel, 32-bit | -arch x86 |
Intel, 64-bit | -arch x86_64 |
PPC, 32-bit | -arch ppc |
PPC, 64-bit | -arch ppc64 |
If there are no -arch flags specified, configure builds for the 32-bit architecture, if you are currently on one. Universal binaries were initially used to simplify the PPC to Intel migration. You can use -universal to build for both the 32-bit Intel and PPC architectures.
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
On the command-line, applications can be built using qmake and make. Optionally, qmake can generate project files for Xcode with -spec macx-xcode. If you are using the binary package, qmake generates Xcode projects by default; use -spec macx-gcc to generate makefiles.
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
In general, Qt supports building on one Mac OS X version and deploying on all others, both forward and backwards. You can build on 10.4 Tiger and run the same binary on 10.3 and 10.5.
Some restrictions apply:
Universal binaries can be used to provide a smorgasbord of configurations catering to all possible architectures.
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 (macdeployqt) 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.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.5 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com