C

Qt Quick Ultralite interrupt_handler Example

cmake_minimum_required (VERSION 3.21.1)

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

# Figure out correct board and os directory names
string(REGEX MATCHALL "([^\-]+|[^\-]+$)" PLATFORM_COMPONENTS ${QUL_PLATFORM})
list(LENGTH PLATFORM_COMPONENTS PLATFORM_COMPONENT_COUNT)
if(${PLATFORM_COMPONENT_COUNT} EQUAL 3)
    list(GET PLATFORM_COMPONENTS 0 PLATFORM_FAMILY)
    list(GET PLATFORM_COMPONENTS 1 PLATFORM_BOARD)
    string(JOIN "-" PLATFORM_BOARD_NAME ${PLATFORM_FAMILY} ${PLATFORM_BOARD})
    string(TOLOWER ${PLATFORM_BOARD_NAME} PLATFORM_BOARD_NAME_LOWER)

    if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${PLATFORM_BOARD_NAME_LOWER}")
        set(PLATFORM_DIR ${PLATFORM_BOARD_NAME_LOWER})
    else()
        set(PLATFORM_DIR "example")
    endif()
else()
    set(PLATFORM_DIR "example")
endif()

qul_add_target(interrupt_handler
    interrupt_queue.cpp
    os/${QUL_OS_LOWERCASE}/main.cpp
    QML_PROJECT
    mcu_interrupt_handler.qmlproject
)
target_link_libraries(interrupt_handler PRIVATE Qul::PlatformBSPConfig) # This is needed because there are SDK files involved.
target_include_directories(interrupt_handler PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

app_target_setup_os(interrupt_handler)

add_subdirectory(${PLATFORM_DIR})