@@ -6,17 +6,19 @@ include(${UMF_CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
6
6
7
7
set (UMF_LEVEL_ZERO_INCLUDE_DIR
8
8
""
9
- CACHE PATH "Directory containing the Level Zero Headers" )
9
+ CACHE PATH "Directory containing the Level Zero headers" )
10
+ set (UMF_CUDA_INCLUDE_DIR
11
+ ""
12
+ CACHE PATH "Directory containing the CUDA headers" )
10
13
11
14
# Compile definitions for UMF library.
12
15
#
13
16
# TODO: Cleanup the compile definitions across all the CMake files
14
17
set (UMF_COMMON_COMPILE_DEFINITIONS UMF_VERSION=${UMF_VERSION} )
15
18
16
- # Only fetch L0 loader if needed (L0 provider and GPU tests are ON), and not
17
- # already provided by the user (via setting UMF_LEVEL_ZERO_INCLUDE_DIR).
18
- if (UMF_BUILD_LEVEL_ZERO_PROVIDER AND (UMF_BUILD_GPU_TESTS
19
- OR (NOT UMF_LEVEL_ZERO_INCLUDE_DIR )))
19
+ # Fetch L0 loader only if needed i.e.: if building L0 provider is ON and L0
20
+ # headers are not provided by the user (via setting UMF_LEVEL_ZERO_INCLUDE_DIR).
21
+ if (UMF_BUILD_LEVEL_ZERO_PROVIDER AND (NOT UMF_LEVEL_ZERO_INCLUDE_DIR ))
20
22
include (FetchContent )
21
23
22
24
set (LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git" )
@@ -44,7 +46,9 @@ elseif(UMF_BUILD_LEVEL_ZERO_PROVIDER)
44
46
message (STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS} " )
45
47
endif ()
46
48
47
- if (UMF_BUILD_CUDA_PROVIDER )
49
+ # Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA
50
+ # headers are not provided by the user (via setting UMF_CUDA_INCLUDE_DIR).
51
+ if (UMF_BUILD_CUDA_PROVIDER AND (NOT UMF_CUDA_INCLUDE_DIR ))
48
52
include (FetchContent )
49
53
50
54
set (CUDA_REPO
@@ -64,6 +68,10 @@ if(UMF_BUILD_CUDA_PROVIDER)
64
68
${cuda-headers_SOURCE_DIR}
65
69
CACHE PATH "Path to CUDA headers" )
66
70
message (STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS} " )
71
+ elseif (UMF_BUILD_CUDA_PROVIDER )
72
+ # Only header is needed to build UMF
73
+ set (CUDA_INCLUDE_DIRS ${UMF_CUDA_INCLUDE_DIR} )
74
+ message (STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS} " )
67
75
endif ()
68
76
69
77
add_subdirectory (utils )
0 commit comments