From b1f1ea7859bf57aa2c81782c41dbe5866f5598f5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 4 Jan 2024 08:46:59 +1100 Subject: [PATCH] AP_Networking: don't build lwip code if not needed this saves a bit of compile time, but also means devs not doing networking don't need to update the submodules --- libraries/AP_Networking/AP_Networking_Config.h | 2 ++ libraries/AP_Networking/lwip_hal/arch/sys_arch.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/libraries/AP_Networking/AP_Networking_Config.h b/libraries/AP_Networking/AP_Networking_Config.h index ea77791a2b..b9fdbd6fd3 100644 --- a/libraries/AP_Networking/AP_Networking_Config.h +++ b/libraries/AP_Networking/AP_Networking_Config.h @@ -50,6 +50,8 @@ #define AP_NETWORKING_SOCKETS_ENABLED AP_NETWORKING_ENABLED #endif +#define AP_NETWORKING_NEED_LWIP (AP_NETWORKING_BACKEND_CHIBIOS || AP_NETWORKING_BACKEND_PPP) + // --------------------------- // IP Features // --------------------------- diff --git a/libraries/AP_Networking/lwip_hal/arch/sys_arch.cpp b/libraries/AP_Networking/lwip_hal/arch/sys_arch.cpp index d9b517b47f..83053a9ee2 100644 --- a/libraries/AP_Networking/lwip_hal/arch/sys_arch.cpp +++ b/libraries/AP_Networking/lwip_hal/arch/sys_arch.cpp @@ -4,6 +4,9 @@ */ #include +#include + +#if AP_NETWORKING_NEED_LWIP #include #include @@ -385,3 +388,5 @@ sys_arch_unprotect(sys_prot_t pval) } } +#endif // AP_NETWORKING_NEED_LWIP +