C

Qt Quick Ultralite freertos_multitask Example

cmake_minimum_required (VERSION 3.21.1)

project(freertos)

# Add platform specific driver include directories

if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${QUL_PLATFORM}/freertos.cmake)
    if(NOT DEFINED FREERTOS_DIR)
        message(WARNING "FREERTOS_DIR cache entry is not set. Skipping freertos_multitask.")
    else()
        file(TO_CMAKE_PATH "${FREERTOS_DIR}" FREERTOS_DIR)

        add_library(freertos_kernel STATIC)
        target_link_libraries(freertos_kernel PRIVATE "$<BUILD_INTERFACE:Qul::PlatformArchitecture>")

        # Enforce symbols to be put in the binary, otherwise LTO will strip them
        if(NOT IAR)
            target_link_libraries(freertos_kernel PRIVATE -Wl,-u,vTaskSwitchContext)
        endif()

        target_include_directories(freertos_kernel PUBLIC ${QUL_PLATFORM_TARGET_DIR})
        include(${QUL_PLATFORM}/freertos.cmake)

        target_compile_definitions(freertos_kernel PUBLIC USE_FreeRTOS_HEAP_4)

        # Add common sources
        target_sources(freertos_kernel PRIVATE
            ${FREERTOS_DIR}/portable/MemMang/heap_4.c
        )
    endif()
endif()