1idf_build_get_property(target IDF_TARGET)
2set(priv_include_dirs "private_include")
3set(priv_requires "")
4set(requires "log" "esp_common" "freertos")
5set(srcs "default_event_loop.c"
6         "esp_event.c"
7         "esp_event_private.c")
8
9if(${target} STREQUAL "linux")
10    list(APPEND requires "linux")
11    # Temporary fix until esp_system is available for linux, too
12    list(APPEND priv_include_dirs "$ENV{IDF_PATH}/tools/mocks/esp_system/include")
13else()
14    list(APPEND requires "esp_netif")
15    list(APPEND srcs "event_loop_legacy.c" "event_send.c")
16    if(${target} STREQUAL "esp32")
17        list(APPEND priv_requires esp_eth esp_timer)
18    else()
19        list(APPEND priv_requires esp_timer)
20    endif()
21endif()
22
23idf_component_register(SRCS ${srcs}
24                    INCLUDE_DIRS "include"
25                    PRIV_INCLUDE_DIRS ${priv_include_dirs}
26                    REQUIRES ${requires}
27                    PRIV_REQUIRES ${priv_requires}
28                    LDFRAGMENTS linker.lf)
29
30if(CONFIG_ESP_EVENT_LOOP_PROFILING)
31    # uses C11 atomic feature
32    set_source_files_properties(esp_event.c PROPERTIES COMPILE_FLAGS -std=gnu11)
33endif()
34