The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)


User:Tswindell/Qt Creator And Mer Integration

From Mer Wiki
Jump to: navigation, search

Contents

Introduction

The purpose of this article is to explain how to integrate Qt Creator from the Nokia Qt SDK with the Mer SDK, allowing you to create/build/deploy & run projects through Qt Creator. The methods documented here are currently a Work in Progress.

Requirements

  1. Installed Nokia Qt SDK (for recent Qt Creator with Maemo/MeeGo/Harmattan support)
  2. Installed Mer Platform SDK Platform_SDK
  3. Setup SB2 & Targets Platform_SDK_and_SB2
  4. Setup default SB2 target with: sb2-config -d <target-name>
  5. Have device running a Mer based product (can be an emulated device).

Qt Creator Hook Scripts

In order for Qt Creator to recognised the build environment provided by scratcbox2 inside the Mer SDK, we must create the below hook scripts for Qt Creator, which execute qmake and make inside the sbox2 environment.

/opt/sdks/mer/scripts/qmake

#! /bin/sh
sdkroot="/opt/sdks/mer"
sdkscript="${sdkroot}/mer-sdk-chroot"

target=$($sdkscript exec sb2 sb2-show which /bin | sed 's/\/bin$//')

$sdkscript exec sb2 sh -c "'cd $PWD; qmake $@'" | sed "s/:\//:$(echo $target | sed 's/\//\\\//g')\//g"

Qt Creator uses the 'qmake' command to find out information about your target environments Qt versions and configuration. The above script when called acts as though it's being run directly in our sbox2 build environment, it uses the current sbox2 target and remaps the directory information to point to the correct place on the filesystem so QtCreator can find the proper include files and resources.

To make Qt Creator recognise our target development environment, goto: "Tools > Options > Build & Run > Qt Versions" click on "Add", use the file picker to select the above created "qmake" script from "/opt/sdks/mer/scripts". If everything went well, Qt Creator should recognise the Qt version. Now set the version name to something like "Mer SDK (SB2)".

/opt/sdks/mer/scripts/make

#! /bin/sh
sdkroot="/opt/sdks/mer"
sdkscript="${sdkroot}/mer-sdk-chroot"

target=$($sdkscript exec sb2 sb2-show which /bin | sed 's/\/bin$//')

$sdkscript exec sb2 sh -c "'cd $PWD; make $@'"

Next we need to use the above script in our Projects' build configuration to replace the use of our systems' make command. This step has to be done on all projects that you want to build with your Mer SDK targets in Qt Creator. You'll have to do this step for all your new projects as well.

Load or create a new project in Qt Creator, click on "Projects" on the right hand vertical panel. Edit the build configuration to use our "Mer SDK (SB2)" target. If it's not in the drop down you may have to click the Add button and select it from there. Next, in the "General" section select the "Mer SDK (SB2)" target for the "Qt version" field.

Finally we need to tell Qt Creator to use our special "make" script instead of the system make command. To acheive this find the "Make" build step under the "Build Steps" section of the projects build configuration. Click Details, select our script as the "Override make" field value. Do the same for the "Clean" build step as well. Now our project is ready to build for your Mer target. :)

Deployment & Running on Device

TBD

References

Personal tools