Skip to content

Commit

Permalink
Automatically look for CUDA targets when importing GraphBLAS
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuetzel committed Sep 13, 2023
1 parent 1bfde2c commit f4853ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions GraphBLAS/CUDA/Config/GraphBLAS_CUDAConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ set ( GRAPHBLAS_CUDA_VERSION_MINOR @GraphBLAS_VERSION_MINOR@ )
set ( GRAPHBLAS_CUDA_VERSION_PATCH @GraphBLAS_VERSION_SUB@ )
set ( GRAPHBLAS_CUDA_VERSION "@GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@" )

# Look for NVIDIA CUDA toolkit
find_package ( CUDAToolkit @CUDAToolkit_VERSION_MAJOR@ REQUIRED )

include ( ${CMAKE_CURRENT_LIST_DIR}/GraphBLAS_CUDATargets.cmake )

# The following is only for backward compatibility with FindGraphBLAS_CUDA.
Expand Down
16 changes: 16 additions & 0 deletions GraphBLAS/Config/GraphBLASConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ set ( GRAPHBLAS_VERSION_MINOR @GraphBLAS_VERSION_MINOR@ )
set ( GRAPHBLAS_VERSION_PATCH @GraphBLAS_VERSION_SUB@ )
set ( GRAPHBLAS_VERSION "@GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@" )

if ( @SUITESPARSE_CUDA@ )
# Look for imported targets of additional dependency if GraphBLAS was built with CUDA

if ( @SUITESPARSE_IN_BUILD_TREE@ )
# First check in a common build tree
find_package ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@
PATHS ${CMAKE_SOURCE_DIR}/../GraphBLAS/build/CUDA NO_DEFAULT_PATH )
# Then, check in the currently active CMAKE_MODULE_PATH
if ( NOT TARGET SuiteSparse::GraphBLAS_CUDA )
find_package ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@ REQUIRED )
endif ( )
else ( )
find_package ( GraphBLAS_CUDA @GraphBLAS_VERSION_MAJOR@.@GraphBLAS_VERSION_MINOR@.@GraphBLAS_VERSION_SUB@ REQUIRED )
endif ( )
endif ( )

include ( ${CMAKE_CURRENT_LIST_DIR}/GraphBLASTargets.cmake )

# The following is only for backward compatibility with FindGraphBLAS.
Expand Down

0 comments on commit f4853ac

Please sign in to comment.