feat(mdns): Make including mdns_console KConfigurable

The CLI that mdns_console offers is very useful for debugging
and bootstrapping mDNS onto new projects, but some projects
may not want console CLI in place to reduce binary size.

This gives a KConfig option to do so.
This commit is contained in:
Richard Retanubun
2024-01-26 13:35:47 -05:00
parent 5ba7cfab8e
commit 27adbfeb3b
2 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,12 @@ else()
set(MDNS_NETWORKING "mdns_networking_lwip.c") set(MDNS_NETWORKING "mdns_networking_lwip.c")
endif() endif()
if(CONFIG_MDNS_ENABLE_CONSOLE_CLI)
set(MDNS_CONSOLE "mdns_console.c")
else()
set(MDNS_CONSOLE "")
endif()
idf_build_get_property(target IDF_TARGET) idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux") if(${target} STREQUAL "linux")
set(dependencies esp_netif_linux esp_timer esp_system) set(dependencies esp_netif_linux esp_timer esp_system)
@ -11,7 +17,7 @@ if(${target} STREQUAL "linux")
else() else()
set(dependencies lwip console esp_netif) set(dependencies lwip console esp_netif)
set(private_dependencies esp_timer esp_wifi) set(private_dependencies esp_timer esp_wifi)
set(srcs "mdns.c" ${MDNS_NETWORKING} "mdns_console.c") set(srcs "mdns.c" ${MDNS_NETWORKING} ${MDNS_CONSOLE})
endif() endif()
idf_component_register( idf_component_register(

View File

@ -100,6 +100,12 @@ menu "mDNS"
help help
Enable for the library to log received and sent mDNS packets to stdout. Enable for the library to log received and sent mDNS packets to stdout.
config MDNS_ENABLE_CONSOLE_CLI
bool "Enable Command Line Interface on device console"
default y
help
Enable for the console cli to be available on the device.
config MDNS_RESPOND_REVERSE_QUERIES config MDNS_RESPOND_REVERSE_QUERIES
bool "Enable responding to IPv4 reverse queries" bool "Enable responding to IPv4 reverse queries"
default n default n