diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index acd587de92..dda2742f09 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -86,7 +86,6 @@ set(srcs "port/esp32/hooks/lwip_default_hooks.c" "port/esp32/debug/lwip_debug.c" "port/esp32/freertos/sys_arch.c" - "port/esp32/netif/dhcp_state.c" "port/esp32/netif/wlanif.c") if(CONFIG_LWIP_PPP_SUPPORT) @@ -148,11 +147,15 @@ if(CONFIG_LWIP_DHCPS) list(APPEND srcs "apps/dhcpserver/dhcpserver.c") endif() +if(CONFIG_LWIP_DHCP_RESTORE_LAST_IP) + list(APPEND srcs "port/esp32/netif/dhcp_state.c") +endif() + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" LDFRAGMENTS linker.lf REQUIRES vfs esp_wifi - PRIV_REQUIRES esp_eth esp_netif tcpip_adapter nvs_flash openthread) + PRIV_REQUIRES esp_netif tcpip_adapter) # lots of LWIP source files evaluate macros that check address of stack variables target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address) @@ -174,3 +177,15 @@ set_source_files_properties( PROPERTIES COMPILE_FLAGS -Wno-type-limits ) + +if(CONFIG_OPENTHREAD_ENABLED) + idf_component_optional_requires(PRIVATE openthread) +endif() + +if(CONFIG_ETH_ENABLED) + idf_component_optional_requires(PRIVATE esp_eth) +endif() + +if(CONFIG_LWIP_DHCP_RESTORE_LAST_IP) + idf_component_optional_requires(PRIVATE nvs_flash) +endif() diff --git a/tools/test_apps/system/g1_components/CMakeLists.txt b/tools/test_apps/system/g1_components/CMakeLists.txt index 3a6de2bbf7..98d99530e6 100644 --- a/tools/test_apps/system/g1_components/CMakeLists.txt +++ b/tools/test_apps/system/g1_components/CMakeLists.txt @@ -37,8 +37,6 @@ set(extra_components_which_shouldnt_be_included # efuse and app_update should be removed from G1 build; # [refactor-todo]: see if the dependency from spi_flash can be made weak bootloader_support - # console is pulled in by openthread, which should be removed - console # [refactor-todo]: should cxx be in G1? Can it exist without FreeRTOS? cxx # [refactor-todo]: driver is a dependency of esp_pm, esp_timer, spi_flash, vfs, esp_wifi, ${IDF_TARGET} @@ -79,9 +77,6 @@ set(extra_components_which_shouldnt_be_included # esptool_py is a dependency of bootloader, esp_wifi, app_update, partition_table, all of which # should be removed from G1-only build. esptool_py - # a recent addition to the G1-only build, ieee802154 is a dependency of openthread, to be removed - # once openthread is (easily) removed. - ieee802154 # lwip is a common component due to "sys/socket.h" header. # [refactor-todo] consider adding a system-level sys/socket.h in newlib instead lwip @@ -90,11 +85,8 @@ set(extra_components_which_shouldnt_be_included mbedtls # nvs_flash is required by: # esp_system — no obvious reason, [refactor-todo] why? - # lwip — can be turned into a weak dependency # esp_wifi, esp_phy — both should be removed nvs_flash - # openthread is a dependency of lwip, it is easy to turn it into a conditional one - openthread # partition_table is pulled in by app_update, esptool_py, bootloader; all to be removed partition_table # pthread is required by esp_system (for initialization only, can be made a weak dependency)