Setting up the tools
The following section outlines how to install and configure the tools you need to port your Qt app to BlackBerry 10.
Get code signing keys and debug tokens
The first step you need to take is to get code signing keys and debug tokens.
Download and install the BlackBerry 10 Native SDK
Next, you need to download and install the BlackBerry 10 Native SDK.
Download and install the BlackBerry 10 Device Simulator
If you do not have a BlackBerry 10 device, you can use the BlackBerry 10 Device Simulator to run your applications.
Download and install Qt Creator
If you're porting a Qt application, you probably already have Qt Creator installed. If you don't, you can download a binary installer from qt-project.org, or clone and build Qt Creator from qt.gitorious.org.
After you install Qt Creator, you can configure the toolchain, which allows you to begin porting your application.
Configure the Qt Creator toolchain
The following section covers configuration of the Qt Creator toolchain.
Set your environment variables and run Qt Creator
The first step in configuring the toolchain is setting your environment variables and running Qt Creator.
In Windows:
- Open the Start Menu and enter cmd.exe in the search box.
- Right-click the cmd.exe file and click Run as administrator.
- At the command prompt, navigate to where you installed the BlackBerry 10 Native SDK.
- Run the bbndk-env.bat file.You must run Qt Creator in the same command prompt. Do not close the command prompt after you run bbndk-env.bat.
- Navigate to where you installed Qt Creator.
- Run the qtcreator.exe file.
When Qt Creator is open, you are free to begin the configuration outlined below.
In Linux and Mac OS:
- Source the bbndk-env.sh
script:
$ source <path_to_ndk>/bbndk-env.sh
- Run Qt Creator in the same command prompt.
Configuring Qt Creator
After you set the environment variables and open Qt Creator, you need to configure the compiler for Qt Creator. To do this:
- In Qt Creator, click Tools > Options.
- In the left pane, click Build & Run.
- In the right pane, click the Compilers tab.
- Click Add and select GCC.
- In the Compiler path field, enter your compiler path. The default path to the compiler is <path_to_ndk>/host<version>/<platform>/<version>/usr/bin/qcc.<extension>.
- Set the Application Binary Interface (ABI) for your OS by using
the drop-down lists. The default ABI for Windows is
custom-arm-generic-elf-32bit.
If you are unsure which compiler configuration you need, continue configuring the toolchain. You will have the option to view supported compiler configurations when you configure your kit.
- Click Apply.
Your compiler configuration should look similar to this:
The next step is to specify the version of Qt in Qt Creator. The BlackBerry 10 Native SDK comes packaged with Qt 4.8.x, so that's what you need to indicate. To do this:
- In Qt Creator, click Tools > Options.
- In the right pane, click the Qt Versions tab.
- Click Add.
- Navigate to
<path_to_ndk>/host<version>/<platform>/<version>/usr/bin/.For example, if you installed the 32-bit Windows version of the BlackBerry 10 Native SDK in the default C:\bbndk directory, your path is C:\bbndk\host<version>\win32\x86\usr\bin.
- Select qmake.exe and click Open.
- In the BlackBerry Native SDK field, ensure the path to your installation directory is correct.
At this point, you should have something similar to this:
If you receive an error message stating Qt version is not properly installed, please run make install, go back and set your environment variables again and try specifying the Qt version again.
Next, you need to configure a device or simulator. To do this:
- Connect your device or simulator and enable development mode.
- In Qt Creator, click Tools > Options.
- In the left pane click Devices.
- In the right pane, click Add, select BlackBerry Device, and click Start Wizard.
- Name your device and enter its IP address.
-
If you are using a BlackBerry 10 device, you can find the IP address in Settings > Security and Privacy > Development Mode.
-
If you are using the BlackBerry 10 Device Simulator, you can find the IP address in the bottom left corner of the simulator window.
-
- Enter your device password and select the device type.
- If you are using a BlackBerry 10 device, click Browse and navigate to where you saved your debug token.
- Click Next.
- Browse to an existing SSH key, or generate one.
- Click Next.
- Click Finish.
Your screen should look similar to this once you're finished:
Finally, you need to configure a kit. To do this:
- In Qt Creator, click Tools > Options.
- In right pane, click the Kits tab.
- Click Add.
- Name your kit, and select your Device type and Device.
- In the Sysroot field, enter or browse to your armle-v7 directory. The default location is <path_to_ndk>\target_<version>\qnx6\armle-v7.
- In the Compiler drop-down list, select the compiler you configured.
- Next to the Debugger field, click the Manage button then click Edit.
- To set the binary, navigate to <path_to_ndk>\host_<version>\<platform>\<version>\user\bin.
- Select ntoarm-gdb.exe and click Open.
- Click OK.
- In the Qt version drop-down list, specify the version of Qt you want to use.
- In the Qt mkspec field,
enter your default mkspecs directory.The default directory is <path_to_ndk>\target_<version>\qnx6\usr\share\qt4\mkspecs\default.
- Click Apply.
Your kit configuration should look similar to this:
Now that you're finished configuring the toolchain, you can begin using Qt Creator to port (or create) Qt applications for BlackBerry 10.