CMakeLists.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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")
  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_lan8720.c"
  22. "src/esp_eth_phy_rtl8201.c")
  23. endif()
  24. if(CONFIG_ETH_SPI_ETHERNET_DM9051)
  25. list(APPEND srcs "src/esp_eth_mac_dm9051.c"
  26. "src/esp_eth_phy_dm9051.c")
  27. endif()
  28. if(CONFIG_ETH_USE_OPENETH)
  29. list(APPEND srcs "src/esp_eth_mac_openeth.c")
  30. endif()
  31. endif()
  32. idf_component_register(SRCS "${srcs}"
  33. INCLUDE_DIRS ${include}
  34. REQUIRES "esp_event" # For using "ESP_EVENT_DECLARE_BASE" in header file
  35. PRIV_REQUIRES ${priv_requires})
  36. # uses C11 atomic feature
  37. set_source_files_properties(src/esp_eth.c PROPERTIES COMPILE_FLAGS -std=gnu11)