C

Qt Quick Ultralite 单车仪表盘演示

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-evkb-freertos")
    set(QMLPROJECT_FILE "qmlproject/motor_cluster_rotated.qmlproject")
    set(DEFAULT_SIZE_VARIANT "big")
else()
    set(QMLPROJECT_FILE "qmlproject/motor_cluster.qmlproject")
    set(DEFAULT_SIZE_VARIANT "small")
endif()

# This variable can be defined on the command line
if (NOT DEFINED SIZE_VARIANT)
    set(SIZE_VARIANT ${DEFAULT_SIZE_VARIANT} 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")
    if(QUL_PLATFORM MATCHES "^tviic2d6mddr")
        list(APPEND MOTOR_CLUSTER_SELECTORS "traveo-t2g-cyt4en")
    else()
        list(APPEND MOTOR_CLUSTER_SELECTORS "traveo-t2g")
    endif()
elseif(QUL_PLATFORM MATCHES "^ek-ra6m3g")
    list(APPEND MOTOR_CLUSTER_SELECTORS "ek-ra6m3g")
elseif(QUL_PLATFORM MATCHES "^stm32f769")
    list(APPEND MOTOR_CLUSTER_SELECTORS "stm32f769" "intro" "15fps")
elseif(QUL_PLATFORM MATCHES "^qt")
    list(APPEND MOTOR_CLUSTER_SELECTORS "qt" "intro")
endif()

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

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

target_sources(motor_cluster PRIVATE
src/simulation/simulationcontroller.cpp
src/simulation/states.cpp
src/simulation/drivetrain.cpp
src/simulation/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)