diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-06-08 12:13:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-06-08 12:13:22 +0300 |
commit | 12458daa7666d352b40cac4f307db7cca966f77c (patch) | |
tree | 02fbc7726e28122ca930efd72793206fcacabdbd /build_files | |
parent | f31cef6248fd12039a4d2dfb76b26f3426477a70 (diff) |
Cycles oneAPI: Tweaks to support pre-compiled DPC++
Compilation of Blender and kernel now works on Linux (did not test Windows).
Ahead-of-time compilation of kernels does not work because the compiled OCLOC
uses shared linking to its components and it seems to need special handling.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/Modules/FindSYCL.cmake | 19 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/FindSYCL.cmake b/build_files/cmake/Modules/FindSYCL.cmake index fcd8eaaa97b..227858eefb1 100644 --- a/build_files/cmake/Modules/FindSYCL.cmake +++ b/build_files/cmake/Modules/FindSYCL.cmake @@ -23,6 +23,11 @@ SET(_sycl_search_dirs C:/Program\ Files\ \(x86\)/Intel/oneAPI/compiler/latest/windows ) +# Find DPC++ compiler. +# Since the compiler name is possibly conflicting with the system-wide +# CLang start with looking for either dpcpp or clang binary in the given +# list of search paths only. If that fails, try to look for a system-wide +# dpcpp binary. FIND_PROGRAM(SYCL_COMPILER NAMES dpcpp @@ -31,8 +36,22 @@ FIND_PROGRAM(SYCL_COMPILER ${_sycl_search_dirs} PATH_SUFFIXES bin + NO_CMAKE_FIND_ROOT_PATH ) +# NOTE: No clang++ here so that we do not pick up a system-wide CLang +# compiler. +if(NOT SYCL_COMPILER) + FIND_PROGRAM(SYCL_COMPILER + NAMES + dpcpp + HINTS + ${_sycl_search_dirs} + PATH_SUFFIXES + bin + ) +endif() + FIND_LIBRARY(SYCL_LIBRARY NAMES sycl diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 20771c47155..90d21463f0e 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -276,6 +276,11 @@ if(WITH_CYCLES_DEVICE_ONEAPI) if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR) set(LEVEL_ZERO_ROOT_DIR ${CYCLES_LEVEL_ZERO}) endif() + + set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to DPC++ and SYCL installation") + if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR) + set(SYCL_ROOT_DIR ${CYCLES_SYCL}) + endif() endif() if(WITH_OPENVDB) |