From 07d60b1c0481c93299eff0762e7797f4aebc0cf9 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 26 Sep 2023 07:20:51 +0200 Subject: [PATCH] feat(esp_wifi): Add dependency on wifi_remote for chips with no wifi --- components/esp_wifi/CMakeLists.txt | 16 +++++++++++++++- components/esp_wifi/src/wifi_default.c | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 8605bed5df..97ddaec4ea 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -38,11 +38,18 @@ if(CONFIG_ESP_WIFI_ENABLED) if(CONFIG_ESP_WIFI_NAN_ENABLE) list(APPEND srcs "wifi_apps/src/nan_app.c") endif() + set(local_include_dirs include/local) +else() + # No local wifi: provide only netif bindings + set(srcs + "src/wifi_default.c" + "src/wifi_netif.c") + set(local_include_dirs) endif() idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "include" "wifi_apps/include" + INCLUDE_DIRS "include" "wifi_apps/include" ${local_include_dirs} REQUIRES esp_event esp_phy esp_netif PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash wpa_supplicant hal lwip esp_coex ${extra_priv_requires} @@ -70,6 +77,13 @@ if(CONFIG_ESP_WIFI_ENABLED) target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob}) endforeach() endif() +else() + # No local wifi: use esp_wifi_remote if it's available within our components + idf_build_get_property(build_components BUILD_COMPONENTS) + if(esp_wifi_remote IN_LIST build_components) + idf_component_get_property(esp_wifi_remote esp_wifi_remote COMPONENT_LIB) + target_link_libraries(${COMPONENT_LIB} PUBLIC ${esp_wifi_remote}) + endif() if(CONFIG_SPIRAM) idf_component_optional_requires(PRIVATE esp_psram) diff --git a/components/esp_wifi/src/wifi_default.c b/components/esp_wifi/src/wifi_default.c index 9b8d06bd9d..4851d6bc7d 100644 --- a/components/esp_wifi/src/wifi_default.c +++ b/components/esp_wifi/src/wifi_default.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ #include "sdkconfig.h" +#include "esp_system.h" #include "esp_wifi.h" #include "esp_netif.h" #include "esp_log.h"