# TorchVisionConfig.cmake
# --------------------
#
# Exported targets:: Vision
#

@PACKAGE_INIT@

set(PN TorchVision)

# location of include/torchvision
set(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")

set(${PN}_LIBRARY "")
set(${PN}_DEFINITIONS USING_${PN})

check_required_components(${PN})


if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
#-----------------------------------------------------------------------------
# Don't include targets if this file is being picked up by another
# project which has already built this as a subproject
#-----------------------------------------------------------------------------
if(NOT TARGET ${PN}::${PN})
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")

target_include_directories(${PN}::${PN} INTERFACE "${${PN}_INCLUDE_DIR}")

if(@WITH_CUDA@)
  target_compile_definitions(${PN}::${PN} INTERFACE WITH_CUDA)
endif()

find_package(Torch REQUIRED)
target_link_libraries(${PN}::${PN} INTERFACE torch)

if(@WITH_PNG@)
  find_package(PNG REQUIRED)
  target_link_libraries(${PN}::${PN} INTERFACE ${PNG_LIBRARY})
  target_compile_definitions(${PN}::${PN} INTERFACE PNG_FOUND)
endif()

if(@WITH_JPEG@)
  find_package(JPEG REQUIRED)
  target_link_libraries(${PN}::${PN} INTERFACE ${JPEG_LIBRARIES})
  target_compile_definitions(${PN}::${PN} INTERFACE JPEG_FOUND)
endif()

if (@USE_PYTHON@)
  if(NOT TARGET Python3::Python)
    find_package(Python3 COMPONENTS Development)
  endif()
  target_link_libraries(torch INTERFACE Python3::Python)
  target_compile_definitions(${PN}::${PN} INTERFACE USE_PYTHON)
endif()

endif()
endif()
