OVMS3-idf/components/esp_eth/CMakeLists.txt
morris c3ee156df0 ethernet: move netif glue && add ref counter
1. move netif glue into single file
2. add reference counter for Ethernet driver
2019-11-27 10:36:32 +08:00

43 lines
1.4 KiB
CMake

idf_build_get_property(components_to_build BUILD_COMPONENTS)
set(srcs)
set(include)
set(priv_requires)
# If Ethernet disabled in Kconfig, this is a config-only component
if(CONFIG_ETH_ENABLED)
set(srcs "src/esp_eth.c")
set(include "include")
set(priv_requires "driver" "log") # require "driver" for using some GPIO APIs
# esp_netif related
if(esp_netif IN_LIST components_to_build)
list(APPEND srcs "src/esp_eth_netif_glue.c")
list(APPEND priv_requires "esp_netif")
endif()
if(CONFIG_ETH_USE_ESP32_EMAC)
list(APPEND srcs "src/esp_eth_mac_esp32.c"
"src/esp_eth_phy_dp83848.c"
"src/esp_eth_phy_ip101.c"
"src/esp_eth_phy_lan8720.c"
"src/esp_eth_phy_rtl8201.c")
endif()
if(CONFIG_ETH_SPI_ETHERNET_DM9051)
list(APPEND srcs "src/esp_eth_mac_dm9051.c"
"src/esp_eth_phy_dm9051.c")
endif()
if(CONFIG_ETH_USE_OPENETH)
list(APPEND srcs "src/esp_eth_mac_openeth.c")
endif()
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS ${include}
REQUIRES "esp_event" # For using "ESP_EVENT_DECLARE_BASE" in header file
PRIV_REQUIRES ${priv_requires})
# uses C11 atomic feature
set_source_files_properties(src/esp_eth.c PROPERTIES COMPILE_FLAGS -std=gnu11)