# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20)
project(subgraph_ping CXX)

# Finds the package holoscan
find_package(holoscan REQUIRED CONFIG
             PATHS "/opt/nvidia/holoscan" "/workspace/holoscan-sdk/install")

add_executable(subgraph_ping
  subgraph_ping.cpp
)

target_link_libraries(subgraph_ping
  PRIVATE
  holoscan::core
  holoscan::ops::ping_rx
  holoscan::ops::ping_tx
)

# Testing
if(BUILD_TESTING)
  add_test(NAME EXAMPLE_CPP_SUBGRAPH_PING_TEST
           COMMAND subgraph_ping
           WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
          )
  set_tests_properties(EXAMPLE_CPP_SUBGRAPH_PING_TEST PROPERTIES
                       PASS_REGULAR_EXPRESSION "Rx message received \\(count: 8, size: 4\\)"
                       FAIL_REGULAR_EXPRESSION "error"
                      )
endif()
