C

Qt Quick Ultralite Motorcycle Cluster Demo

cmake_minimum_required (VERSION 3.15)

project(motor_cluster VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT TARGET Qul::QuickUltralite)
    find_package(Qul)
    get_target_property(includes Qul::QuickUltralite INTERFACE_INCLUDE_DIRECTORIES)
endif()

if(QUL_PLATFORM STREQUAL "MIMXRT1170-EVK")
  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)

set(QUL_FONTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/fonts,${QUL_FONTS_DIR}")

if(SIZE_VARIANT STREQUAL "big")
  add_executable(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_big.h
  )

  target_include_directories(motor_cluster PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
                                               ${CMAKE_CURRENT_SOURCE_DIR}/src
  )

  set(QML_PERFORMANCE_FILES
    qmls/big/performance/full/PerformanceMetrics.qml
    qmls/big/performance/full/PerformanceMetricItem.qml
  )

  target_include_directories(motor_cluster PRIVATE qmls/big/gauges qmls/big/welcome)

  target_link_libraries (motor_cluster Qul::QuickUltralite motor_cluster_etl)
  app_target_setup_os(motor_cluster)
  app_target_default_main(motor_cluster motor_cluster)

  qul_target_qml_sources(motor_cluster
      qmls/big/main/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/big/gauges/FuelGaugeView.qml
          qmls/big/gauges/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/big/welcome/ClipingItem.qml
          qmls/big/welcome/NumberedScaleView.qml
          qmls/big/welcome/RoadView.qml
          qmls/big/Style.qml
          qmls/big/gauges/StartupConfig.qml
          qmls/big/MathAPI.qml
          qmls/big/MainModel.qml
          qmls/big/TellTalesModel.qml
          ${QML_PERFORMANCE_FILES}
  )
  target_link_libraries (motor_cluster motor_cluster_module)

  qul_add_resource(motor_cluster_module
      FILES
      images/big/bg/main.png
      images/big/bg/tacho_frame_up.png
      images/big/welcome/left-lines.png
      images/big/welcome/right-lines.png
      images/big/welcome/tacho-bottom-line.png
      images/big/welcome/tacho-top-line.png
      images/big/welcome/road.png
      images/big/fuelGauge/fuel-colored-bg.png
      images/big/fuelGauge/fuel-colored-circle.png
      images/big/fuelGauge/fuel-scale_2.png
      images/big/fuelGauge/hole-in-bg.png
      images/big/fuelGauge/range.png
      images/big/fuelGauge/ring-1.png
      images/big/fuelGauge/ring-2.png
      images/big/fuelGauge/wave-bottom-part.png
      images/big/fuelGauge/wave-shadow.png
      images/big/fuelGauge/wave-top-part.png
      images/big/gearGauge/oval.png
      images/big/gearGauge/oval_2.png
      images/big/gearGauge/oval_3.png
      images/big/qt-logo.png
      images/big/range.png
      images/big/tacho/1.png
      images/big/tacho/2.png
      images/big/tacho/3.png
      images/big/tacho/4.png
      images/big/tacho/5.png
      images/big/tacho/6.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
      images/big/telltales/batteryOff.png
      images/big/telltales/engine-failureOff.png
      images/big/telltales/engine-oilOff.png
      images/big/telltales/fuel.png
      images/big/telltales/high-beamsOff.png
  )
endif()

if(SIZE_VARIANT STREQUAL "small")
  add_executable(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_small.h
  )

  target_include_directories(motor_cluster PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
                                               ${CMAKE_CURRENT_SOURCE_DIR}/src
  )

  set(QML_PERFORMANCE_FILES
      qmls/small/performance/full/PerformanceMetrics.qml
      qmls/small/performance/full/PerformanceMetricItem.qml
  )

  target_link_libraries (motor_cluster Qul::QuickUltralite motor_cluster_etl)
  app_target_setup_os(motor_cluster)
  app_target_default_main(motor_cluster motor_cluster)

  qul_target_qml_sources(motor_cluster
      qmls/small/main/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/small/bottomElements/BottomCommonElements.qml
          qmls/small/bottomElements/OdoTextElement.qml
          qmls/small/bottomElements/TextElement.qml
          qmls/small/bottomElements/TimeView.qml
          qmls/small/gauges/FuelGaugeView.qml
          qmls/small/gauges/GearGaugeView.qml
          qmls/small/keyboard/InputTextField.qml
          qmls/small/keyboard/KeyBase.qml
          qmls/small/keyboard/KeyFont20.qml
          qmls/small/keyboard/KeyFont36.qml
          qmls/small/keyboard/KeyWithImage.qml
          qmls/small/keyboard/Keyboard.qml
          qmls/small/keyboard/KeyboardView.qml
          qmls/small/Logo.qml
          qmls/small/navigation/Arrow.qml
          qmls/small/navigation/Navigation.qml
          qmls/small/RangeIconWithText.qml
          qmls/small/RoadView.qml
          qmls/small/SpeedoView.qml
          qmls/small/Statistics.qml
          qmls/small/tacho/NumberedScaleView.qml
          qmls/small/tacho/TachoView.qml
          qmls/small/telltales/TellTalesIndicator.qml
          qmls/small/telltales/TellTalesView.qml
          qmls/small/utils/ItemWithAcivationAnimations.qml
          qmls/small/utils/ClipingItem.qml
          qmls/small/utils/TextInRoundedBox.qml
          qmls/small/Warning.qml
          qmls/small/Style.qml
          qmls/small/gauges/StartupConfig.qml
          qmls/small/utils/MathAPI.qml
          qmls/small/MainModel.qml
          qmls/small/telltales/TellTalesModel.qml
          qmls/small/navigation/NavigationModel.qml
          ${QML_PERFORMANCE_FILES}
  )
  target_link_libraries (motor_cluster motor_cluster_module)

  qul_add_resource(motor_cluster_module
      FILES
      images/small/bg/main-light.png
      images/small/bg/main.png
      images/small/fuelGauge/fuel-colored-bg.png
      images/small/fuelGauge/fuel-colored-circle-day.png
      images/small/fuelGauge/fuel-colored-circle.png
      images/small/fuelGauge/fuel-scale.png
      images/small/fuelGauge/hole-in-bg-day.png
      images/small/fuelGauge/hole-in-bg.png
      images/small/fuelGauge/ring-2.png
      images/small/fuelGauge/wave-bottom-part.png
      images/small/fuelGauge/wave-shadow.png
      images/small/fuelGauge/wave-top-part.png
      images/small/keyboard/backspace-key.png
      images/small/keyboard/enter-key.png
      images/small/keyboard/go-home-key.png
      images/small/keyboard/go-work-key.png
      images/small/keyboard/minimize-keyboard.png
      images/small/mainScreen/left-lines-day.png
      images/small/mainScreen/left-lines.png
      images/small/mainScreen/right-lines-day.png
      images/small/mainScreen/right-lines.png
      images/small/mainScreen/road-day.png
      images/small/mainScreen/road.png
      images/small/mainScreen/tacho-bottom-line-day.png
      images/small/mainScreen/tacho-bottom-line.png
      images/small/mainScreen/tacho-top-line-day.png
      images/small/mainScreen/tacho-top-line.png
      images/small/navigation/destination-pin.png
      images/small/navigation/tbt-1-arrow-left.png
      images/small/navigation/tbt-1-arrow-stright.png
      images/small/navigation/tbt-center-separator.png
      images/small/qt-logo.png
      images/small/range.png
      images/small/status/battery-status.png
      images/small/status/distance-status.png
      images/small/status/engine-oil-status.png
      images/small/status/fuel-avg-status.png
      images/small/status/service-status.png
      images/small/status/time-status.png
      images/small/tacho/1.png
      images/small/tacho/2.png
      images/small/tacho/3.png
      images/small/tacho/4.png
      images/small/tacho/5.png
      images/small/tacho/6.png
      images/small/tacho/light/01.png
      images/small/tacho/light/02.png
      images/small/tacho/light/03.png
      images/small/tacho/light/04.png
      images/small/tacho/light/05.png
      images/small/tacho/light/06.png
      images/small/telltales/battery.png
      images/small/telltales/engine-failure.png
      images/small/telltales/engine-oil.png
      images/small/telltales/fuel.png
      images/small/telltales/high-beams.png
      images/small/turn-left.png
      images/small/warnings/engine-failure-warning.png
      images/small/warnings/engine-oil-warning.png
      images/small/warnings/battery-warning.png
  )
endif()