C
Qt Quick Ultralite Motorcycle Cluster Demo
cmake_minimum_required (VERSION 3.21.1)
project(motor_cluster VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT TARGET Qul::Core)
find_package(Qul)
get_target_property(includes Qul::Core INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(QUL_PLATFORM STREQUAL "mimxrt1170-evk-freertos")
set(SIZE_VARIANT "big" CACHE STRING "Variant for motor cluster demo")
else()
set(SIZE_VARIANT "small" CACHE STRING "Variant for motor cluster demo")
endif()
include(src/3rdparty/etl/CMakeLists.txt)
if(SIZE_VARIANT STREQUAL "big")
qul_add_target(motor_cluster
src/simulation/+big/simulationcontroller.cpp
src/simulation/+big/states.cpp
src/simulation/+big/drivetrain.cpp
src/simulation/+big/normaldrivestate.cpp
)
qul_target_generate_interfaces(motor_cluster OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src/simulation/+big/simulationcontroller.h
)
target_include_directories(motor_cluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(QML_PERFORMANCE_FILES
qmls/performance/full/+big/PerformanceMetrics.qml
qmls/performance/full/+big/PerformanceMetricItem.qml
)
target_include_directories(motor_cluster PRIVATE qmls/+big/gauges qmls/welcome)
target_link_libraries(motor_cluster PRIVATE motor_cluster_etl)
app_target_setup_os(motor_cluster)
app_target_default_entrypoint(motor_cluster motor_cluster)
qul_target_qml_sources(motor_cluster
qmls/main/+big/motor_cluster.qml
)
qul_add_qml_module(motor_cluster_module
URI MotorCluster
QML_FILES
qmls/+big/MotorCluster.qml
qmls/+big/Blinker.qml
qmls/+big/BottomCommonElements.qml
qmls/gauges/+big/FuelGaugeView.qml
qmls/gauges/+big/GearGaugeView.qml
qmls/+big/Logo.qml
qmls/+big/OdoTextElement.qml
qmls/+big/RangeIconWithText.qml
qmls/+big/SpeedoView.qml
qmls/+big/TachoView.qml
qmls/+big/TellTalesIndicator.qml
qmls/+big/TellTalesView.qml
qmls/+big/TextElement.qml
qmls/+big/TimeView.qml
qmls/welcome/ClipingItem.qml
qmls/welcome/NumberedScaleView.qml
qmls/welcome/RoadView.qml
qmls/+big/Style.qml
qmls/gauges/+big/StartupConfig.qml
qmls/+big/MathAPI.qml
qmls/+big/MainModel.qml
qmls/+big/TellTalesModel.qml
${QML_PERFORMANCE_FILES}
)
target_link_libraries (motor_cluster PRIVATE motor_cluster_module)
qul_add_resource(motor_cluster_module
PREFIX images/bg
BASE images/bg/+big
FILES
images/bg/+big/main.png
images/bg/+big/tacho_frame_up.png
)
qul_add_resource(motor_cluster_module
PREFIX images/fuelGauge
BASE images/fuelGauge/+big
FILES
images/fuelGauge/+big/fuel-colored-bg.png
images/fuelGauge/+big/fuel-colored-circle.png
images/fuelGauge/+big/fuel-scale_2.png
images/fuelGauge/+big/hole-in-bg.png
images/fuelGauge/+big/range.png
images/fuelGauge/+big/ring-1.png
images/fuelGauge/+big/ring-2.png
images/fuelGauge/+big/wave-bottom-part.png
images/fuelGauge/+big/wave-shadow.png
images/fuelGauge/+big/wave-top-part.png
)
qul_add_resource(motor_cluster_module
PREFIX images/tacho
BASE images/tacho/+big
FILES
images/tacho/+big/1.png
images/tacho/+big/2.png
images/tacho/+big/3.png
images/tacho/+big/4.png
images/tacho/+big/5.png
images/tacho/+big/6.png
)
qul_add_resource(motor_cluster_module
PREFIX images/telltales
BASE images/telltales/+big
FILES
images/telltales/+big/batteryOff.png
images/telltales/+big/engine-failureOff.png
images/telltales/+big/engine-oilOff.png
images/telltales/+big/fuel.png
images/telltales/+big/high-beamsOff.png
)
qul_add_resource(motor_cluster_module
BASE images/+big
PREFIX images
FILES
images/welcome/left-lines.png
images/welcome/right-lines.png
images/welcome/tacho-bottom-line.png
images/welcome/tacho-top-line.png
images/welcome/road.png
images/gearGauge/oval.png
images/gearGauge/oval_2.png
images/gearGauge/oval_3.png
images/+big/qt-logo.png
images/+big/range.png
images/+big/turn-left-bottom.png
images/+big/turn-left-top.png
images/+big/turn-right-bottom.png
images/+big/turn-right-top.png
images/+big/vertical-divider.png
)
endif()
if(SIZE_VARIANT STREQUAL "small")
qul_add_target(motor_cluster
src/simulation/+small/simulationcontroller.cpp
src/simulation/+small/states.cpp
src/simulation/+small/drivetrain.cpp
src/simulation/+small/normaldrivestate.cpp
)
qul_target_generate_interfaces(motor_cluster OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src/simulation/+small/simulationcontroller.h
)
target_include_directories(motor_cluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(QML_PERFORMANCE_FILES
qmls/performance/full/+small/PerformanceMetrics.qml
qmls/performance/full/+small/PerformanceMetricItem.qml
)
target_link_libraries(motor_cluster PRIVATE motor_cluster_etl)
app_target_setup_os(motor_cluster)
app_target_default_entrypoint(motor_cluster motor_cluster)
qul_target_qml_sources(motor_cluster
qmls/main/+small/motor_cluster.qml
)
qul_add_qml_module(motor_cluster_module
URI MotorCluster
QML_FILES
qmls/+small/MotorCluster.qml
qmls/+small/Background.qml
qmls/+small/Blinker.qml
qmls/bottomElements/BottomCommonElements.qml
qmls/bottomElements/OdoTextElement.qml
qmls/bottomElements/TextElement.qml
qmls/bottomElements/TimeView.qml
qmls/gauges/+small/FuelGaugeView.qml
qmls/gauges/+small/GearGaugeView.qml
qmls/keyboard/InputTextField.qml
qmls/keyboard/KeyBase.qml
qmls/keyboard/KeyFont20.qml
qmls/keyboard/KeyFont36.qml
qmls/keyboard/KeyWithImage.qml
qmls/keyboard/Keyboard.qml
qmls/keyboard/KeyboardView.qml
qmls/+small/Logo.qml
qmls/navigation/Arrow.qml
qmls/navigation/Navigation.qml
qmls/+small/RangeIconWithText.qml
qmls/+small/RoadView.qml
qmls/+small/SpeedoView.qml
qmls/+small/Statistics.qml
qmls/tacho/NumberedScaleView.qml
qmls/tacho/TachoView.qml
qmls/telltales/TellTalesIndicator.qml
qmls/telltales/TellTalesView.qml
qmls/utils/ItemWithAcivationAnimations.qml
qmls/utils/ClipingItem.qml
qmls/utils/TextInRoundedBox.qml
qmls/+small/Warning.qml
qmls/+small/Style.qml
qmls/gauges/+small/StartupConfig.qml
qmls/utils/MathAPI.qml
qmls/+small/MainModel.qml
qmls/telltales/TellTalesModel.qml
qmls/navigation/NavigationModel.qml
${QML_PERFORMANCE_FILES}
)
target_link_libraries (motor_cluster PRIVATE motor_cluster_module)
if(QUL_PLATFORM MATCHES "^rh850")
set_source_files_properties(
images/bg/+small/main-light.png
PROPERTIES QUL_RESOURCE_IMAGE_PIXEL_FORMAT RGB565)
endif()
if(QUL_PLATFORM MATCHES "^tviic2d6m")
# There's not enough space in VRAM for all these assets
set_source_files_properties(
images/mainScreen/tacho-bottom-line-day.png
images/mainScreen/tacho-bottom-line.png
images/mainScreen/tacho-top-line-day.png
images/mainScreen/tacho-top-line.png
images/mainScreen/left-lines-day.png
images/mainScreen/left-lines.png
images/mainScreen/right-lines-day.png
images/mainScreen/right-lines.png
images/mainScreen/road-day.png
images/mainScreen/road.png
images/bg/+small/main-light.png
images/bg/+small/main.png
PROPERTIES
QUL_RESOURCE_CACHE_POLICY "NoCaching")
endif()
set_source_files_properties(
images/fuelGauge/+small/fuel-colored-bg.png
images/fuelGauge/+small/fuel-colored-circle-day.png
images/fuelGauge/+small/fuel-colored-circle.png
images/fuelGauge/+small/fuel-scale.png
images/fuelGauge/+small/hole-in-bg-day.png
images/fuelGauge/+small/hole-in-bg.png
images/mainScreen/left-lines-day.png
images/mainScreen/left-lines.png
images/mainScreen/right-lines-day.png
images/mainScreen/right-lines.png
images/mainScreen/road-day.png
images/mainScreen/road.png
images/mainScreen/tacho-bottom-line-day.png
images/mainScreen/tacho-bottom-line.png
images/mainScreen/tacho-top-line-day.png
images/mainScreen/tacho-top-line.png
PROPERTIES
QUL_RESOURCE_IMAGE_PIXEL_FORMAT AutomaticCompressedLossless)
qul_add_resource(motor_cluster_module
PREFIX images/bg/
BASE images/bg/+small/
FILES
images/bg/+small/main.png
images/bg/+small/main-light.png
)
qul_add_resource(motor_cluster_module
PREFIX images/fuelGauge
BASE images/fuelGauge/+small
FILES
images/fuelGauge/+small/fuel-colored-bg.png
images/fuelGauge/+small/fuel-colored-circle-day.png
images/fuelGauge/+small/fuel-colored-circle.png
images/fuelGauge/+small/fuel-scale.png
images/fuelGauge/+small/hole-in-bg-day.png
images/fuelGauge/+small/hole-in-bg.png
images/fuelGauge/+small/ring-2.png
images/fuelGauge/+small/wave-bottom-part.png
images/fuelGauge/+small/wave-shadow.png
images/fuelGauge/+small/wave-top-part.png
)
qul_add_resource(motor_cluster_module
PREFIX images/tacho
BASE images/tacho/+small
FILES
images/tacho/+small/1.png
images/tacho/+small/2.png
images/tacho/+small/3.png
images/tacho/+small/4.png
images/tacho/+small/5.png
images/tacho/+small/6.png
)
qul_add_resource(motor_cluster_module
PREFIX images/telltales
BASE images/telltales/+small
FILES
images/telltales/+small/battery.png
images/telltales/+small/engine-failure.png
images/telltales/+small/engine-oil.png
images/telltales/+small/fuel.png
images/telltales/+small/high-beams.png
)
qul_add_resource(motor_cluster_module
BASE images/+small
PREFIX images
FILES
images/keyboard/backspace-key.png
images/keyboard/enter-key.png
images/keyboard/go-home-key.png
images/keyboard/go-work-key.png
images/keyboard/minimize-keyboard.png
images/mainScreen/left-lines-day.png
images/mainScreen/left-lines.png
images/mainScreen/right-lines-day.png
images/mainScreen/right-lines.png
images/mainScreen/road-day.png
images/mainScreen/road.png
images/mainScreen/tacho-bottom-line-day.png
images/mainScreen/tacho-bottom-line.png
images/mainScreen/tacho-top-line-day.png
images/mainScreen/tacho-top-line.png
images/navigation/destination-pin.png
images/navigation/tbt-1-arrow-left.png
images/navigation/tbt-1-arrow-stright.png
images/navigation/tbt-center-separator.png
images/+small/qt-logo.png
images/+small/range.png
images/status/battery-status.png
images/status/distance-status.png
images/status/engine-oil-status.png
images/status/fuel-avg-status.png
images/status/service-status.png
images/status/time-status.png
images/tacho/light/01.png
images/tacho/light/02.png
images/tacho/light/03.png
images/tacho/light/04.png
images/tacho/light/05.png
images/tacho/light/06.png
images/+small/turn-left.png
images/warnings/engine-failure-warning.png
images/warnings/engine-oil-warning.png
images/warnings/battery-warning.png
)
endif()
set_property(TARGET motor_cluster APPEND PROPERTY QUL_FONT_FILES
${CMAKE_CURRENT_SOURCE_DIR}/fonts/Barlow-Medium.ttf
${CMAKE_CURRENT_SOURCE_DIR}/fonts/Barlow-MediumItalic.ttf
)
if(QUL_BUILD_QMLPROJECT_DEMOS)
set(MOTOR_CLUSTER_SELECTORS ${SIZE_VARIANT})
if(QUL_PLATFORM MATCHES "^rh850")
list(APPEND MOTOR_CLUSTER_SELECTORS "rh850")
elseif(QUL_PLATFORM MATCHES "^tviic2d6m")
list(APPEND MOTOR_CLUSTER_SELECTORS "tviic2d6m")
endif()
qul_add_target(motor_cluster_qmlproject
QML_PROJECT qmlproject/motor_cluster.qmlproject
SELECTORS ${MOTOR_CLUSTER_SELECTORS})
target_sources(motor_cluster_qmlproject PRIVATE
src/simulation/+${SIZE_VARIANT}/simulationcontroller.cpp
src/simulation/+${SIZE_VARIANT}/states.cpp
src/simulation/+${SIZE_VARIANT}/drivetrain.cpp
src/simulation/+${SIZE_VARIANT}/normaldrivestate.cpp)
target_include_directories(motor_cluster_qmlproject PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(motor_cluster_qmlproject PRIVATE motor_cluster_etl)
if(SIZE_VARIANT STREQUAL "big")
target_include_directories(motor_cluster_qmlproject PRIVATE qmls/+big/gauges qmls/welcome)
endif()
app_target_setup_os(motor_cluster_qmlproject)
app_target_default_entrypoint(motor_cluster_qmlproject motor_cluster)
endif()