Adding device support to Qt
Qt might not run out of the box for your hardware and the below guide should help you to add support for it. Right now there are still a couple of holes but we are working on it.
Our goal is to allow you to add support for your device to Qt. The benefit is that your users will be able to build Qt out of the box, the other part is that once your code is in Qt there is the possibility to build and runtime test for your hardware.
Qt is a portable toolkit but your hardware might be special. The current device support allows you automatically add include- and library-paths and the name of libraries, e.g. the to be used OpenGL libraries. The other part of the device support is to easily change the initialization of the EGLFS and DirectFB plugin.
Adding qmake/device support to qtbase
- Create a directory in mkspecs/devices/linux-ARCHITECTURE-VENDOR-BOARD-g++
- Place a qmake.conf and qplatformdefs.h.
The qmake.conf selects the name of the compiler/linker, include paths, you can also handle options that are passed via “-device VAR=NAME” on configure. The qplatformdefs.h normally just includes the generic files.
Platform initialization hooks
Adding hooks for DirectFB/EGL
You might have an EGL library and some platform specific code to use it on top of DirectFB. Qt’s DirectFB plugin allows to call a hook for the initialization The hook interface is in src/plugins/platforms/directfb/qdirectfb_hooks.h and you can decide to implement it. It might be that the hooks are not enough but they can be easily extended.
- Create mkspecs/devices/linux-ARCHITECTURE-VENDOR-BOARD-g++/qdirectfb_hooks_BOARD.cpp
- Edit qmake.conf to include the following variables:
- QT_CONFIG += directfb_egl
- DIRECTFB_PLATFORM_HOOKS_SOURCES = $$PWD/qdirectfb_hooks_BOARD.cpp
- DIRECTFB_PLATFORM_INCLUDEPATH = ADDITIONAL_INCLUDEPATHS
- DIRECTFB_PLATFORM_LIBS = ADDITIONAL_LIBS
- DIRECTFB_PLATFORM_LIBDIR = ADDITIONAL_LIBDIRS
Adding hooks for EGLFS
You might want to use EGLFS (EGL Fullscreen) but you require platform specific initialization to select the output, resolution, etc. The EGLFS hooks allow you to do just that.
Automatic Testing (Continous Integration)