# Prepare the same complete component layout that worked locally, inside build. # Run before project() so ESP-IDF can discover the generated component normally. if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../components/lwip/CMakeLists.txt") message(FATAL_ERROR "Remove components/lwip: it would override the generated build component.") endif() if(NOT PYTHON) find_package(Python3 REQUIRED COMPONENTS Interpreter) set(PYTHON "${Python3_EXECUTABLE}") endif() set(monitoring_lwip_generator "${CMAKE_CURRENT_LIST_DIR}/../patches/lwip/prepare.py") set(monitoring_arp_source "${CMAKE_CURRENT_LIST_DIR}/../patches/lwip/etharp.c") set(monitoring_lwip_dir "${CMAKE_BINARY_DIR}/monitoring_components/lwip") execute_process( COMMAND "${PYTHON}" "${monitoring_lwip_generator}" "${IDF_PATH}/components/lwip" "${monitoring_lwip_dir}" "${monitoring_arp_source}" RESULT_VARIABLE monitoring_lwip_result OUTPUT_VARIABLE monitoring_lwip_output ERROR_VARIABLE monitoring_lwip_error ) if(NOT monitoring_lwip_result EQUAL 0) message(FATAL_ERROR "lwIP preparation failed: ${monitoring_lwip_error}") endif() set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${monitoring_lwip_generator}" "${IDF_PATH}/components/lwip/CMakeLists.txt" "${IDF_PATH}/components/lwip/lwip/src/include/lwip/sockets.h" "${IDF_PATH}/components/lwip/port/linux/include/sys/fcntl.h") list(APPEND EXTRA_COMPONENT_DIRS "${monitoring_lwip_dir}") message(STATUS "lwIP: prepared in ${monitoring_lwip_dir}; ARP source is patches/lwip/etharp.c")