Skip to content

Commit ae09897

Browse files
authored
[UR] Use relative xpti/xptifw source when available (#17099)
In standalone UR builds, when the relative xpti/xptifw directories exist, use those instead of using `FetchContentSparse_Declare` helper.
1 parent 5250c0e commit ae09897

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

unified-runtime/CMakeLists.txt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,16 @@ if(UR_ENABLE_TRACING)
137137
add_compile_definitions(UR_ENABLE_TRACING)
138138

139139
if (UR_BUILD_XPTI_LIBS)
140-
# fetch xpti proxy library for the tracing layer
141-
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "nightly-2024-10-22" "xpti")
140+
set(UR_XPTI_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../xpti")
141+
cmake_path(NORMAL_PATH UR_XPTI_SOURCE_DIR
142+
OUTPUT_VARIABLE UR_XPTI_SOURCE_DIR)
143+
if(IS_DIRECTORY "${UR_XPTI_SOURCE_DIR}")
144+
FetchContent_Declare(xpti SOURCE_DIR "${UR_XPTI_SOURCE_DIR}")
145+
else()
146+
# fetch xpti proxy library for the tracing layer
147+
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "nightly-2024-10-22" "xpti")
148+
endif()
149+
142150
FetchContent_MakeAvailable(xpti)
143151

144152
# set -fPIC for xpti since we are linking it with a shared library
@@ -150,7 +158,14 @@ if(UR_ENABLE_TRACING)
150158
set(XPTI_DIR ${xpti_SOURCE_DIR})
151159
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")
152160

153-
FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "nightly-2024-10-22" "xptifw")
161+
set(UR_XPTIFW_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../xptifw")
162+
cmake_path(NORMAL_PATH UR_XPTIFW_SOURCE_DIR
163+
OUTPUT_VARIABLE UR_XPTIFW_SOURCE_DIR)
164+
if(IS_DIRECTORY "${UR_XPTI_SOURCE_DIR}")
165+
FetchContent_Declare(xptifw SOURCE_DIR "${UR_XPTIFW_SOURCE_DIR}")
166+
else()
167+
FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "nightly-2024-10-22" "xptifw")
168+
endif()
154169

155170
FetchContent_MakeAvailable(xptifw)
156171

0 commit comments

Comments
 (0)