CMakeLists.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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") # 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_esp32.c"
  19. "src/esp_eth_phy_dp83848.c"
  20. "src/esp_eth_phy_ip101.c"
  21. "src/esp_eth_phy_ksz8041.c"
  22. "src/esp_eth_phy_lan8720.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_USE_OPENETH)
  34. list(APPEND srcs "src/esp_eth_mac_openeth.c")
  35. endif()
  36. endif()
  37. idf_component_register(SRCS "${srcs}"
  38. INCLUDE_DIRS ${include}
  39. REQUIRES "esp_event" # For using "ESP_EVENT_DECLARE_BASE" in header file
  40. PRIV_REQUIRES ${priv_requires})
  41. # uses C11 atomic feature
  42. set_source_files_properties(src/esp_eth.c PROPERTIES COMPILE_FLAGS -std=gnu11)