# Installation

This topic explains how to install the new platform port and use it in Qt Creator.

There are two main approaches to build applications against a platform port of Qt Quick Ultralite:

• Build the application against a developer build of the platform port.
• Install the platform port to a self-contained location.

The first one is practical if the port is still being developed, as it helps you test changes quickly against an application.

Assuming that you are using the ARM GCC toolchain, set the ARMGCC_DIR environment variable to the ARM GCC toolchain location on your computer:

set ARMGCC_DIR=C:\path\to\gcc-arm-none-eabi-8-2018-q4-major-win32

For IAR compiler, use this following command:

set IAR_ARM_COMPILER_DIR=C:\path\to\iar-compiler-dir

In addition, set the QUL_SRC_DIR variable to the platform port location, and QUL_GENERATORS_FILE to the Qt Quick Ultralite host tools' QulGenerators.cmake file location. QUL_TOOLCHAIN_FILE should be set to the location of the cmake file defining the toolchain being used.

Note: QUL_SRC_DIR needs to be set to the directory which contains the root CMakeLists.txt file for the Qt Quick Ultralite project.

set QUL_SRC_DIR=C:\path\to\qul\sources
set QUL_GENERATORS_FILE=%QUL_SRC_DIR%\lib\cmake\Qul\QulGenerators.cmake

Depending on the used toolchain you have to set QUL_TOOLCHAIN_FILE to

set QUL_TOOLCHAIN_FILE=%QUL_SRC_DIR%\lib\cmake\Qul\toolchain\armgcc.cmake

or

set QUL_TOOLCHAIN_FILE=%QUL_SRC_DIR%\lib\cmake\Qul\toolchain\iar.cmake

To use nmake, run the "vcvarsx86_amd64.bat" Windows batch file, which is found in the "VC\Auxiliary\Build" Visual Studio directory. Alternatively, you can run "x86_x64 Cross Tools Command Prompt for VS 2017" or the equivalent for your version of Visual Studio.

## Developer build

To build the plaform as a developer build, run these commands:

cmake %QUL_SRC_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_GENERATORS=%QUL_GENERATORS_FILE% -DQUL_PLATFORM=example-baremetal
nmake

## Installed build

To install a platform build, use the CMAKE_INSTALL_PREFIX option, in addition to the CMake options for the developer build. In the following CMake command, set the CMAKE_INSTALL_PREFIX to the path where you want to install the port:

cmake %QUL_SRC_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_GENERATORS=%QUL_GENERATORS_FILE% -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=C:\dev\qul-example-platform
nmake
nmake install

## Qt Creator integration

Ensure to set up your Qt Creator development environment with the MCU plugin as described in the Qt Creator Manual > Connecting MCUs topic.

Note: Qt Creator does not support custom toolchains yet, so for Qt Creator support one of the toolchains shipped with Qt Quick Ultralite in lib\cmake\Qul\toolchain must be used.

To build the platform port for Qt Creator integration, set these two environment variables:

• CMAKE_INSTALL_PREFIX to Qt for MCUs install directory. It should match the Qt for MCUs version set in the Tools > Options > Devices > MCU option in Qt Creator.
• QUL_VERSION to the corresponding version number. For example, if Qt Creator is configured to use C:\Qt\QtMCUs\<VERSION>, where <VERSION> is the directory containing the Qt Quick Ultralite version you are using (for example 1.7).

After setting these variables, use the following commands to configure and install the platform port:

set QUL_VERSION=<VERSION>
set QUL_INSTALL_PREFIX=C:\Qt\QtMCUs\%QUL_VERSION%
cmake %QUL_SRC_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_GENERATORS=%QUL_GENERATORS_FILE% -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=%QUL_INSTALL_PREFIX% -DQUL_VERSION=%QUL_VERSION% -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off
nmake
nmake install

You can disable building of demos and examples, as they are not needed for the Qt Creator integration.

Once the installation is complete, create a kit for your platform port using the Tools > Options > Devices > MCU option in Qt Creator. If a kit is already configured for the target, remove it before creating the new one.

Finally, the kit for your platform is ready for use in Qt Creator. If you created an Mcu Support Application project, use the new kit to build and link the Qt Quick Ultralite application against your platform library.

Assuming that you have set up the flash targets as described in Getting started, run the application on the target hardware by pressing the Run button in Qt Creator.