Getting Started on Windows
This topic provides instructions to compile a Qt Quick Ultralite project for Qt Desktop. The Qt Desktop environment lets you quickly preview the application you are developing, making the process of creating the application faster.
As a reference project let's use the thermostat demo provided with Qt for MCUs.
Currently, Windows 10 64bit is the only supported development host environment. Additionally, you must have the following tools installed, to build any Qt Quick Ultralite project:
- MSVC++ compiler v14.16 (Visual Studio 2017 15.9) up to v14.26 (Visual Studio 2019 16.6)
- CMake 3.15 or newer (you can install it using the Qt Online installer)
- Clang 8.0.0 or newer (it's installed as part of Qt Creator)
Note: Add the Clang binary directory to your system
PATH. If you installed Qt Creator using the Qt online installer, clang binaries are installed under
<QT_INSTALL_PATH>\Tools\QtCreator\bin\clang\bin. This step is not needed when using Qt Creator.
In addition, install Qt for MCUs using the Qt online installer that is available for download on Qt account.
Important: This guide uses <INSTALL_ROOT> as the reference to directory the Qt for MCUs is installed in.
To configure the project, use the CMake command from the command line. First, navigate to the <INSTALL_ROOT>\demos\thermo folder and enter the following commands:
C:\Users\John> set Qul_DIR=<INSTALL_ROOT> C:\Users\John> cd %Qul_DIR%\demos\thermo <INSTALL_ROOT>\demos\thermo> mkdir build_winqt <INSTALL_ROOT>\demos\thermo> cd build_winqt <INSTALL_ROOT>\demos\thermo\build_winqt> cmake .. -DQUL_PLATFORM=Qt -Ax64
The above commands will check the prerequisites and create the build setup, which includes generating visual studio project files.
To build, use the following command:
<INSTALL_ROOT>\demos\thermo\build_winqt> cmake --build . --target thermo_big --config Release
Once the thermostat application is built, try to run it. As it is built as a Qt application for Windows, it requires the Qt runtime libraries in the
PATH. Qt for MCUs does not require you to install the standard Qt for desktop, instead it provides you with all the necessary libraries. You must ensure that these libraries are in your
<INSTALL_ROOT>\demos\thermo\build_winqt> set PATH=%Qul_DIR%\bin;%PATH%
Now we can run the application:
To configure the project, follow instructions in the Command line setup section.
To work with your project using Microsoft Visual Studio, open the solution created by CMake from the build_winqt folder.
Now, you should see the solution tree structure.
As this is a Windows Qt project, it requires Qt's runtime libraries to run. To make them available for the built application, you must set the runtime environment. To do this:
- Right-click on your project and select Properties from the context menu.
- Click General > Debugging
- To Environment add the PATH variable pointing to the directory containing the Qt libraries. Those should be located inside the bin folder of your Qt for MCUs install root, for example:
After this step (assuming %Qul_DIR% was set to C:\QtForMCU\1.1.0) the project properties window should look like this:
Apply the changes, build the application, and run it. You should see on the screen the thermostat demo.
The following sections provides instructions to set up Qt Creator for Qt for MCUs development on the Windows platform only. For details about configuring Qt Creator for development on MCU boards, refer to Qt Creator documentation.
To develop for MCUs using the Qt Creator IDE, the MCU plugin is required. The Qt online installer enables it by default when you install the Qt for MCUs SDK.
To enable or disable the plugin, follow these instructions:
- Select Help > About Plugins and choose the MCU Support plugin from the list.
- Restart Qt Creator to apply changes
To build and run your application on MCUs, you must create a kit:
- Select Tools > Options > Devices > MCU
- If not already set, provide the path to the Qt for MCUs installation directory.
- Select a Target supported by the Qt for MCUs SDK. For example, Qt for MCUs 1.5 - Desktop.
- In the Requirements section, ensure that the platform-specific requirements are met.
- Select Create Kit to create a kit for the selected target. if a kit already exists, remove it first using Remove Kit.
- Click Apply.
To open the Thermostat project:
- Select File > Open File or Project...
- Open the CMakefiles.txt file from
- Select Qt for MCUs 1.5 - Desktop kit.
- Click Configure Project to finish.
The project should be configured.
Now, you are ready to go!
Note: For more information, refer to the Qt Creator manual.
You can debug the C++ code generated from your application using the Qt Creator or Microsoft Visual Studio. To make debugging a bit easier, in the generated code you will see snippets of the QML, from which the C++ code was generated.
Available under certain Qt licenses.
Find out more.