Skip to content

Commit

Permalink
build: link SYCL RT explicitly for oss compiler on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
densamoilov committed Oct 6, 2022
1 parent e3b1987 commit 9bc87e6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cmake/SYCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,31 @@ if(NOT DNNL_DPCPP_HOST_COMPILER STREQUAL "DEFAULT" AND DNNL_SYCL_HIP)
message(FATAL_ERROR "DNNL_DPCPP_HOST_COMPILER options is not supported for AMD.")
endif()

# Link SYCL library explicitly for open-source compiler on Windows.
# In other cases, the compiler is able to automatically link it.
if(WIN32 AND CMAKE_BASE_NAME STREQUAL "clang++")
# TODO: we can drop this workaround once an open-source release
# for Windows has a fix for the issue.
foreach(sycl_lib_version 6 "")
if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set(SYCL_LIBRARY_NAME "sycl${sycl_lib_version}d")
else()
set(SYCL_LIBRARY_NAME "sycl${sycl_lib_version}")
endif()

find_library(SYCL_LIBRARY ${SYCL_LIBRARY_NAME})

if(EXISTS "${SYCL_LIBRARY}")
list(APPEND EXTRA_SHARED_LIBS ${SYCL_LIBRARY})
set(SYCL_LIBRARY_FOUND TRUE)
break()
endif()
endforeach()
if(NOT SYCL_LIBRARY_FOUND)
message(FATAL_ERROR "Cannot find a SYCL library")
endif()
endif()

if(DNNL_SYCL_CUDA)
# XXX: Suppress warning coming from SYCL headers:
# error: use of function template name with no prior declaration in
Expand Down

0 comments on commit 9bc87e6

Please sign in to comment.