C

Qt Quick Ultralite freertos_multitask Example

cmake_minimum_required (VERSION 3.21.1)

project(freertos_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(freertos_multitask
         src/mcu/main.cpp
         src/mcu/hardwarecontrol.cpp
         src/mcu/threads/led_thread.cpp
         src/mcu/threads/qul_thread.cpp
         src/mcu/threads/fan_thread.cpp
         QML_PROJECT
         mcu_freertos_multitask.qmlproject
    )

    target_compile_definitions(freertos_multitask PRIVATE FREERTOS)
    target_include_directories(freertos_multitask PRIVATE src src/mcu/threads)
    target_link_libraries(freertos_multitask PRIVATE freertos_kernel board_utils)

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