diff options
author | Xavier Hallade <xavier.hallade@intel.com> | 2022-10-06 21:49:53 +0300 |
---|---|---|
committer | Xavier Hallade <xavier.hallade@intel.com> | 2022-10-07 17:14:50 +0300 |
commit | 3714d3c3ce8a64a027012653ee8372617f0ce3f8 (patch) | |
tree | 7f1e5daef070a7b7745ee12dd1a69ca6322dd0e9 /build_files/cmake | |
parent | 331f8500569df9b3b2aa776c5bcaad7b99c57295 (diff) |
Cycles: link oneAPI backend with debug version of sycl when in Debug
It fixes SYCL runtime issues in Debug builds that were due to mixing
Release and Debug MSVC runtimes.
This commit also removes specific handling of dpcpp compiler executable
to simplify the CMake implementation. Using it like clang++ works and
clang++ executable is also available from Intel oneAPI DPC++ compiler in
case it doesn't.
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/Modules/FindSYCL.cmake | 8 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/build_files/cmake/Modules/FindSYCL.cmake b/build_files/cmake/Modules/FindSYCL.cmake index 7aead43dd2a..139ebad46b1 100644 --- a/build_files/cmake/Modules/FindSYCL.cmake +++ b/build_files/cmake/Modules/FindSYCL.cmake @@ -62,6 +62,13 @@ FIND_LIBRARY(SYCL_LIBRARY lib64 lib ) +if(WIN32) + string(REPLACE ".lib" "d.lib" SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY}) + set(SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY_DEBUG} CACHE FILEPATH "Path to SYCL debug library") +else() + set(SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY} CACHE FILEPATH "Path to SYCL debug library") +endif() + FIND_PATH(SYCL_INCLUDE_DIR NAMES CL/sycl.hpp @@ -85,4 +92,5 @@ ENDIF() MARK_AS_ADVANCED( _SYCL_INCLUDE_PARENT_DIR + SYCL_LIBRARY_DEBUG ) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 0f7f04203c6..7031b1faac4 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -958,11 +958,17 @@ if(WITH_CYCLES_DEVICE_ONEAPI) if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR) set(SYCL_ROOT_DIR ${CYCLES_SYCL}) endif() - file(GLOB _sycl_runtime_libraries + file(GLOB _sycl_runtime_libraries_glob ${SYCL_ROOT_DIR}/bin/sycl.dll ${SYCL_ROOT_DIR}/bin/sycl[0-9].dll - ${SYCL_ROOT_DIR}/bin/pi_level_zero.dll ) + foreach(sycl_runtime_library IN LISTS _sycl_runtime_libraries_glob) + string(REPLACE ".dll" "$<$<CONFIG:Debug>:d>.dll" sycl_runtime_library ${sycl_runtime_library}) + list(APPEND _sycl_runtime_libraries ${sycl_runtime_library}) + endforeach() + unset(_sycl_runtime_libraries_glob) + + list(APPEND _sycl_runtime_libraries ${SYCL_ROOT_DIR}/bin/pi_level_zero.dll) list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries}) unset(_sycl_runtime_libraries) endif() |