|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

[Contents]

# Cross-Compiling Applications

Cross-compiling is the process of executing a compile on one machine, producing object/executable code for a different machine or device.

- Step 1: Setting the Cross-Compiler's Path
- Step 2: Including the Required Libraries
- Step 3: Creating a Target Specific qmake Specification
- Step 4: Providing Mouse and Keyboard Drivers
- Step 5: Building the Target Specific Executable

## Step 1: Setting the Cross-Compiler's Path

Specify the cross compiler 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: Including the Required Libraries

Make sure that all the libraries needed for the application, as well as for the Qt libraries, 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 -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.

## Step 3: Creating a Target Specific qmake Specification

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

Create a `qmake.conf` fitting your target environment by copying an already existing file. It is recommended to copy the entire directory, for example:

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

Then customize the new platform specific `qmake.conf` file.

## Step 4: Providing Mouse and Keyboard Drivers

Without the proper mouse and keyboard drivers, you won't be able to give any input to your application when it is installed on the target device.

By default, Qtopia Core provides mouse drivers for the MouseMan, IntelliMouse, Microsoft, NEC Vr41XX, Linux Touch Panel and Yopy protocols as well as the universal touch screen library, tslib. The provided keyboard drivers are SL5000, Yopy, Vr41XX, console (TTY) and USB.

Other drivers can be added by deriving from the QWSMouseHandler and QMouseDriverPlugin classes, or the QWSKeyboardHandler and QKbdDriverPlugin classes, and using Qt's plugin mechanism. See the How to Create Qt Plugins documentation and the Plug & Paint example for details.

## Step 5: Building the Target Specific Executable

Before building the executable, run the `configure` script specifying the platform architecture as well as the platform specific mouse, keyboard and graphics drivers:

     cd path/to/Qtopia/Core
     ./configure -embedded myplatform -qt-kbd-<mykeyboarddriver>
                 -qt-mouse-<mymousedriver> -qt-gfx-<mygraphicsdriver>

     cd path/to/myApplication
     qmake -project
     qmake
     make

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

See also: Character Input, Pointer Handling and Deploying an Application on Qtopia Core.

[Contents]