forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFindGloo.cmake
49 lines (42 loc) · 1.35 KB
/
FindGloo.cmake
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
# Try to find the Gloo library and headers.
# Gloo_FOUND - system has Gloo lib
# Gloo_INCLUDE_DIRS - the Gloo include directory
# Gloo_LIBRARY/Gloo_NATIVE_LIBRARY - libraries needed to use Gloo
find_path(Gloo_INCLUDE_DIR
NAMES gloo/common/common.h
DOC "The directory where Gloo includes reside"
)
find_library(Gloo_NATIVE_LIBRARY
NAMES gloo
DOC "The Gloo library (without CUDA)"
)
find_library(Gloo_CUDA_LIBRARY
NAMES gloo_cuda
DOC "The Gloo library (with CUDA)"
)
set(Gloo_INCLUDE_DIRS ${Gloo_INCLUDE_DIR})
# use the CUDA library depending on the Gloo_USE_CUDA variable
if (DEFINED Gloo_USE_CUDA)
if (${Gloo_USE_CUDA})
set(Gloo_LIBRARY ${Gloo_CUDA_LIBRARY})
set(Gloo_NATIVE_LIBRARY ${Gloo_NATIVE_LIBRARY})
else()
set(Gloo_LIBRARY ${Gloo_NATIVE_LIBRARY})
set(Gloo_NATIVE_LIBRARY ${Gloo_NATIVE_LIBRARY})
endif()
else()
# else try to use the CUDA library if found
if (${Gloo_CUDA_LIBRARY} STREQUAL "Gloo_CUDA_LIBRARY-NOTFOUND")
set(Gloo_LIBRARY ${Gloo_NATIVE_LIBRARY})
set(Gloo_NATIVE_LIBRARY ${Gloo_NATIVE_LIBRARY})
else()
set(Gloo_LIBRARY ${Gloo_CUDA_LIBRARY})
set(Gloo_NATIVE_LIBRARY ${Gloo_NATIVE_LIBRARY})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gloo
FOUND_VAR Gloo_FOUND
REQUIRED_VARS Gloo_INCLUDE_DIR Gloo_LIBRARY
)
mark_as_advanced(Gloo_FOUND)