22# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
5+ message (STATUS "CMake version: ${CMAKE_VERSION} " )
56cmake_minimum_required (VERSION 3.14.0 FATAL_ERROR)
7+
68# needed when UMF is used as an external project
79set (UMF_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
810
@@ -404,16 +406,18 @@ if(UMF_BUILD_LEVEL_ZERO_PROVIDER AND (NOT UMF_LEVEL_ZERO_INCLUDE_DIR))
404406 GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
405407 GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
406408 EXCLUDE_FROM_ALL )
407- FetchContent_MakeAvailable(level-zero-loader)
409+ # Only populate the repo - we don't need to build it TODO EXCLUDE_FROM_ALL
410+ # ver 3.28
411+ FetchContent_Populate(level-zero-loader)
408412
409413 set (LEVEL_ZERO_INCLUDE_DIRS
410414 ${level-zero-loader_SOURCE_DIR}/include
411- CACHE PATH "Path to Level Zero Headers " )
412- message (STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS} " )
415+ CACHE PATH "Path to Level Zero headers " )
416+ message (STATUS "LEVEL_ZERO_INCLUDE_DIRS = ${LEVEL_ZERO_INCLUDE_DIRS} " )
413417elseif (UMF_BUILD_LEVEL_ZERO_PROVIDER)
414418 # Only header is needed to build UMF
415419 set (LEVEL_ZERO_INCLUDE_DIRS ${UMF_LEVEL_ZERO_INCLUDE_DIR} )
416- message (STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS} " )
420+ message (STATUS "LEVEL_ZERO_INCLUDE_DIRS = ${LEVEL_ZERO_INCLUDE_DIRS} " )
417421endif ()
418422
419423# Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA
@@ -423,14 +427,15 @@ if(UMF_BUILD_CUDA_PROVIDER AND (NOT UMF_CUDA_INCLUDE_DIR))
423427 "https://gitlab.com/nvidia/headers/cuda-individual/cudart.git" )
424428 set (CUDA_TAG cuda-12.5.1)
425429
426- message (STATUS "Fetching CUDA ${CUDA_TAG} from ${CUDA_REPO} ..." )
430+ message (STATUS "Fetching CUDA ( ${CUDA_TAG} ) from ${CUDA_REPO} ..." )
427431
428432 FetchContent_Declare(
429433 cuda-headers
430434 GIT_REPOSITORY ${CUDA_REPO}
431435 GIT_TAG ${CUDA_TAG}
432436 EXCLUDE_FROM_ALL )
433- FetchContent_MakeAvailable(cuda-headers)
437+ # Only populate the repo - we don't need to build it
438+ FetchContent_Populate(cuda-headers)
434439
435440 set (CUDA_INCLUDE_DIRS
436441 ${cuda-headers_SOURCE_DIR}
@@ -707,16 +712,31 @@ else()
707712 )
708713endif ()
709714
710- if ((UMF_BUILD_GPU_TESTS OR UMF_BUILD_GPU_EXAMPLES) AND UMF_BUILD_CUDA_PROVIDER)
711- find_package (CUDA REQUIRED cuda)
712- if (CUDA_LIBRARIES)
713- set (UMF_CUDA_ENABLED TRUE )
714- else ()
715- message (
716- STATUS "Disabling tests and examples that use the CUDA provider "
717- "because the CUDA libraries they require were not found." )
715+ if (UMF_BUILD_GPU_TESTS OR UMF_BUILD_GPU_EXAMPLES)
716+ if (UMF_BUILD_CUDA_PROVIDER)
717+ find_package (CUDA REQUIRED cuda)
718+ if (CUDA_LIBRARIES)
719+ set (UMF_CUDA_ENABLED TRUE )
720+ else ()
721+ message (
722+ STATUS
723+ "Disabling tests and examples that use the CUDA Provider "
724+ "because the CUDA libraries they require were not found." )
725+ endif ()
726+ endif ()
727+
728+ if (UMF_BUILD_LEVEL_ZERO_PROVIDER)
729+ find_package (ZE_LOADER REQUIRED ze_loader)
730+ if (ZE_LOADER_LIBRARIES)
731+ set (UMF_LEVEL_ZERO_ENABLED TRUE )
732+ else ()
733+ message (
734+ STATUS
735+ "Disabling tests and examples that use the Level Zero Provider "
736+ "because the Level Zero libraries they require were not found."
737+ )
738+ endif ()
718739 endif ()
719- # TODO do the same for ze_loader
720740endif ()
721741
722742add_subdirectory (src)
0 commit comments