1
+ #=============================================================================
2
+ # Copyright (c) 2025, NVIDIA CORPORATION.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #=============================================================================
16
+
17
+ set (CUGRAPH_MIN_VERSION_cuvs "${CUGRAPH_VERSION_MAJOR} .${CUGRAPH_VERSION_MINOR} .00" )
18
+ set (CUGRAPH_BRANCH_VERSION_cuvs "${CUGRAPH_VERSION_MAJOR} .${CUGRAPH_VERSION_MINOR} " )
19
+
20
+ function (find_and_configure_cuvs )
21
+ set (oneValueArgs VERSION FORK PINNED_TAG EXCLUDE_FROM_ALL USE_CUVS_STATIC COMPILE_LIBRARY CLONE_ON_PIN )
22
+ cmake_parse_arguments (PKG "${options} " "${oneValueArgs} "
23
+ "${multiValueArgs} " ${ARGN} )
24
+
25
+ if (PKG_CLONE_ON_PIN AND NOT PKG_PINNED_TAG STREQUAL "branch-${CUGRAPH_BRANCH_VERSION_cuvs} " )
26
+ message (STATUS "CUGRAPH: CUVS pinned tag found: ${PKG_PINNED_TAG} . Cloning cuvs locally." )
27
+ set (CPM_DOWNLOAD_cuvs ON )
28
+ elseif (PKG_USE_CUVS_STATIC AND (NOT CPM_cuvs_SOURCE ))
29
+ message (STATUS "CUGRAPH: Cloning cuvs locally to build static libraries." )
30
+ set (CPM_DOWNLOAD_cuvs ON )
31
+ else ()
32
+ message (STATUS "Not cloning cuvs locally" )
33
+ endif ()
34
+
35
+ if (PKG_USE_CUVS_STATIC )
36
+ set (CUVS_LIB cuvs::cuvs_static PARENT_SCOPE )
37
+ else ()
38
+ set (CUVS_LIB cuvs::cuvs PARENT_SCOPE )
39
+ endif ()
40
+
41
+ set (CUVS_BUILD_MG_ALGOS ON )
42
+ if (SINGLEGPU )
43
+ set (CUVS_BUILD_MG_ALGOS OFF )
44
+ endif ()
45
+
46
+ rapids_cpm_find (cuvs ${PKG_VERSION}
47
+ GLOBAL_TARGETS cuvs::cuvs
48
+ BUILD_EXPORT_SET CUGRAPH-exports
49
+ INSTALL_EXPORT_SET CUGRAPH-exports
50
+ CPM_ARGS
51
+ GIT_REPOSITORY https://github.com/${PKG_FORK}/cuvs.git
52
+ GIT_TAG ${PKG_PINNED_TAG}
53
+ SOURCE_SUBDIR cpp
54
+ EXCLUDE_FROM_ALL ${PKG_EXCLUDE_FROM_ALL}
55
+ OPTIONS
56
+ "BUILD_TESTS OFF"
57
+ "BUILD_CAGRA_HNSWLIB OFF"
58
+ "BUILD_CUVS_BENCH OFF"
59
+ "BUILD_MG_ALGOS ${CUVS_BUILD_MG_ALGOS} "
60
+
61
+ )
62
+
63
+ if (cuvs_ADDED )
64
+ message (VERBOSE "CUGRAPH: Using CUVS located in ${cuvs_SOURCE_DIR} " )
65
+ else ()
66
+ message (VERBOSE "CUGRAPH: Using CUVS located in ${cuvs_DIR} " )
67
+ endif ()
68
+
69
+
70
+ endfunction ()
71
+
72
+ # Change pinned tag here to test a commit in CI
73
+ # To use a different CUVS locally, set the CMake variable
74
+ # CPM_cuvs_SOURCE=/path/to/local/cuvs
75
+ find_and_configure_cuvs (VERSION ${CUGRAPH_MIN_VERSION_cuvs}
76
+ FORK rapidsai
77
+ PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_cuvs}
78
+ EXCLUDE_FROM_ALL ${CUGRAPH_EXCLUDE_CUVS_FROM_ALL}
79
+ # When PINNED_TAG above doesn't match CUGRAPH,
80
+ # force local cuvs clone in build directory
81
+ # even if it's already installed.
82
+ CLONE_ON_PIN ${CUGRAPH_CUVS_CLONE_ON_PIN}
83
+ COMPILE_LIBRARY ${CUGRAPH_CUVS_COMPILED}
84
+ USE_CUVS_STATIC ${CUGRAPH_USE_CUVS_STATIC}
85
+ )
0 commit comments