C

Qt Quick Ultralite freertos_multitask Example

cmake_minimum_required (VERSION 3.15)

project(freertos)

# Add platform specific driver include directories
string(TOLOWER ${QUL_PLATFORM} QUL_PLATFORM_LOWERCASE)

if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${QUL_PLATFORM_LOWERCASE}/freertosdir.cmake)
    include(${QUL_PLATFORM_LOWERCASE}/freertosdir.cmake)

    set(FREERTOS_DIR $ENV{${FREERTOS_DIR_ENV_VAR}})
    if(NOT FREERTOS_DIR)
        message(WARNING "${FREERTOS_DIR_ENV_VAR} environment variable is undefined!")
    else()
        add_library(freertos_kernel STATIC)

        # 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 ${TARGET_PLATFORM_DIR})
        include(${QUL_PLATFORM_LOWERCASE}/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()