Skip to content

Commit a88268c

Browse files
committed
Fix fetching L0 and CUDA headers and add UMF_CUDA_INCLUDE_DIR
Fetch L0 loader only if needed i.e.: if building L0 provider is ON and L0 headers are not provided by the user (via setting UMF_LEVEL_ZERO_INCLUDE_DIR). Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA headers are not provided by the user (via setting UMF_CUDA_INCLUDE_DIR). Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 9e70ea0 commit a88268c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ set(UMF_LEVEL_ZERO_INCLUDE_DIR
1313
# TODO: Cleanup the compile definitions across all the CMake files
1414
set(UMF_COMMON_COMPILE_DEFINITIONS UMF_VERSION=${UMF_VERSION})
1515

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)))
16+
# Fetch L0 loader only if needed i.e.: if building L0 provider is ON and L0
17+
# headers are not provided by the user (via setting UMF_LEVEL_ZERO_INCLUDE_DIR).
18+
if(UMF_BUILD_LEVEL_ZERO_PROVIDER AND (NOT UMF_LEVEL_ZERO_INCLUDE_DIR))
2019
include(FetchContent)
2120

2221
set(LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git")
@@ -44,7 +43,9 @@ elseif(UMF_BUILD_LEVEL_ZERO_PROVIDER)
4443
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
4544
endif()
4645

47-
if(UMF_BUILD_CUDA_PROVIDER)
46+
# Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA
47+
# headers are not provided by the user (via setting UMF_CUDA_INCLUDE_DIR).
48+
if(UMF_BUILD_CUDA_PROVIDER AND (NOT UMF_CUDA_INCLUDE_DIR))
4849
include(FetchContent)
4950

5051
set(CUDA_REPO
@@ -64,6 +65,10 @@ if(UMF_BUILD_CUDA_PROVIDER)
6465
${cuda-headers_SOURCE_DIR}
6566
CACHE PATH "Path to CUDA headers")
6667
message(STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS}")
68+
elseif(UMF_BUILD_CUDA_PROVIDER)
69+
# Only header is needed to build UMF
70+
set(CUDA_INCLUDE_DIRS ${UMF_CUDA_INCLUDE_DIR})
71+
message(STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS}")
6772
endif()
6873

6974
add_subdirectory(utils)

0 commit comments

Comments
 (0)