C

Qt Quick Ultralite freertos_multitask Example

cmake_minimum_required (VERSION 3.15)

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

add_subdirectory(freertos)

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

    add_executable(freertos_multitask
         src/main.cpp
         src/fancontrol.cpp
    )
    qul_target_generate_interfaces(freertos_multitask
        ${CMAKE_CURRENT_SOURCE_DIR}/src/fancontrol.h
    )
    qul_add_resource(freertos_multitask
        FILES
            images/background-dark.png
            images/fan-off.png
    )

    qul_target_qml_sources(freertos_multitask freertos_multitask.qml)
    target_link_libraries (freertos_multitask Qul::QuickUltralite Qul::QuickUltralitePlatform freertos_kernel board_utils)

elseif(NOT CMAKE_CROSSCOMPILING) # No FreeRTOS here - fallback for building on desktop platform
    add_executable(freertos_multitask_desktop src/fancontrol.cpp)
    qul_add_resource(freertos_multitask_desktop
        FILES
            images/background-dark.png
            images/fan-off.png
    )
    qul_target_qml_sources(freertos_multitask_desktop freertos_multitask.qml)
    qul_target_generate_interfaces(freertos_multitask_desktop
        ${CMAKE_CURRENT_SOURCE_DIR}/src/fancontrol.h
    )
    target_compile_definitions(freertos_multitask_desktop PRIVATE NO_LED)

    app_target_default_main(freertos_multitask_desktop freertos_multitask)
    target_link_libraries (freertos_multitask_desktop Qul::QuickUltralite Qul::QuickUltralitePlatform)
else()
    message(WARNING "Skipping generating target: freertos_multitask")
endif()