Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions llvm/cmake/modules/CheckEnabledLLVMRuntime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# is_llvm_runtime_enabled(runtime result) sets 'result' to TRUE if 'runtime'
# (e.g. libclc) is enabled for any configured runtime target, FALSE otherwise.
#
# Use this instead of if(TARGET <runtime>) because this runs before
# runtimes/CMakeLists.txt creates runtime targets, so a TARGET check would
# always be false. The enabled-runtimes lists aren't affected by that
# ordering.
function(is_llvm_runtime_enabled runtime result)
set(enabled FALSE)
foreach(runtime_target IN LISTS LLVM_RUNTIME_TARGETS)
if("${runtime}" IN_LIST RUNTIMES_${runtime_target}_LLVM_ENABLE_RUNTIMES)
set(enabled TRUE)
break()
endif()
endforeach()
set(${result} ${enabled} PARENT_SCOPE)
endfunction()
9 changes: 2 additions & 7 deletions sycl-jit/jit-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@ set(SYCL_JIT_RESOURCE_INSTALL_COMPONENTS
clang-resource-headers
libsycldevice)

set(libclc_enabled FALSE)
foreach(target IN LISTS LLVM_RUNTIME_TARGETS)
if("libclc" IN_LIST RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES)
set(libclc_enabled TRUE)
break()
endif()
endforeach()
include(CheckEnabledLLVMRuntime)
is_llvm_runtime_enabled(libclc libclc_enabled)

if (libclc_enabled)
# If some targets required `libclc` then we should embed it for the
Expand Down
9 changes: 2 additions & 7 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,8 @@ if("lld" IN_LIST LLVM_ENABLE_PROJECTS)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS lld)
endif()

set(libclc_enabled FALSE)
foreach(target IN LISTS LLVM_RUNTIME_TARGETS)
if("libclc" IN_LIST RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES)
set(libclc_enabled TRUE)
break()
endif()
endforeach()
include(CheckEnabledLLVMRuntime)
is_llvm_runtime_enabled(libclc libclc_enabled)

if(libclc_enabled)
add_dependencies(sycl-toolchain libclc)
Expand Down
Loading