C

Qt Quick Ultralite Automotive Cluster Demo

cmake_minimum_required (VERSION 3.21.1)

project(automotive 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()

include(src/3rdparty/etl/CMakeLists.txt)

option(ENABLE_CANBUS "Enable CAN Bus" OFF)
message(STATUS "Enable CAN Bus: ${ENABLE_CANBUS}")

if(ENABLE_CANBUS AND NOT QUL_RH850_CANBUS_ENABLED)
    message(STATUS "ENABLE_CANBUS option is ON. Pass -DQUL_RH850_CANBUS_ENABLED Cache entry to enable interrupt vectors for CAN")
endif()

set(UNIT_SYSTEM "metric" CACHE STRING "Automotive Demo Unit System")
if (NOT DEMO_REGION)
    if (UNIT_SYSTEM STREQUAL "imperial")
        set(DEMO_REGION "usa")
    else()
        set(DEMO_REGION "de")
    endif()
else()
    set(DEMO_REGION ${DEMO_REGION})
endif()
message(STATUS "DEMO_REGION: ${DEMO_REGION}")

if(QUL_PLATFORM MATCHES "^tviic2d")
    set(QML_PROJCT_FILE qmlproject/automotive_tvii.qmlproject)
else()
    set(QML_PROJCT_FILE qmlproject/automotive.qmlproject)
endif()
qul_add_target(automotive
    QML_PROJECT
    ${QML_PROJCT_FILE}
    SELECTORS ${UNIT_SYSTEM} ${DEMO_REGION}
)

if (ENABLE_CANBUS)
    add_subdirectory(src/canbus)
   target_compile_definitions(automotive PUBLIC ENABLE_CANBUS)
endif()

add_subdirectory(src/hmi_input)

target_include_directories(automotive PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/src
)

target_sources(automotive PRIVATE
    src/platform/${QUL_OS_LOWERCASE}/main.cpp
    src/simulationcontroller.cpp
    src/simulation/states.cpp
    src/simulation/drivetrain.cpp
    src/simulation/speedlimits.cpp
    src/simulation/drivestates.cpp
    src/simulation/lights.cpp
)

if (QUL_OS MATCHES "FreeRTOS")
    # Use heap_5 policy and custom FreeRTOSConfig.h
    set_property(TARGET automotive PROPERTY QUL_FREERTOS_HEAP_POLICY "heap_5")
    target_include_directories(automotive PRIVATE ${QUL_PLATFORM_TARGET_DIR})
endif()

target_sources(automotive PRIVATE src/connectivityservice.cpp)

target_link_libraries(automotive PRIVATE automotive_etl)
app_target_setup_os(automotive)