Подключены ESP32|Linux, обновлен интерфейс

This commit is contained in:
2026-09-11 20:53:38 +03:00
parent 9fce687690
commit e7a01aaeda
23 changed files with 477 additions and 647 deletions
+56
View File
@@ -0,0 +1,56 @@
# Applied after project(): component targets already exist at this point.
include_guard(GLOBAL)
function(monitoring_patch_tapif)
idf_build_get_property(tap_target IDF_TARGET)
if(NOT "${tap_target}" STREQUAL "linux")
return()
endif()
idf_component_get_property(tap_lib protocol_examples_tapif_io COMPONENT_LIB)
idf_component_get_property(tap_dir protocol_examples_tapif_io COMPONENT_DIR)
idf_build_get_property(tap_idf_path IDF_PATH)
get_filename_component(tap_dir "${tap_dir}" REALPATH)
get_filename_component(tap_sdk_dir
"${tap_idf_path}/examples/common_components/protocol_examples_tapif_io" REALPATH)
if(NOT "${tap_dir}" STREQUAL "${tap_sdk_dir}")
message(FATAL_ERROR
"TAP must come from ESP-IDF. Move components/protocol_examples_tapif_io outside the project, then reconfigure.")
endif()
set(tap_patch_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../patches/protocol_examples_tapif_io")
set(tap_generated_dir "${CMAKE_BINARY_DIR}/monitoring_tapif")
file(MAKE_DIRECTORY "${tap_generated_dir}/lwip")
# Quoted includes search the source's own directory before -I directories.
# Relocate this unmodified SDK source so it finds our matching declaration.
configure_file("${tap_dir}/linux_connect.c"
"${tap_generated_dir}/linux_connect.c" COPYONLY)
configure_file("${tap_patch_dir}/tapif.h"
"${tap_generated_dir}/lwip/tapif.h" COPYONLY)
get_target_property(tap_sources "${tap_lib}" SOURCES)
set(tap_new_sources "")
set(tap_input_found FALSE)
set(tap_connect_found FALSE)
foreach(tap_source IN LISTS tap_sources)
get_filename_component(tap_absolute "${tap_source}" ABSOLUTE BASE_DIR "${tap_dir}")
if("${tap_absolute}" STREQUAL "${tap_dir}/lwip/tapif.c")
list(APPEND tap_new_sources "${tap_patch_dir}/tapif.c")
set(tap_input_found TRUE)
elseif("${tap_absolute}" STREQUAL "${tap_dir}/linux_connect.c")
list(APPEND tap_new_sources "${tap_generated_dir}/linux_connect.c")
set(tap_connect_found TRUE)
else()
list(APPEND tap_new_sources "${tap_source}")
endif()
endforeach()
if(NOT tap_input_found OR NOT tap_connect_found)
message(FATAL_ERROR
"Unexpected TAP source list. This compatibility patch was prepared for ESP-IDF v6.0.2.")
endif()
set_property(TARGET "${tap_lib}" PROPERTY SOURCES "${tap_new_sources}")
message(STATUS "TAP: using ESP-IDF component with project-local tapif.c/tapif.h fix")
endfunction()
monitoring_patch_tapif()