Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Find what you need - explore our website and developer resources
12 May 2021
When we develop a Qt application for an embedded system, we edit code in Qt Creator running on a desktop computer, press the Run button, and have Qt Creator run the application on the embedded device – many times per day. We also want to switch between desktop and embedded builds without restarting Qt Creator. We perform the many tiny TDD steps on the desktop computer and inspect our work from time to time on the embedded device.
00:00 Introduction
00:44 The 5 Minute Challenge
22:37 CMake Toolchain Files
31:03 Qt Qreator Configuration Files
39:36 Q&A
I have spent many hours on several occasions trying to “convince” QtCreator and CMake to work together seamlessly. QtCreator and CMake are pretty good at producing a never-ending stream of problems. Installing the executables and libraries on the device fails. The detection of the C and C++ compilers fails. QtCreator refuses to update its project configuration with modified CMake settings. The CMake toolchain file is buggy or missing. QtCreator forgets some, but not all, run and deployment settings.
With minimum user input, the installer of the commercial Boot2Qt SDK creates the CMake toolchain files and the configuration files for a QtCreator kit. QtCreator auto-detects the kit when restarted. Cross-compilation, deployment, and execution of Qt applications for an embedded device work out of the box. We want the same smooth setup experience with non-commercial Qt SDKs, too!
Non-commercial Qt SDKs lack the CMake toolchain file that does not depend on the environment variables of a Yocto SDK. This toolchain file is required for switching between desktop and embedded builds without restarting QtCreator. I’ll provide a script that generates the missing CMake toolchain file.
Non-commercial Qt SDKs also lack the QtCreator configuration files for the kit, Qt version, C/C++ compilers, CMake configuration, and device. Boot2Qt comes with a script that generates these configuration files using the undocumented QtCreator utility sdktool. As the script is distributed under GPLv3, we can modify and use it. I’ll extend the script to generate the correct configuration files.
I use the scripts to set up QtCreator for cross-compilation with CMake and for deploying and running a Qt application on a Toradex Verdin i.MX8M Mini board. When I press the Run button in QtCreator, some magic will happen!