Last edited one week ago

X-LINUX-QT How to build Qt applications using CMake

Applicable for STM32MP25x lines

Warning DB.png Important
This version of X-LINUX-QT expansion package is validated against the ecosystem release v5.1.0 . It has not been ported yet on ecosystem release v6.0.0 More info.png .

This article aims to give the following information:

  • How to use the X-LINUX-QT Developer Package to build Qt applications for the STM32 microprocessor series.
1. Prerequisites[edit | edit source]

Check detailed prerequisites here.

2. Update the SDK environment for CMake[edit | edit source]
Info white.png Information
The OE_CMAKE_TOOLCHAIN_FILE variable needs to be set to allow building CMake projects with the installed SDK

Follow below steps if you need to add the missing OE_CMAKE_TOOLCHAIN_FILE variable to your SDK configuration

  • Open terminal and load the environment setup
 source /opt/st/stm32mp2/5.0.3-openstlinux-6.6-yocto-scarthgap-mpu-v24.11.06/environment-setup-cortexa35-ostl-linux
  • Export the OE_CMAKE_TOOLCHAIN_FILE variable
 export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/lib/cmake/Qt6/qt.toolchain.cmake"
3. Download the Demo example source code[edit | edit source]
 mkdir -p /opt/st/demos/Qt
 cd /opt/st/demos/Qt
 git clone https://github.com/KDABLabs/KDBoatDemo.git -b qt6
4. Build the Demo example[edit | edit source]
 cd KDBoatDemo
 cmake -S . -B config_default
-- Toolchain file defaulted to '/opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26_x-linux-qt_v2.0.0/sysroots/x86_64-ostl_sdk-linux/usr/lib/cmake/Qt6/qt.toolchain.cmake'
-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26_x-linux-qt_v2.0.0/sysroots/x86_64-ostl_sdk-linux/usr/bin/aarch64-ostl-linux/aarch64-ostl-linux-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26_x-linux-qt_v2.0.0/sysroots/x86_64-ostl_sdk-linux/usr/bin/aarch64-ostl-linux/aarch64-ostl-linux-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Performing Test HAVE_EGL
-- Performing Test HAVE_EGL - Success
-- Found EGL: /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26_x-linux-qt_v2.0.0/sysroots/cortexa35-ostl-linux/usr/include (found version "1.5") 
-- Performing Test HAVE_GLESv2
-- Performing Test HAVE_GLESv2 - Success
-- Found GLESv2: /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26_x-linux-qt_v2.0.0/sysroots/cortexa35-ostl-linux/usr/include  
-- Found XKB: /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26_x-linux-qt_v2.0.0/sysroots/cortexa35-ostl-linux/usr/lib/libxkbcommon.so (found suitable version "1.5.0", minimum required is "0.5.0") 
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/st/demos/Qt/KDBoatDemo/config_default
 cmake --build config_default --target all
[  7%] Running qmlimportscanner for KDABBoatDemo
[  7%] Built target KDABBoatDemo_qmlimportscan
[ 15%] Automatic MOC for target KDABBoatDemo
[ 15%] Built target KDABBoatDemo_autogen
[ 23%] Automatic RCC for imagesMaps2.qrc
[ 30%] Automatic RCC for data.qrc
[ 38%] Automatic RCC for images.qrc
[ 46%] Automatic RCC for imagesMaps.qrc
[ 53%] Building CXX object CMakeFiles/KDABBoatDemo.dir/KDABBoatDemo_autogen/mocs_compilation.cpp.o
[ 61%] Building CXX object CMakeFiles/KDABBoatDemo.dir/main.cpp.o
[ 69%] Building CXX object CMakeFiles/KDABBoatDemo.dir/KDABBoatDemo_autogen/EWIEGA46WW/qrc_imagesMaps.cpp.o
[ 76%] Building CXX object CMakeFiles/KDABBoatDemo.dir/KDABBoatDemo_autogen/EWIEGA46WW/qrc_imagesMaps2.cpp.o
[ 84%] Building CXX object CMakeFiles/KDABBoatDemo.dir/KDABBoatDemo_autogen/EWIEGA46WW/qrc_images.cpp.o
[ 92%] Building CXX object CMakeFiles/KDABBoatDemo.dir/KDABBoatDemo_autogen/EWIEGA46WW/qrc_data.cpp.o
[100%] Linking CXX executable KDABBoatDemo
[100%] Built target KDABBoatDemo
5. Deploy the Demo example to your running board[edit | edit source]
  • Copy the Example's binary into your connected board
 cd /opt/st/demos/Qt
 scp config_default/KDABBoatDemo root@192.168.7.1:/home/root/.
6. Run the Demo example on your board[edit | edit source]
  • Connect to your running board
 ssh root@192.168.7.1
  • Run the Demo's example (windowed mode)
 ./KDABBoatDemo
  • Check the running Demo example on your board's display
Running KDAB Boat Demo on target (Windowed Mode)
  • Run the Demo's example (Full screen mode)
 ./KDABBoatDemo --fullscreen
  • Check the running Demo example on your board's display
Running KDAB Boat Demo on target (Full screen Mode)