C

Qt Quick Ultralite仪表集群示例

cmake_minimum_required (VERSION 3.21.1)

project(instrument_cluster VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT TARGET Qul::Core)
    find_package(Qul)
endif()

set(TARGET_SOURCES src/VehicleStatus.cpp)
set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(GENERATE_ENTRYPOINT_ARG "")

if(NOT QUL_PLATFORM MATCHES "autosar")
    set(SIMULATOR_DIR src/simulation)
    set(TARGET_SOURCES
        ${TARGET_SOURCES}
        ${SIMULATOR_DIR}/simulator.cpp
        ${SIMULATOR_DIR}/${QUL_OS_LOWERCASE}/main.cpp
    )
    set(INCLUDE_DIRECTORIES
        ${INCLUDE_DIRECTORIES}
        ${CMAKE_CURRENT_SOURCE_DIR}/src/simulation
    )
else()
    set(GENERATE_ENTRYPOINT_ARG GENERATE_ENTRYPOINT)
endif()

qul_add_target(instrument_cluster
    ${TARGET_SOURCES}
    QML_PROJECT mcu_instrument_cluster.qmlproject
    ${GENERATE_ENTRYPOINT_ARG}
)
app_target_setup_os(instrument_cluster)

target_include_directories(instrument_cluster PRIVATE
    ${INCLUDE_DIRECTORIES}
)

if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
    add_custom_command(TARGET instrument_cluster
        COMMAND strip instrument_cluster -o instrument_cluster.stripped
        DEPENDS instrument_cluster)
endif()