From 954c6c0ae653b7b754ed742b838dbae15c4aa03f Mon Sep 17 00:00:00 2001 From: Xavier Hallade Date: Tue, 18 Apr 2023 18:48:37 +0200 Subject: [PATCH] Revert "Cycles: move oneAPI kernels dynamic library to blender.shared" This reverts commit df096eab77436c0191f39806b0907aeb9744bee8. There is a corner case for when WITH_CYCLES_ONEAPI_BINARIES is set to on and later turned off during config, in case there is no ocloc. --- .../cmake/platform/platform_unix.cmake | 12 ----------- .../cmake/platform/platform_win32.cmake | 12 ----------- intern/cycles/kernel/CMakeLists.txt | 21 +++++++++++++------ 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 752a69e4e66..72de4c59203 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -335,18 +335,6 @@ if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_ unset(_sycl_runtime_libraries) endif() -if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI) - if(WITH_CYCLES_ONEAPI_BINARIES) - set(cycles_kernel_oneapi_lib_suffix "_aot") - else() - set(cycles_kernel_oneapi_lib_suffix "_jit") - endif() - list(APPEND PLATFORM_BUNDLED_LIBRARIES - ${CMAKE_CURRENT_BINARY_DIR}/intern/cycles/kernel/libcycles_kernel_oneapi${cycles_kernel_oneapi_lib_suffix}.so - ) - unset(cycles_kernel_oneapi_lib_suffix) -endif() - if(WITH_OPENVDB) find_package(OpenVDB) set_and_warn_library_found("OpenVDB" OPENVDB_FOUND WITH_OPENVDB) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 07c0acb9fc6..9b7256a2120 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -1105,18 +1105,6 @@ if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_ set(SYCL_LIBRARIES optimized ${SYCL_LIBRARY} debug ${SYCL_LIBRARY_DEBUG}) endif() -if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI) - if(WITH_CYCLES_ONEAPI_BINARIES) - set(cycles_kernel_oneapi_lib_suffix "_aot") - else() - set(cycles_kernel_oneapi_lib_suffix "_jit") - endif() - list(APPEND PLATFORM_BUNDLED_LIBRARIES - ${CMAKE_CURRENT_BINARY_DIR}/intern/cycles/kernel/cycles_kernel_oneapi${cycles_kernel_oneapi_lib_suffix}.dll - ) - unset(cycles_kernel_oneapi_lib_suffix) -endif() - # Environment variables to run precompiled executables that needed libraries. list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ";" _library_paths) diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 632ddcb99dd..eb3d20f04ad 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -907,13 +907,22 @@ if(WITH_CYCLES_DEVICE_ONEAPI) DEPENDS ${cycles_oneapi_kernel_sources}) endif() - # For the Cycles standalone put libraries next to the Cycles application. if(NOT WITH_BLENDER) - if(WIN32) - delayed_install("" "${cycles_kernel_oneapi_lib}" ${CYCLES_INSTALL_PATH}) - else() - delayed_install("" "${cycles_kernel_oneapi_lib}" ${CYCLES_INSTALL_PATH}/lib) - endif() + # For the Cycles standalone put libraries next to the Cycles application. + set(cycles_oneapi_target_path ${CYCLES_INSTALL_PATH}) + else() + # For Blender put the libraries next to the Blender executable. + # + # Note that the installation path in the delayed_install is relative to the versioned folder, + # which means we need to go one level up. + set(cycles_oneapi_target_path "../") + endif() + + # install dynamic libraries required at runtime + if(WIN32) + delayed_install("" "${cycles_kernel_oneapi_lib}" ${cycles_oneapi_target_path}) + elseif(UNIX AND NOT APPLE) + delayed_install("" "${cycles_kernel_oneapi_lib}" ${cycles_oneapi_target_path}/lib) endif() add_custom_target(cycles_kernel_oneapi ALL DEPENDS ${cycles_kernel_oneapi_lib})