From 0ae24ba978674d3b84ea1d39e36cb9010528e4f8 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 29 Jan 2025 16:21:34 +0000 Subject: [PATCH] [UR] Choose in-tree unified-runtime directory if present Update the CMake build system to use the `/unified-runtime` directory if it exists. Fallback to using `FetchContent` when it does not exist. This is in preparation for moving UR development into the intel/llvm repo. --- sycl/cmake/modules/FetchUnifiedRuntime.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index 72841724fa01d..b782b017191ed 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -70,7 +70,13 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error") endif() -if(SYCL_UR_USE_FETCH_CONTENT) +set(UR_INTREE_SOURCE_DIR "${LLVM_SOURCE_DIR}/../unified-runtime") +cmake_path(NORMAL_PATH UR_INTREE_SOURCE_DIR OUTPUT_VARIABLE UR_INTREE_SOURCE_DIR) + +if(IS_DIRECTORY "${UR_INTREE_SOURCE_DIR}") + set(UR_INTREE_BINARY_DIR ${LLVM_BINARY_DIR}/unified-runtime) + add_subdirectory(${UR_INTREE_SOURCE_DIR} ${UR_INTREE_BINARY_DIR}) +elseif(SYCL_UR_USE_FETCH_CONTENT) include(FetchContent) # The fetch_adapter_source function can be used to perform a separate content