forked from wdmapp/gtensor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtensor-config.cmake.in
50 lines (42 loc) · 1.94 KB
/
gtensor-config.cmake.in
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
# See https://github.com/pabloariasal/modern-cmake-sample
get_filename_component(GTENSOR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(CMakeFindDependencyMacro)
list(APPEND CMAKE_MODULE_PATH ${GTENSOR_CMAKE_DIR})
list(REMOVE_AT CMAKE_MODULE_PATH -1)
set(GTENSOR_BUILD_DEVICES "@GTENSOR_BUILD_DEVICES@")
if (NOT TARGET gtensor::gtensor_@GTENSOR_DEVICE@)
message(STATUS "include targets ${GTENSOR_BUILD_DEVICES}")
include("${GTENSOR_CMAKE_DIR}/gtensor-targets.cmake")
# Promote all targets to global so we can alias them below. See also
# https://cmake.org/cmake/help/v3.13/command/add_library.html#alias-libraries
foreach(DEVICE IN LISTS GTENSOR_BUILD_DEVICES)
set_target_properties(gtensor::gtensor_${DEVICE}
PROPERTIES IMPORTED_GLOBAL TRUE)
endforeach()
endif()
# Create alias gtensor::gtensor for the requested device, or the default
# if none was specified before calling find_package(gtensor)
if (GTENSOR_DEVICE)
if (NOT ${GTENSOR_DEVICE} IN_LIST GTENSOR_BUILD_DEVICES)
message(FATAL_ERROR
"gtensor: support for '${GTENSOR_DEVICE}' is not installed")
endif()
add_library(gtensor::gtensor ALIAS gtensor::gtensor_${GTENSOR_DEVICE})
else()
set(GTENSOR_DEVICE @GTENSOR_DEVICE@)
add_library(gtensor::gtensor ALIAS gtensor::gtensor_@GTENSOR_DEVICE@)
endif()
if ("cuda" IN_LIST GTENSOR_BUILD_DEVICES)
enable_language(CUDA)
endif()
if ("hip" IN_LIST GTENSOR_BUILD_DEVICES)
find_dependency(HIP CONFIG PATHS "/opt/rocm/hip")
find_dependency(rocprim CONFIG PATHS "/opt/rocm/rocprim")
find_dependency(rocthrust CONFIG PATHS "/opt/rocm/rocthrust")
endif()
# function to enable configure source properties based on the
# gtensor device backend. In particular, enable CUDA language
# for CUDA backend, even if the file doesn't have a .cu extension.
include("${GTENSOR_CMAKE_DIR}/target-gtensor-sources-macro.cmake")
set(GTENSOR_LIBRARIES @GTENSOR_TARGETS@)
list(TRANSFORM GTENSOR_LIBRARIES PREPEND "gtensor::")