CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. idf_build_get_property(target IDF_TARGET)
  2. set(srcs_lwip
  3. "lwip/esp_netif_lwip.c"
  4. "lwip/esp_netif_sntp.c"
  5. "lwip/esp_netif_lwip_defaults.c"
  6. "lwip/netif/wlanif.c"
  7. "lwip/netif/ethernetif.c"
  8. "lwip/netif/esp_pbuf_ref.c")
  9. set(srcs
  10. "esp_netif_handlers.c"
  11. "esp_netif_objects.c"
  12. "esp_netif_defaults.c")
  13. set(include_dirs "include")
  14. set(priv_include_dirs "private_include")
  15. idf_build_get_property(target IDF_TARGET)
  16. if(${target} STREQUAL "linux")
  17. list(APPEND include_dirs
  18. "linux/stubs/include")
  19. endif()
  20. if(CONFIG_PPP_SUPPORT)
  21. list(APPEND srcs_lwip lwip/esp_netif_lwip_ppp.c lwip/netif/ppp.c)
  22. endif()
  23. if(CONFIG_ESP_NETIF_L2_TAP)
  24. list(APPEND srcs vfs_l2tap/esp_vfs_l2tap.c)
  25. endif()
  26. if(CONFIG_ESP_NETIF_BRIDGE_EN)
  27. list(APPEND srcs_lwip lwip/esp_netif_br_glue.c)
  28. endif()
  29. if(CONFIG_ESP_NETIF_LOOPBACK)
  30. list(APPEND srcs loopback/esp_netif_loopback.c)
  31. elseif(CONFIG_ESP_NETIF_TCPIP_LWIP)
  32. list(APPEND srcs ${srcs_lwip})
  33. list(APPEND priv_include_dirs lwip)
  34. endif()
  35. idf_component_register(SRCS "${srcs}"
  36. INCLUDE_DIRS "${include_dirs}"
  37. PRIV_INCLUDE_DIRS "${priv_include_dirs}"
  38. REQUIRES esp_event
  39. PRIV_REQUIRES esp_netif_stack
  40. LDFRAGMENTS linker.lf)
  41. if(CONFIG_ESP_NETIF_L2_TAP OR CONFIG_ESP_NETIF_BRIDGE_EN)
  42. set(optional_requires "")
  43. if(CONFIG_ESP_NETIF_L2_TAP)
  44. list(APPEND optional_requires "vfs")
  45. endif()
  46. if(CONFIG_ESP_NETIF_BRIDGE_EN)
  47. list(APPEND optional_requires "esp_wifi")
  48. endif()
  49. list(APPEND optional_requires "esp_eth")
  50. idf_component_optional_requires(PRIVATE "${optional_requires}")
  51. endif()
  52. target_compile_definitions(${COMPONENT_LIB} PRIVATE ESP_NETIF_COMPONENT_BUILD)