1idf_build_get_property(target IDF_TARGET)
2set(srcs "log.c")
3set(priv_requires "")
4if(${target} STREQUAL "linux")
5    # We leave log buffers out for now on Linux since it's rarely used. Explicitely add esp_rom to Linux target
6    # since we don't have the common components there yet.
7    list(APPEND srcs "log_linux.c")
8else()
9    list(APPEND srcs "log_buffers.c")
10    list(APPEND priv_requires soc)
11endif()
12
13idf_component_register(SRCS ${srcs}
14                    INCLUDE_DIRS "include"
15                    LDFRAGMENTS linker.lf
16                    PRIV_REQUIRES ${priv_requires})
17
18if(NOT ${target} STREQUAL "linux")
19    # Ideally, FreeRTOS shouldn't be included into bootloader build, so the 2nd check should be unnecessary
20    if(freertos IN_LIST BUILD_COMPONENTS AND NOT BOOTLOADER_BUILD)
21        target_sources(${COMPONENT_TARGET} PRIVATE log_freertos.c)
22    else()
23        target_sources(${COMPONENT_TARGET} PRIVATE log_noos.c)
24    endif()
25endif()
26