From 9118e0f0449a955aa573672928c9f751840a5317 Mon Sep 17 00:00:00 2001 From: liuhan Date: Fri, 16 Apr 2021 17:23:18 +0800 Subject: [PATCH] transport: Add CONFI_WS_TRANSPORT for optimize the code size * Original commit: espressif/esp-idf@8b02c9026af32352c8c4ed23025fb42182db6cae --- components/esp_websocket_client/CMakeLists.txt | 8 ++++++++ components/esp_websocket_client/component.mk | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/components/esp_websocket_client/CMakeLists.txt b/components/esp_websocket_client/CMakeLists.txt index de17d6fdd..af21d9d08 100644 --- a/components/esp_websocket_client/CMakeLists.txt +++ b/components/esp_websocket_client/CMakeLists.txt @@ -1,3 +1,11 @@ +if(NOT CONFIG_WS_TRANSPORT AND NOT CMAKE_BUILD_EARLY_EXPANSION) + message(STATUS "Websocket transport is disabled so the esp_websocket_client component will not be built") + # note: the component is still included in the build so it can become visible again in config + # without needing to re-run CMake. However no source or header files are built. + idf_component_register() + return() +endif() + idf_component_register(SRCS "esp_websocket_client.c" INCLUDE_DIRS "include" REQUIRES lwip esp-tls tcp_transport nghttp diff --git a/components/esp_websocket_client/component.mk b/components/esp_websocket_client/component.mk index e69de29bb..300fea3da 100644 --- a/components/esp_websocket_client/component.mk +++ b/components/esp_websocket_client/component.mk @@ -0,0 +1,4 @@ +ifdef CONFIG_WS_TRANSPORT +COMPONENT_SRCDIRS := . +COMPONENT_ADD_INCLUDEDIRS := include +endif