CMakeLists.txt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. idf_build_get_property(components_to_build BUILD_COMPONENTS)
  2. set(srcs)
  3. set(include)
  4. # As CONFIG_ETH_ENABLED comes from Kconfig, it is not evaluated yet
  5. # when components are being registered.
  6. # Thus, always add the (private) requirements, regardless of Kconfig
  7. set(priv_requires driver log esp_timer)
  8. # If Ethernet disabled in Kconfig, this is a config-only component
  9. if(CONFIG_ETH_ENABLED)
  10. set(srcs "src/esp_eth.c" "src/esp_eth_phy_802_3.c")
  11. set(include "include")
  12. if(NOT CMAKE_BUILD_EARLY_EXPANSION)
  13. # esp_netif related
  14. if(esp_netif IN_LIST components_to_build)
  15. list(APPEND srcs "src/esp_eth_netif_glue.c")
  16. endif()
  17. endif()
  18. if(CONFIG_ETH_USE_ESP32_EMAC)
  19. list(APPEND srcs "src/esp_eth_mac_esp.c"
  20. "src/esp_eth_phy_dp83848.c"
  21. "src/esp_eth_phy_ip101.c"
  22. "src/esp_eth_phy_ksz80xx.c"
  23. "src/esp_eth_phy_lan87xx.c"
  24. "src/esp_eth_phy_rtl8201.c")
  25. endif()
  26. if(CONFIG_ETH_SPI_ETHERNET_DM9051)
  27. list(APPEND srcs "src/esp_eth_mac_dm9051.c"
  28. "src/esp_eth_phy_dm9051.c")
  29. endif()
  30. if(CONFIG_ETH_SPI_ETHERNET_W5500)
  31. list(APPEND srcs "src/esp_eth_mac_w5500.c"
  32. "src/esp_eth_phy_w5500.c")
  33. endif()
  34. if(CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL)
  35. list(APPEND srcs "src/esp_eth_mac_ksz8851snl.c"
  36. "src/esp_eth_phy_ksz8851snl.c")
  37. endif()
  38. if(CONFIG_ETH_USE_OPENETH)
  39. list(APPEND srcs "src/esp_eth_mac_openeth.c")
  40. endif()
  41. endif()
  42. idf_component_register(SRCS "${srcs}"
  43. INCLUDE_DIRS ${include}
  44. REQUIRES esp_event # For using "ESP_EVENT_DECLARE_BASE" in header file
  45. PRIV_REQUIRES ${priv_requires})
  46. if(CONFIG_ETH_ENABLED)
  47. target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
  48. endif()
  49. if(CONFIG_ETH_ENABLED)
  50. if(CONFIG_ETH_USE_SPI_ETHERNET)
  51. idf_component_optional_requires(PUBLIC driver)
  52. endif()
  53. idf_component_optional_requires(PRIVATE esp_netif esp_pm)
  54. endif()