C

Qt Quick Ultralite multitask Example

cmake_minimum_required (VERSION 3.21.1)

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

add_subdirectory(freertos)

if(TARGET freertos_kernel) # FreeRTOS support implemented for this platform
    add_subdirectory(board_utils)

    qul_add_target(multitask
         src/freertos/main.cpp
         src/freertos/hardwarecontrol.cpp
         src/freertos/threads/led_thread.cpp
         src/freertos/threads/qul_thread.cpp
         src/freertos/threads/fan_thread.cpp
         QML_PROJECT
         mcu_multitask.qmlproject
    )

    target_compile_definitions(multitask PRIVATE FREERTOS)
    target_include_directories(multitask PRIVATE src src/freertos/threads)
    target_link_libraries(multitask PRIVATE freertos_kernel board_utils)

elseif(NOT CMAKE_CROSSCOMPILING) # No FreeRTOS here - fallback for building on desktop platform
    qul_add_target(multitask_desktop
        src/desktop/hardwarecontrol.cpp
        QML_PROJECT
        mcu_multitask.qmlproject
        GENERATE_ENTRYPOINT
    )
    target_compile_definitions(multitask_desktop PRIVATE DESKTOP)
    target_include_directories(multitask_desktop PRIVATE src)
else()
    message(STATUS "Skipping generating target: multitask")
endif()