# Resolve locally: IDF expands component dependencies in a separate CMake scope.
get_filename_component(portal_root "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
get_filename_component(portal_component "${portal_root}" NAME)
idf_component_register(SRCS "main.cpp" REQUIRES "${portal_component}" arduino-esp32)
option(ARDPORTAL_SDK_DIAGNOSTICS "Forward SDK diagnostics to portal Messages (testing only)" OFF)
option(ARDPORTAL_MATTER_CONTROL_VALIDATION "Build the full hardware control validation fixture" OFF)
if(ARDPORTAL_MATTER_CONTROL_VALIDATION)
    if(ARDPORTAL_SDK_DIAGNOSTICS)
        message(FATAL_ERROR "Control validation and SDK diagnostic fixtures are separate")
    endif()
    target_compile_definitions(${COMPONENT_LIB} PRIVATE ARDPORTAL_MATTER_CONTROL_VALIDATION=1)
endif()
if(ARDPORTAL_SDK_DIAGNOSTICS)
    target_compile_definitions(${COMPONENT_LIB} PRIVATE ARDPORTAL_SDK_DIAGNOSTICS=1)
    target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=ip6_route")
endif()
