C
Qt Quick Ultralite instrument_cluster Example
# Copyright (C) 2026 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial
cmake_minimum_required(VERSION 3.21.1)
project(instrument_cluster VERSION 0.0.1 LANGUAGES C CXX ASM)
find_package(QulApp)
if(QUL_PLATFORM MATCHES "^gerda-4")
# Gerda platforms entrypoint function is same as baremetal
set(QUL_OS_LOWERCASE "baremetal")
endif()
if(QUL_PLATFORM MATCHES "autosar")
qul_add_library(instrument_cluster)
else()
qul_add_executable(instrument_cluster)
endif()
qul_add_qml_module(instrument_cluster
URI InstrumentClusterApp
QML_FILES instrument_cluster.qml
SOURCES
src/VehicleStatus.cpp
src/VehicleStatus.h
)
set_target_properties(instrument_cluster PROPERTIES
QUL_DEFAULT_FONT_FAMILY "Titillium Web"
QUL_FONT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/fonts/TitilliumWeb-Light.ttf;${CMAKE_CURRENT_SOURCE_DIR}/fonts/TitilliumWeb-SemiBold.ttf"
)
target_include_directories(instrument_cluster PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
# Every platform except autosar drives the UI from the bundled simulator and
# brings its own main(); autosar uses the generated entry point instead.
if(NOT QUL_PLATFORM MATCHES "autosar")
target_sources(instrument_cluster PRIVATE
src/simulation/simulator.cpp
src/simulation/${QUL_OS_LOWERCASE}/main.cpp
)
target_include_directories(instrument_cluster PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/simulation
)
endif()
app_target_setup_os(instrument_cluster)
if(QUL_PLATFORM MATCHES "autosar")
app_target_default_entrypoint(instrument_cluster instrument_cluster MODULE InstrumentClusterApp)
endif()
if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
add_custom_command(TARGET instrument_cluster
COMMAND strip instrument_cluster -o instrument_cluster.stripped
DEPENDS instrument_cluster)
endif()