diff --git a/components/asio/CMakeLists.txt b/components/asio/CMakeLists.txt index c088644f94..e2421fead4 100644 --- a/components/asio/CMakeLists.txt +++ b/components/asio/CMakeLists.txt @@ -1,3 +1,11 @@ +if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION) + # 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. + message(STATUS "IPV6 support is disabled so the asio component will not be built") + idf_component_register() + return() +endif() + set(asio_sources "asio/asio/src/asio.cpp") if(CONFIG_ASIO_SSL_SUPPORT) diff --git a/components/asio/Kconfig b/components/asio/Kconfig index 582410e7ce..3b488a0c3b 100644 --- a/components/asio/Kconfig +++ b/components/asio/Kconfig @@ -1,4 +1,6 @@ menu "ESP-ASIO" + visible if LWIP_IPV6 + config ASIO_SSL_SUPPORT bool "Enable SSL/TLS support of ASIO" default n diff --git a/components/asio/component.mk b/components/asio/component.mk index 30b2907bbb..c93c8dbb97 100644 --- a/components/asio/component.mk +++ b/components/asio/component.mk @@ -1,3 +1,5 @@ +ifdef CONFIG_LWIP_IPV6 + COMPONENT_ADD_INCLUDEDIRS := asio/asio/include port/include COMPONENT_PRIV_INCLUDEDIRS := private_include COMPONENT_SRCDIRS := asio/asio/src port/src @@ -7,3 +9,5 @@ COMPONENT_OBJEXCLUDE := asio/asio/src/asio_ssl.o port/src/esp_asio_openssl_stubs endif COMPONENT_SUBMODULES += asio + +endif # CONFIG_LWIP_IPV6 diff --git a/components/coap/CMakeLists.txt b/components/coap/CMakeLists.txt index a3dccee5c0..2c3b57e1a2 100644 --- a/components/coap/CMakeLists.txt +++ b/components/coap/CMakeLists.txt @@ -1,3 +1,11 @@ +if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION) + message(STATUS "IPV6 support is disabled so the coap 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() + set(include_dirs port/include port/include/coap libcoap/include libcoap/include/coap2) set(srcs diff --git a/components/coap/Kconfig b/components/coap/Kconfig index 2e56938937..a5d613e146 100644 --- a/components/coap/Kconfig +++ b/components/coap/Kconfig @@ -1,4 +1,5 @@ menu "CoAP Configuration" + visible if LWIP_IPV6 choice COAP_MBEDTLS_ENCRYPTION_MODE prompt "CoAP Encryption method" diff --git a/components/coap/component.mk b/components/coap/component.mk index 448a94f6cb..eeec323f0c 100644 --- a/components/coap/component.mk +++ b/components/coap/component.mk @@ -2,6 +2,8 @@ # Component Makefile # +ifdef CONFIG_LWIP_IPV6 + COMPONENT_ADD_INCLUDEDIRS := port/include port/include/coap libcoap/include libcoap/include/coap2 COMPONENT_OBJS = libcoap/src/address.o libcoap/src/async.o libcoap/src/block.o libcoap/src/coap_event.o libcoap/src/coap_hashkey.o libcoap/src/coap_session.o libcoap/src/coap_time.o port/coap_debug.o libcoap/src/encode.o libcoap/src/mem.o libcoap/src/net.o libcoap/src/option.o libcoap/src/pdu.o libcoap/src/resource.o libcoap/src/str.o libcoap/src/subscribe.o libcoap/src/uri.o port/coap_mbedtls.o libcoap/src/coap_io.o port/coap_notls.o @@ -12,3 +14,5 @@ COMPONENT_SUBMODULES += libcoap # Silence format truncation warning, until it is fixed upstream port/coap_debug.o: CFLAGS += -Wno-format-truncation + +endif # CONFIG_LWIP_IPV6 diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 5ba4b4ca47..e10947cdbd 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -324,9 +324,8 @@ menu "LWIP" default y help Enable IPv6 function. If not use IPv6 function, set this option to n. - If disable LWIP_IPV6, not adding coap and asio component into the build. - Please assign them to EXCLUDE_COMPONENTS in the make or cmake file in your - project directory, so that the component will not be compiled. + If disabling LWIP_IPV6 then some other components (coap and asio) will + no longer be available. config LWIP_IPV6_AUTOCONFIG bool "Enable IPV6 stateless address autoconfiguration (SLAAC)" diff --git a/examples/protocols/sockets/tcp_server/CMakeLists.txt b/examples/protocols/sockets/tcp_server/CMakeLists.txt index 5761720556..9865464bd8 100644 --- a/examples/protocols/sockets/tcp_server/CMakeLists.txt +++ b/examples/protocols/sockets/tcp_server/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 3.5) # (Not part of the boilerplate) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(EXCLUDE_COMPONENTS "coap" "asio") include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(tcp_server) diff --git a/examples/protocols/sockets/tcp_server/Makefile b/examples/protocols/sockets/tcp_server/Makefile index 344b8aa424..318e78a775 100644 --- a/examples/protocols/sockets/tcp_server/Makefile +++ b/examples/protocols/sockets/tcp_server/Makefile @@ -6,6 +6,5 @@ PROJECT_NAME := tcp_server EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common -EXCLUDE_COMPONENTS = coap asio include $(IDF_PATH)/make/project.mk