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() if (NOT UNIT_SYSTEM) if (DEMO_REGION STREQUAL "usa") set(UNIT_SYSTEM "imperial" CACHE STRING "Automotive Demo Unit System") endif() endif() message(STATUS "DEMO_REGION: ${DEMO_REGION}") if(QUL_PLATFORM MATCHES "^tviic2d4m" OR QUL_PLATFORM STREQUAL "tviic2d6m-baremetal") set(QML_PROJCT_FILE qmlproject/automotive_traveo_t2g.qmlproject) else() set(QML_PROJCT_FILE qmlproject/automotive.qmlproject) endif() set (GENERATE_ENTRYPOINT_ARG "") if (QUL_PLATFORM MATCHES "autosar") set(GENERATE_ENTRYPOINT_ARG GENERATE_ENTRYPOINT) endif() qul_add_target(automotive QML_PROJECT ${QML_PROJCT_FILE} SELECTORS ${UNIT_SYSTEM} ${DEMO_REGION} ${GENERATE_ENTRYPOINT_ARG} ) # get module library target for "automotive" target qul_get_module_target(automotive_module_target automotive qmlproject/automotive_module.qmlproject) # add module source files to the module library target_sources(${automotive_module_target} PRIVATE src/connectivityservice.cpp) qul_add_target(automotive_benchmark QML_PROJECT ${QML_PROJCT_FILE} SELECTORS ${UNIT_SYSTEM} ${DEMO_REGION} ${GENERATE_ENTRYPOINT_ARG} ) qul_get_module_target(automotive_module_target automotive_benchmark qmlproject/automotive_module.qmlproject) target_sources(${automotive_module_target} PRIVATE src/connectivityservice.cpp) target_compile_definitions(automotive_benchmark PRIVATE QUL_DEMO_BENCHMARK_MODE QUL_ENABLE_PERFORMANCE_LOGGING QUL_ENABLE_HARDWARE_PERFORMANCE_LOGGING ) 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 ${CMAKE_CURRENT_SOURCE_DIR}/benchmark ) target_include_directories(automotive_benchmark PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/benchmark ) set(TARGET_SOURCES src/simulationcontroller.cpp src/simulation/states.cpp src/simulation/drivetrain.cpp src/simulation/speedlimits.cpp src/simulation/drivestates.cpp src/simulation/lights.cpp ) if(NOT QUL_PLATFORM MATCHES "autosar") set(TARGET_SOURCES ${TARGET_SOURCES} src/platform/${QUL_OS_LOWERCASE}/main.cpp ) endif() target_sources(automotive PRIVATE ${TARGET_SOURCES}) target_sources(automotive_benchmark PRIVATE ${TARGET_SOURCES}) if (QUL_OS MATCHES "FreeRTOS") # Use heap_5 policy and custom FreeRTOSConfig.h set_property(TARGET automotive PROPERTY QUL_FREERTOS_HEAP_POLICY "heap_5") set_property(TARGET automotive_benchmark PROPERTY QUL_FREERTOS_HEAP_POLICY "heap_5") target_include_directories(automotive PRIVATE ${QUL_PLATFORM_TARGET_DIR}) target_include_directories(automotive_benchmark PRIVATE ${QUL_PLATFORM_TARGET_DIR}) endif() target_link_libraries(automotive PRIVATE automotive_etl) target_link_libraries(automotive_benchmark PRIVATE automotive_etl) app_target_setup_os(automotive) app_target_setup_os(automotive_benchmark)