C

Qt Quick Ultralite interrupt_handler Example

cmake_minimum_required (VERSION 3.15)

project(interrupt_handler VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT TARGET Qul::QuickUltralite)
    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)
    list(GET PLATFORM_COMPONENTS 2 PLATFORM_OS)
    string(JOIN "-" PLATFORM_BOARD_NAME ${PLATFORM_FAMILY} ${PLATFORM_BOARD})

    # FIXME: UL-1531, STM32F7508-discovery is excluded as it's interrupt handler handles both user
    # button and touch screen and is already defined by Qul
    if(NOT ${PLATFORM_BOARD_NAME} STREQUAL "stm32f7508-discovery"
       AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${PLATFORM_BOARD_NAME}")
        string(TOLOWER ${PLATFORM_BOARD_NAME} PLATFORM_DIR)
    else()
        set(PLATFORM_DIR "example")
    endif()
else()
    set(PLATFORM_DIR "example")
    set(PLATFORM_OS "baremetal")
endif()

string(TOLOWER ${PLATFORM_OS} OS_LOWERCASE)

add_executable(interrupt_handler
    interrupt_queue.cpp
    os/${OS_LOWERCASE}/main.cpp
)
target_include_directories(interrupt_handler PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
qul_target_generate_interfaces(interrupt_handler interrupt_queue.h)

add_subdirectory(${PLATFORM_DIR})

qul_target_qml_sources(interrupt_handler interrupt_handler.qml)
target_link_libraries (interrupt_handler Qul::QuickUltralite Qul::QuickUltralitePlatform)
app_target_setup_os(interrupt_handler)