Monday, January 11, 2016

Qt Declarative 2d build explained

The source code posted at Sources is built against Qt 5.3.2 . I hope to be able to update to newer versions later on. The problem with this is that Quick2 changes a lot and it is very hard to keep up for me, help is most welcome.

Prerequisites:

  1. A working toolchain for your ARM target.
  2. A system rootfs with headers etc on your build host.
  3. The 5.3.2 distribution of Qt
Build process:

  1. Extract the Qt source archive.
  2. Please read the generic build instructions at qt.io and configure the sources for "linux-arm-g++". *hint* use the -sysroot argument to point to your rootfs. You will also need to add -no-xcb and -qpa linuxfb.
  3. Build Qt (make)
  4. Test Qt on your target with a simple widget application for example wiggly.
  5. If the test fails, check that your /dev/fb0 is working and go thru the configure step again. Once you have your Qt working move on to next step.
  6. Clone Qt Declarative 2d into your top Qt source tree. (  git clone -b asm https://github.com/mgrunditz/qtdeclarative-2d.git )
  7. Enter the resulting directory and run qmake from your build tree ( ../qtbase/bin/qmake )
  8. Build it with make.
  9. Modify src/quick/items/qquickitem.cpp to your target screeen resolution.
  10. Modify src/quick/items/alphablender.S to match your screenwidth*4. *hint* check the comments.
  11. Redo make.
  12. make install
  13. Once you have your new binaries on your target it is time for some testing. You should have a program "qml" in your $prefix/$qt/bin directory. Do a simple hello world qml script and run it with the qml program.
  14. You might have problems with missing components. Check that your build includes imports, and tools.
  15. If your "Hello World" works you are ready to try out more complex applications.

Problems and bugs:

The most important issue is that Quick2 assumes that you can have larger window than your screen. I have tried to handle this in qquickitem.cpp and I have it semi working with 720p but it still crashes sometimes. Obviously it doesn't crash if your application stays inside your screen resolution.

The screen dimensions can be fetched from the qquickswindow object. Keep in mind that it is my variables you want to use, screenwidth screenheight.

The rest is a pure math exercise.

If you have any questions you can always email me at michael.grunditz@prevas.se.

Thank you for reading this far and on from all of us at:

Good luck!