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)

set(MOTOR_CLUSTER_SELECTORS ${SIZE_VARIANT})

if(QUL_PLATFORM MATCHES "^rh850")
    list(APPEND MOTOR_CLUSTER_SELECTORS "rh850")
elseif(QUL_PLATFORM MATCHES "^tviic2d")
    list(APPEND MOTOR_CLUSTER_SELECTORS "tviic2d")
elseif(QUL_PLATFORM MATCHES "^ek-ra6m3g")
    list(APPEND MOTOR_CLUSTER_SELECTORS "ek-ra6m3g")
endif()

if(QUL_PLATFORM MATCHES "^tviic2d")
    qul_add_target(motor_cluster
                    QML_PROJECT qmlproject/motor_cluster.qmlproject
                    SELECTORS ${MOTOR_CLUSTER_SELECTORS}
    )

    target_link_libraries(motor_cluster PRIVATE Qul::PlatformTraveoIIExtras)
    target_sources(motor_cluster PRIVATE src/tviic2d/main.cpp)
else()
    qul_add_target(motor_cluster
                    QML_PROJECT qmlproject/motor_cluster.qmlproject
                    SELECTORS ${MOTOR_CLUSTER_SELECTORS}
                    GENERATE_ENTRYPOINT
    )
endif()

target_sources(motor_cluster 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 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(motor_cluster PRIVATE motor_cluster_etl)

if(SIZE_VARIANT STREQUAL "big")
    target_include_directories(motor_cluster PRIVATE qmls/+big/gauges qmls/welcome)
endif()

app_target_setup_os(motor_cluster)