-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathdpctl-config.cmake
More file actions
66 lines (59 loc) · 1.89 KB
/
dpctl-config.cmake
File metadata and controls
66 lines (59 loc) · 1.89 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
#.rst:
#
# Find the include directory for ``dpctl_capi.h``, ``dpctl4pybind11.hpp``.
#
# This module sets the following variables:
#
# ``Dpctl_FOUND``
# True if DPCTL was found.
# ``Dpctl_INCLUDE_DIR``
# The include directory needed to use dpctl.
# ``Dpctl_TENSOR_INCLUDE_DIR``
# The include directory for tensor kernels implementation.
# ``Dpctl_VERSION``
# The version of dpctl found.
#
# The module will also explicitly define two cache variables:
#
# ``Dpctl_INCLUDE_DIR``
# ``Dpctl_TENSOR_INCLUDE_DIR``
#
if(NOT Dpctl_FOUND)
find_package(Python 3.10 REQUIRED
COMPONENTS Interpreter Development.Module)
if(Python_EXECUTABLE)
execute_process(COMMAND "${Python_EXECUTABLE}"
-m dpctl --include-dir
OUTPUT_VARIABLE _dpctl_include_dir
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(COMMAND "${Python_EXECUTABLE}"
-c "import dpctl; print(dpctl.__version__)"
OUTPUT_VARIABLE Dpctl_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()
endif()
find_path(Dpctl_INCLUDE_DIR
dpctl_capi.h dpctl4pybind11.hpp dpctl_sycl_interface.h
PATHS "${_dpctl_include_dir}" "${Python_INCLUDE_DIRS}"
PATH_SUFFIXES dpctl/include
)
get_filename_component(_dpctl_dir ${_dpctl_include_dir} DIRECTORY)
find_path(Dpctl_TENSOR_INCLUDE_DIR
kernels utils
PATHS "${_dpctl_dir}/tensor/libtensor/include"
)
set(Dpctl_INCLUDE_DIRS ${Dpctl_INCLUDE_DIR})
# handle the QUIETLY and REQUIRED arguments and set Dpctl_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Dpctl
REQUIRED_VARS
Dpctl_INCLUDE_DIR Dpctl_TENSOR_INCLUDE_DIR
VERSION_VAR Dpctl_VERSION
)
mark_as_advanced(Dpctl_INCLUDE_DIR)
mark_as_advanced(Dpctl_TENSOR_INCLUDE_DIR)