TorchVisionConfig.cmake.in 1.55 KB
Newer Older
bmanga's avatar
bmanga committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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
#-----------------------------------------------------------------------------
25
if(NOT TARGET ${PN}::${PN})
bmanga's avatar
bmanga committed
26
27
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")

28
29
30
31
32
33
target_include_directories(${PN}::${PN} INTERFACE "${${PN}_INCLUDE_DIR}")

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

bmanga's avatar
bmanga committed
34
find_package(Torch REQUIRED)
35
36
37
38
39
40
41
42
43
44
45
46
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)
bmanga's avatar
bmanga committed
47
endif()
48

49
50
51
52
if (@USE_PYTHON@)
  if(NOT TARGET Python3::Python)
    find_package(Python3 COMPONENTS Development)
  endif()
53
54
  target_link_libraries(torch INTERFACE Python3::Python)
  target_compile_definitions(${PN}::${PN} INTERFACE USE_PYTHON)
55
56
endif()

bmanga's avatar
bmanga committed
57
58
endif()
endif()