Difference between revisions of "HowtoQt"
m |
m |
||
Line 59: | Line 59: | ||
# | # | ||
+ | <code> | ||
# | # | ||
# qmake configuration for building with arm-linux-g++ | # qmake configuration for building with arm-linux-g++ | ||
Line 151: | Line 152: | ||
load(qt_config) | load(qt_config) | ||
− | + | </code> | |
Revision as of 23:28, 5 February 2012
This document is not yet complete - stay tuned
Qt and QML on WebOS devices
This document explains how to set-up Qt 4.8 (Trolltech/Nokia's cross-platform application and UI framework) on WebOS devices, and then how to cross-compile Qt or QML apps.
This guide assumes a Linux development environment, and Qt 4.8. The process for Qt 4.7.x is identical; no idea for Qt 5.
The steps include:
- Getting and setting-up the Palm PDK
- Optionally: completing the PDK with some missing includes
- Getting Qt 4.8, setting it up for cross-compilation
- Cross-compilation of Qt 4.8
- Updated webos port of Qt
- Application tweaks to look for libs in the right places
1. Getting and setting up the Palm PDK
Qt is cross-compiled with the official Palm PDK. The PDK plays nice: it can be installed alongside the webos internals WIDK without conflicts; there is no need to modify paths or environment variables.
Note that I haven't "fully" installed the PDK. In particular I haven't set-up the emulator. The basic stuff needed are: the arm gcc toolchain, and novacom to communicate with the device. VirtualBox can be skipped. Java may be necessary.
- Read about the Palm SDK 3.05 and the installation procedure. Follow the instructions on there. But essentially this boils down to:
- Download novacom from that page
- Download the SDK from that page
- Install novacom and the SDK following the instructions. I.e.:
- sudo dpkg -i palm-sdk_3.0.5-svn528736-pho676_i386.deb
- sudo dpkg -i palm-novacom_1.0.80_i386.deb
- The SDK is now in /opt/PalmPDK
- You may check that all is fine
- You can invoke gcc or g++ from the PDK arm toolchain to compile some "hello world" test program. E.g. /opt/PalmPDK/??????????
- novaterm.....????????
2. Optional: completing the PDK with some missing includes
The Palm PDK contains an arm toolchain which can be used as-is to cross-compile Qt. This step can be skipped, unless you want maximum performance with JavaScript in WebKit.
There is one issue with the Palm PDK. The Qt configuration script relies on the existence of one include file to know whether programs can identify the characteristics of the CPU, such as the availability of Neon instructions. Without this file, Qt will cross-compile and work, but the just-in-time JavaScript compiler in WebKit will be deactivated. This decreases JavaScript performance by a factor ~3.
Therefore the recommended approach is to provide the missing include file.
* Need to check name * code sourcery's toolchain * which file where
3. Getting Qt 4.8, setting it up for cross-compilation
This step gets the Qt 4.8 sources.
- Cd to your home directory: cd ~
- Get the Qt 4.8 sources: http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.0.tar.gz
- Untar: tar xvfz qt-everywhere-opensource-src-4.8.0.tar.gz
We set-up the mkspecs for WebOS (compiler parameters required for cross-compilation):
- Cd to the qws mkspecs: cd ~/qt-everywhere-opensource-src-4.8.0/mkspecs/qws
- The WebOS mkspecs are derived from the mostly the same as the linux-arm-gnueabi-g++ mkspecs. We copy this: cp -r linux-arm-gnueabi-g++ linux-webos
- qmake configuration for building with arm-linux-g++
- for 4.7.4:
- include(../../common/g++.conf)
- include(../../common/linux.conf)
- include(../../common/qws.conf)
- for 4.8
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)
- modifications to g++.conf
- Toolchain
- Base directory of gcc toolchain
- GCCBASE = /opt/PalmPDK.441/arm-gcc/bin
GCCBASE = /opt/PalmPDK.palm/arm-gcc/bin
TSLIB_INCDIR = /opt/PalmPDK.palm/include
TSLIB_LIBDIR = /opt/PalmPDK.palm/device/lib
- TSLIB_INCDIR += $$GCCBASE
- TSLIB_INCDIR += /opt/PalmPDK.palm/arm-gcc/sysroot/usr/include
- Compiler Flags to take advantage of the ARM architecture
- QMAKE_CFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- QMAKE_CFLAGS_RELEASE = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- QMAKE_CFLAGS_RELEASE = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
- ok below
QMAKE_CFLAGS_RELEASE = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize
QMAKE_CFLAGS_DEBUG = -O0 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- Not ok on 4.3.3: mix of vfp and hard
- QMAKE_CFLAGS_RELEASE = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard -ftree-vectorize
- QMAKE_CFLAGS_RELEASE = -O0 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- QMAKE_CXXFLAGS_RELEASE = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- QMAKE_CXXFLAGS_RELEASE = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
- ok below
QMAKE_CXXFLAGS_RELEASE = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize
QMAKE_CXXFLAGS_DEBUG = -O0 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- Not ok on 4.3.3: mix of vfp and hard
- QMAKE_CXXFLAGS_RELEASE = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard -ftree-vectorize
- QMAKE_CXXFLAGS_RELEASE = -O0 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- For official pdk
QMAKE_CC = $$GCCBASE/arm-none-linux-gnueabi-gcc
QMAKE_CXX = $$GCCBASE/arm-none-linux-gnueabi-g++
QMAKE_LINK = $$QMAKE_CXX
QMAKE_LINK_SHLIB = $$QMAKE_CXX
QMAKE_RANLIB = $$GCCBASE/arm-none-linux-gnueabi-ranlib
- QMAKE_LINK = /opt/PalmPDK.palm/arm-gcc/bin/arm-none-linux-gnueabi-g++
- QMAKE_LINK_SHLIB = /opt/PalmPDK.palm/arm-gcc/bin/arm-none-linux-gnueabi-g++
- QMAKE_RANLIB = /opt/PalmPDK.palm/arm-gcc/bin/arm-none-linux-gnueabi-ranlib
- modifications to linux.conf
QMAKE_AR = $$GCCBASE/arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = $$GCCBASE/arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = $$GCCBASE/arm-none-linux-gnueabi-strip
- QMAKE_AR = /opt/PalmPDK.palm/arm-gcc/bin/arm-none-linux-gnueabi-ar cqs
- QMAKE_OBJCOPY = /opt/PalmPDK.palm/arm-gcc/bin/arm-none-linux-gnueabi-objcopy
- QMAKE_STRIP = /opt/PalmPDK.palm/arm-gcc/bin/arm-none-linux-gnueabi-strip
- QMAKE_CFLAGS_RELEASE += --sysroot=/opt/PalmPDK.palm/arm-gcc/sysroot
- QMAKE_CXXFLAGS_RELEASE += --sysroot=/opt/PalmPDK.palm/arm-gcc/sysroot
- QMAKE_CFLAGS_DEBUG += --sysroot=/opt/PalmPDK.palm/arm-gcc/sysroot
- QMAKE_CXXFLAGS_DEBUG += --sysroot=/opt/PalmPDK.palm/arm-gcc/sysroot
QMAKE_INCDIR = $$TSLIB_INCDIR
QMAKE_LIBDIR = $$TSLIB_LIBDIR
QMAKE_LIBS += -lrt -lz
- QMAKE_LFLAGS += -Wl,--allow-shlib-undefined --sysroot=/opt/PalmPDK.palm/arm-gcc/sysroot
QMAKE_LFLAGS += -Wl,--allow-shlib-undefined
load(qt_config)
To do:
- V Get and untar the source
- Set-up the mkspecs
- Get the webos plugins/gfxdrivers -> credit original author -> link to the updated version
- modify the build stuff
- patch the transformed driver (?)
- ./configure command line
- make make install
- something on what's the outcome
3.x WebOS gfxdrivers
This step gets the WebOS Qt gfxdrivers plugin. The initial plugin version was written by Darron Black [1,2]. With the changes in WebOS 2.x an extended version is required that handles keyboard input for "non-root" users. That version is available from Qt gfxdrivers plugin for WebOS on Google Code.
- Cd to the gfxdrivers directory: cd ~/qt-everywhere-opensource-src-4.8.0/src/plugins/gfxdrivers
- Get the WebOS gfxdrivers plugin: svn checkout http://qt-webos.googlecode.com/svn/trunk/ webos
- Add to ~/qt-everywhere-opensource-src-4.8.0/src/plugins/gfxdrivers/gfxdrivers.pro the line: contains(gfx-plugins, webos) :SUBDIRS += webos
- ---------------------- patch transformed driver
4. apps
5. deploy
A. Links
[1] Qt on the Palm Pre [2] Qt port to webOS by Darron Black on gitorious