Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Cross-Compiling Qtopia Core Applications

Cross-compiling is the process of compiling an application on one machine, producing executable code for a different machine or device. To cross-compile a Qtopia Core application, use the following approach:

Note that the cross-compiling procedure has the configuration process in common with the installation procedure, i.e., you might not necessarily have to perform all the mentioned actions depending on your current configuration.

Step 1: Set the Cross-Compiler's Path

Specify which cross-compiler to use by setting the PATH environment variable. For example, if the current shell is bash, ksh, zsh or sh:

 export PATH=path/to/cross/compiler:$PATH

Step 2: Create a Target Specific qmake Specification

The qmake tool requires a platform and compiler specific qmake.conf file describing the various default values, to generate the appropriate Makefiles. The standard Qtopia Core distribution provides such files for several combinations of platforms and compilers. These files are located in the distribution's mkspecs/qws subdirectory.

Each platform has a default specification. Qtopia Core will use the default specification for the current platform unless told otherwise. To override this behavior, you can either use the configure script's -platform option to specify another platform, or you can use the -xplatform option to use the specification for another architecture. For example:

 ./configure <other options>
             -xplatform qws/linux-preferredarchitecture-g++

If neither of the provided specifcations fits your taget device, you can create your own. To create a custom qmake.conf file, just copy and customize an already existing file. For example:

 cp path/to/Qtopia/Core/mkspecs/qws/linux-mips-g++/...
    path/to/Qtopia/Core/mkspecs/qws/linux-myarchitecture-g++/...

Note that it is recommended to copy the entire directory.

Note also that when providing you own qmake specifcation, you must use the configure script's -xplatform option to make Qtopia Core aware of the custom qmake.conf file.

Step 3: Provide Architecture Specific Files

Starting with Qt 4, all of Qt's implicitly shared classes can safely be copied across threads like any other value classes, i.e., they are fully reentrant. This is accomplished by implementing reference counting operations using atomic hardware instructions on all the different platforms supported by Qt.

To support a new architecture, it is important to ensure that these platform-specific atomic operations are implemented in a corresponding header file (qatomic_ARCH.h), and that this file is located in Qt's src/corelib/arch directory. For example, the Intel 80386 implementation is located in src/corelib/arch/qatomic_i386.h.

See the Implementing Atomic Operations documentation for details.

Step 4: Provide Hardware Drivers

Without the proper mouse and keyboard drivers, you will not be able to give any input to your application when it is installed on the target device. You must also ensure that the appropriate screen driver is present to make the server process able to put the application's widgets on screen.

Qtopia Core provides several ready-made mouse, keyboard and screen drivers, see the pointer handling, character input and display management documentation for details.

In addition, custom drivers can be added by deriving from the QWSMouseHandler, QWSKeyboardHandler and QScreen classes respectively, and by creating corresponding plugins to make use of Qt's plugin mechanism (dynamically loading the drivers into the server application at runtime). Note that the plugins must be located in a location where Qt will look for plugins, e.g., the standard plugin directory.

See the How to Create Qt Plugins documentation and the Plug & Paint example for details.

Step 5: Build the Target Specific Executable

Before building the executable, you must specify the target architecture as well as the target specific hardware drivers by running the configure script:

 cd path/to/Qtopia/Core
 ./configure -embedded <architecture> -qt-kbd-<keyboarddriver>
             -qt-mouse-<mousedriver> -qt-gfx-<screendriver>

It is also important to make sure that all the third party libraries that the application and the Qt libraries require, are present in the tool chain. In particular, if the zlib and jpeg libraries are not available, they must be included by running the configure script with the -L and -I options. For example:

 cd path/to/Qtopia/Core
 ./configure  <other options>
              -L /path/to/libjpeg/libraries -I /path/to/libjpeg/headers

The JPEG source can be downloaded from http://www.ijg.org/. The Qtopia Core distribution includes a version of the zlib source that can be compiled into the Qtopia core library. If integrators wish to use a later version of the zlib library, it can be downloaded from the http://www.gzip.org/zlib/ website.

Then build the executable:

 cd path/to/myApplication
 qmake -project
 qmake
 make

That's all. Your target specific executable is ready for deployment.

See also:

Qtopia Core Architecture and Deploying Qtopia Core Applications.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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.2
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 !
 
 
 
 
Partenaires

Hébergement Web