CMakeLists.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. idf_build_get_property(components_to_build BUILD_COMPONENTS)
  2. set(srcs)
  3. set(include)
  4. set(priv_requires)
  5. # If Ethernet disabled in Kconfig, this is a config-only component
  6. if(CONFIG_ETH_ENABLED)
  7. set(srcs "src/esp_eth.c" "src/esp_eth_phy.c")
  8. set(include "include")
  9. set(priv_requires "driver" "log" "esp_timer") # require "driver" for using some GPIO APIs
  10. if(NOT CMAKE_BUILD_EARLY_EXPANSION)
  11. # esp_netif related
  12. if(esp_netif IN_LIST components_to_build)
  13. list(APPEND srcs "src/esp_eth_netif_glue.c")
  14. list(APPEND priv_requires esp_netif esp_pm)
  15. endif()
  16. endif()
  17. if(CONFIG_ETH_USE_ESP32_EMAC)
  18. list(APPEND srcs "src/esp_eth_mac_esp.c"
  19. "src/esp_eth_phy_dp83848.c"
  20. "src/esp_eth_phy_ip101.c"
  21. "src/esp_eth_phy_ksz80xx.c"
  22. "src/esp_eth_phy_lan87xx.c"
  23. "src/esp_eth_phy_rtl8201.c")
  24. endif()
  25. if(CONFIG_ETH_SPI_ETHERNET_DM9051)
  26. list(APPEND srcs "src/esp_eth_mac_dm9051.c"
  27. "src/esp_eth_phy_dm9051.c")
  28. endif()
  29. if(CONFIG_ETH_SPI_ETHERNET_W5500)
  30. list(APPEND srcs "src/esp_eth_mac_w5500.c"
  31. "src/esp_eth_phy_w5500.c")
  32. endif()
  33. if(CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL)
  34. list(APPEND srcs "src/esp_eth_mac_ksz8851snl.c"
  35. "src/esp_eth_phy_ksz8851snl.c")
  36. endif()
  37. if(CONFIG_ETH_USE_OPENETH)
  38. list(APPEND srcs "src/esp_eth_mac_openeth.c")
  39. endif()
  40. endif()
  41. idf_component_register(SRCS "${srcs}"
  42. INCLUDE_DIRS ${include}
  43. REQUIRES "esp_event" # For using "ESP_EVENT_DECLARE_BASE" in header file
  44. PRIV_REQUIRES ${priv_requires})
  45. # uses C11 atomic feature
  46. set_source_files_properties(src/esp_eth.c PROPERTIES COMPILE_FLAGS -std=gnu11)