find_program(_nvidia_smi "nvidia-smi")
if (_nvidia_smi)
  find_package(CUDA QUIET REQUIRED)
  SET(CUDA_PROPAGATE_HOST_FLAGS ON)
  cuda_add_library(GetReceive SHARED GetReceive.cu GetReceive.cpp GetReceive.cc)
else()
  add_library(GetReceive SHARED GetReceive.cpp GetReceive.cc)
  add_definitions(-DNOGPU)
endif()

set_property(TARGET GetReceive PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(GetReceive ${TF_LIB_FILE} "${TORCH_LIBRARIES}")

file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)
set_target_properties(GetReceive PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)
