From 6c6030cdd776128b509c1b99445574e50e7e27bc Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 21 Apr 2026 11:23:33 +0200 Subject: [PATCH] fix(esp_wifi): declare interface deps in non-WiFi stub registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Public headers (notably esp_wifi_default.h) include esp_event.h, esp_netif.h and esp_phy.h. Declare these in REQUIRES so the headers are visible to consumers — same interface as the WiFi-enabled registration at the bottom of this file. Also declare wpa_supplicant as PRIV_REQUIRES so the remote/ EAP stubs can include esp_eap_client.h when the stub registration is compiled. --- components/esp_wifi/CMakeLists.txt | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index ddda9ebb331..a0c6f614167 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -15,25 +15,18 @@ if( NOT CONFIG_ESP_WIFI_ENABLED "src/wifi_netif.c" "src/wifi_default_ap.c") - # In build system v2, idf_component_optional_requires() includes the target - # component into the build immediately, so these stub sources are compiled - # even on targets where Wi-Fi is not supported. The stubs need esp_event and - # esp_netif headers, so those dependencies must be declared here for v2. - # - # In build system v1, idf_component_optional_requires() only links a - # component that is already part of the build. On non-Wi-Fi targets, this - # component is never pulled in, so the stubs are never compiled and the - # dependencies are not needed. Additionally, the CMAKE_BUILD_EARLY_EXPANSION - # guard ensures that the stubs are not compiled for v1. - set(priv_reqs "") - if(IDF_BUILD_V2) - set(priv_reqs "esp_event" "esp_netif") - endif() + # Public headers (notably esp_wifi_default.h) include esp_event.h, + # esp_netif.h and esp_phy.h. Declare these in REQUIRES so the headers + # are visible to consumers — same interface as the WiFi-enabled + # registration at the bottom of this file. + set(reqs "esp_event" "esp_netif" "esp_phy") + set(priv_reqs "wpa_supplicant") # This component provides "esp_wifi" "wifi_apps/nan_app" headers if WiFi not enabled # (implementation supported optionally in a managed component esp_wifi_remote) idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "include" "wifi_apps/nan_app/include" + REQUIRES ${reqs} PRIV_REQUIRES ${priv_reqs}) add_subdirectory(remote) # wifi-remote on esp32p4/h2 (no wifi) return()