Skip to content

Commit fad173c

Browse files
authored
[UR] Add UR_EXTERNAL_DEPENDENCIES CMake option (#17291)
The `UR_EXTERNAL_DEPENDENCIES` option can be used to specify a list of CMake targets that all libraries and executables in the UR build should depend on, e.g. the `sycl-headers` target. Following on from #17093
1 parent df8b76c commit fad173c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ set(UR_BUILD_XPTI_LIBS OFF)
3333
set(UR_ENABLE_SYMBOLIZER ON CACHE BOOL "Enable symbolizer for sanitizer layer.")
3434
set(UR_ENABLE_TRACING ON)
3535

36+
set(UR_EXTERNAL_DEPENDENCIES "sycl-headers" CACHE LIST
37+
"List of external CMake targets for executables/libraries to depend on" FORCE)
38+
3639
if("level_zero" IN_LIST SYCL_ENABLE_BACKENDS)
3740
set(UR_BUILD_ADAPTER_L0 ON)
3841
endif()

unified-runtime/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ option(UR_BUILD_XPTI_LIBS "Build the XPTI libraries when tracing is enabled" ON)
4848
option(UR_STATIC_LOADER "Build loader as a static library" OFF)
4949
option(UR_FORCE_LIBSTDCXX "Force use of libstdc++ in a build using libc++ on Linux" OFF)
5050
option(UR_ENABLE_LATENCY_HISTOGRAM "Enable latncy histogram" OFF)
51+
set(UR_EXTERNAL_DEPENDENCIES "" CACHE LIST
52+
"List of external CMake targets for executables/libraries to depend on")
5153
set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable")
5254
set(UR_DPCXX_BUILD_FLAGS "" CACHE STRING "Build flags to pass to DPC++ when compiling device programs")
5355
set(UR_SYCL_LIBRARY_DIR "" CACHE PATH

unified-runtime/cmake/helpers.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ function(add_ur_executable name)
191191
add_ur_target_compile_options(${name})
192192
add_ur_target_exec_options(${name})
193193
add_ur_target_link_options(${name})
194+
if(UR_EXTERNAL_DEPENDENCIES)
195+
add_dependencies(${name} ${UR_EXTERNAL_DEPENDENCIES})
196+
endif()
194197
endfunction()
195198

196199
function(add_ur_library name)
@@ -202,6 +205,9 @@ function(add_ur_library name)
202205
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:LINKER:/DEPENDENTLOADFLAG:0x2000>
203206
)
204207
endif()
208+
if(UR_EXTERNAL_DEPENDENCIES)
209+
add_dependencies(${name} ${UR_EXTERNAL_DEPENDENCIES})
210+
endif()
205211
endfunction()
206212

207213
function(install_ur_library name)

0 commit comments

Comments
 (0)