aboutsummaryrefslogtreecommitdiff
path: root/ports/tensorflow-cc/tensorflow-cc-config-shared.cmake.in
blob: 98149e0004805ffa6c698a18453e5be592106551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
if(TARGET tensorflow_cc::tensorflow_cc OR TARGET tensorflow_cc::tensorflow_framework)
	if(NOT (TARGET tensorflow_cc::tensorflow_cc AND TARGET tensorflow_cc::tensorflow_framework))
		message(FATAL_ERROR "Some (but not all) targets in this config.cmake were already defined.")
	endif()

	return()
endif()

add_library(tensorflow_cc::tensorflow_cc SHARED IMPORTED GLOBAL)
add_library(tensorflow_cc::tensorflow_framework SHARED IMPORTED GLOBAL)

# Compute the installation prefix from this tensorflow-cc-config.cmake file location.
# CMAKE_CURRENT_LIST_DIR = [vcpkg_installed_dir]/[target_triplet]/share/tensorflow-cc
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]/share
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${TENSORFLOW_INSTALL_PREFIX}" DIRECTORY)
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]

target_include_directories(tensorflow_cc::tensorflow_cc
	INTERFACE
		"${TENSORFLOW_INSTALL_PREFIX}/include"
		"${TENSORFLOW_INSTALL_PREFIX}/include/tensorflow-external"
		"${TENSORFLOW_INSTALL_PREFIX}/include/tensorflow-external/src"
)
target_include_directories(tensorflow_cc::tensorflow_framework
	INTERFACE
		"${TENSORFLOW_INSTALL_PREFIX}/include/tensorflow-external"
		"${TENSORFLOW_INSTALL_PREFIX}/include/tensorflow-external/src"
)

if(@TENSORFLOW_HAS_RELEASE@)
	set_property(TARGET tensorflow_cc::tensorflow_cc
		PROPERTY IMPORTED_LOCATION
			"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
	)
	set_property(TARGET tensorflow_cc::tensorflow_framework
		PROPERTY IMPORTED_LOCATION
			"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_FRAMEWORK_NAME@"
	)

	set_property(TARGET tensorflow_cc::tensorflow_cc
		APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
	)
	set_property(TARGET tensorflow_cc::tensorflow_framework
		APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
	)

	set_property(TARGET tensorflow_cc::tensorflow_cc
		PROPERTY IMPORTED_LOCATION_RELEASE
			"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
	)
	set_property(TARGET tensorflow_cc::tensorflow_framework
		PROPERTY IMPORTED_LOCATION_RELEASE
			"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_FRAMEWORK_NAME@"
	)
endif()

if(@TENSORFLOW_HAS_DEBUG)
	if(NOT @TENSORFLOW_HAS_RELEASE)
		set_property(TARGET tensorflow_cc::tensorflow_cc
			PROPERTY IMPORTED_LOCATION
				"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
		)
		set_property(TARGET tensorflow_cc::tensorflow_framework
			PROPERTY IMPORTED_LOCATION
				"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_FRAMEWORK_NAME@"
		)
	endif()

	set_property(TARGET tensorflow_cc::tensorflow_cc
		APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
	)
	set_property(TARGET tensorflow_cc::tensorflow_framework
		APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
	)

	set_property(TARGET tensorflow_cc::tensorflow_cc
		PROPERTY IMPORTED_LOCATION_DEBUG
			"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
	)
	set_property(TARGET tensorflow_cc::tensorflow_framework
		PROPERTY IMPORTED_LOCATION_DEBUG
			"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_FRAMEWORK_NAME@"
	)
endif()

set(tensorflow_cc_FOUND TRUE)
set(tensorflow_framework_FOUND TRUE)