-
Notifications
You must be signed in to change notification settings - Fork 550
Expand file tree
/
Copy pathArrayFireConfig.cmake.in
More file actions
150 lines (140 loc) · 5.22 KB
/
ArrayFireConfig.cmake.in
File metadata and controls
150 lines (140 loc) · 5.22 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Copyright (c) 2017, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
# ArrayFire
# ---------
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This is the configuration file for the ArrayFire Library. It provides the
# following :prop_tgt:`IMPORTED` targets:
#
# ``ArrayFire::af``
# Target for the ArrayFire Unified backend.
# ``ArrayFire::afcpu``
# Target for the ArrayFire CPU backend.
# ``ArrayFire::afcuda``
# Target for the ArrayFire CUDA backend.
# ``ArrayFire::afoneapi``
# Target for the ArrayFire oneAPI backend.
# ``ArrayFire::afopencl``
# Target for the ArrayFire OpenCL backend.
#
# These targets can be used to link with your application using the
# ``target_link_library`` command. Here is an example of how to use these
# targets in your application:
#
# add_executable(mybinary source.cpp)
# target_link_library(mybinary PRIVATE ArrayFire::afopencl)
#
# This example creates a mybinary executable from the source.cpp file and links
# against the OpenCL backend of ArrayFire library. Note you do *not* need to set
# the include directories as they are automatically included with the target.
#
# This is the recommended way of linking against ArrayFire
#
# Legacy Variables
# ^^^^^^^^^^^^^^^^
#
# Additionally, this config file creates the following variables for backward
# compatibility with legacy cmake files:
#
# ``ArrayFire_INCLUDE_DIRS``
# Path to ArrayFire's include directory.
# ``ArrayFire_LIBRARIES``
# ArrayFire's libraries. This will default to a GPU backend if one
# is found.
# ``ArrayFire_FOUND``
# True if ArrayFire has been located
#
# ``ArrayFire_CPU_FOUND``
# True of the ArrayFire CPU library has been found.
# ``ArrayFire_CPU_LIBRARIES``
# Location of ArrayFire's CPU library, if found
#
# ``ArrayFire_CUDA_FOUND``
# True of the ArrayFire CUDA library has been found.
# ``ArrayFire_CUDA_LIBRARIES``
# Location of ArrayFire's CUDA library, if found
#
# ``ArrayFire_oneAPI_FOUND``
# True of the ArrayFire oneAPI library has been found.
# ``ArrayFire_oneAPI_LIBRARIES``
# Location of ArrayFire's oneAPI library, if found
#
# ``ArrayFire_OpenCL_FOUND``
# True of the ArrayFire OpenCL library has been found.
# ``ArrayFire_OpenCL_LIBRARIES``
# Location of ArrayFire's OpenCL library, if found
#
# ``ArrayFire_Unified_FOUND``
# True of the ArrayFire Unified library has been found.
# ``ArrayFire_Unified_LIBRARIES``
# Location of ArrayFire's Unified library, if found
#
# It is recommended you use imported targets instead of these variables.
#
# You may provide a hint to where ArrayFire's root directory may be located
# by setting ArrayFire_DIR. You should not need to set this if you installed
# ArrayFire using the official installers or the package manager(please submit
# a bug report). If CMake is unable to locate ArrayFire then set the
# ArrayFire_DIR to the directory of this file.
#
# If you are trying to link against a source build then this should be set to
# the build directory.
@PACKAGE_INIT@
set_and_check(ArrayFire_INCLUDE_DIRS @PACKAGE_INCLUDE_DIRS@)
foreach(backend Unified CPU oneAPI OpenCL CUDA)
if(backend STREQUAL "Unified")
set(lowerbackend "")
else()
string(TOLOWER "${backend}" lowerbackend)
endif()
string(TOUPPER "${backend}" upperbackend)
if(NOT TARGET ArrayFire::af${lowerbackend} AND NOT TARGET af${lowerbackend})
# Either we are not in the ArrayFire project or the target was not built
if(EXISTS @PACKAGE_CMAKE_DIR@/ArrayFire${backend}Targets.cmake)
include(@PACKAGE_CMAKE_DIR@/ArrayFire${backend}Targets.cmake)
endif()
endif()
if(TARGET ArrayFire::af${lowerbackend})
get_property(all_config TARGET ArrayFire::af${lowerbackend} PROPERTY IMPORTED_CONFIGURATIONS)
foreach(config IN LISTS all_config)
if(NOT all_config)
set(all_config "NOCONFIG")
endif()
get_property(loc TARGET ArrayFire::af${lowerbackend} PROPERTY IMPORTED_LOCATION_${config})
# break if any of the imported configurations exist. All configs write to the same
# location so they are not working as CMake intended. Its fine for single config
# installers like ours.
if(EXISTS ${loc})
set(ArrayFire_${backend}_BINARY_EXISTS TRUE)
break()
endif()
endforeach()
endif()
if((TARGET ArrayFire::af${lowerbackend} AND ArrayFire_${backend}_BINARY_EXISTS) OR TARGET af${lowerbackend})
set(ArrayFire_${backend}_FOUND ON)
set(ArrayFire_${backend}_LIBRARIES ArrayFire::af${lowerbackend})
set(ArrayFire_LIBRARIES ArrayFire::af${lowerbackend})
else()
set(ArrayFire_${backend}_FOUND OFF)
endif()
# If this project is built as part of the ArrayFire project, make sure the
# backends are only enabled if the backend is selected to be built even if
# the Binary exists.
if(DEFINED AF_BUILD_${upperbackend} AND NOT AF_BUILD_${upperbackend})
set(ArrayFire_${backend}_FOUND OFF)
endif()
endforeach()
foreach(_comp ${ArrayFire_FIND_COMPONENTS})
if (NOT ArrayFire_${_comp}_FOUND)
set(ArrayFire_FOUND False)
set(ArrayFire_NOT_FOUND_MESSAGE "Required ArrayFire component ${_comp} not found")
endif()
endforeach()
check_required_components(CPU oneAPI OpenCL CUDA Unified)