Skip to content

Commit cb37939

Browse files
[SYCL RTC][CMake] libdevice isn't an optional dependency (#20599)
We link it in for all targets inside SYCL RTC implementation, so it is required to be enabled. On the other hand, `libclc` is only needed for CUDA/AMD targets, so we can build SYCL RTC without it if those targets aren't enabled for the whole project.
1 parent e9880ca commit cb37939

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

sycl-jit/jit-compiler/CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,21 @@ else()
99
set(SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT "/sycl-jit-toolchain/")
1010
endif()
1111

12-
set(SYCL_JIT_RESOURCE_INSTALL_COMPONENTS sycl-headers OpenCL-Headers clang-resource-headers)
1312

14-
if ("libclc" IN_LIST LLVM_ENABLE_PROJECTS)
15-
list(APPEND SYCL_JIT_RESOURCE_INSTALL_COMPONENTS libspirv-builtins)
13+
if (NOT "libdevice" IN_LIST LLVM_ENABLE_PROJECTS)
14+
message(FATAL_ERROR "libdevice is required for jit-compiler but not present in LLVM_ENABLE_PROJECTS")
1615
endif()
1716

18-
if ("libdevice" IN_LIST LLVM_ENABLE_PROJECTS)
19-
list(APPEND SYCL_JIT_RESOURCE_INSTALL_COMPONENTS libsycldevice)
17+
set(SYCL_JIT_RESOURCE_INSTALL_COMPONENTS
18+
sycl-headers
19+
OpenCL-Headers
20+
clang-resource-headers
21+
libsycldevice)
22+
23+
if ("libclc" IN_LIST LLVM_ENABLE_PROJECTS)
24+
# If some targets required `libclc` then we should embed it for the
25+
# `sycl-jit`.
26+
list(APPEND SYCL_JIT_RESOURCE_INSTALL_COMPONENTS libspirv-builtins)
2027
endif()
2128

2229
set(SYCL_JIT_RESOURCE_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/rtc-resources-install)

0 commit comments

Comments
 (0)