[Bf-blender-cvs] [e65f0337e94] blender-v3.3-release: Fix WITH_CYCLES_ONEAPI_BINARIES issues with make release

Brecht Van Lommel noreply at git.blender.org
Wed Aug 24 15:39:26 CEST 2022


Commit: e65f0337e94242baf868aa2cd90a0b489e38b087
Author: Brecht Van Lommel
Date:   Wed Aug 24 15:36:29 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBe65f0337e94242baf868aa2cd90a0b489e38b087

Fix WITH_CYCLES_ONEAPI_BINARIES issues with make release

Fix typo in blender_release.cmake, and ensure that "make release" still works
when ocloc is not available. While a fatal error is useful for debugging, the
current convention is to disable features, especially in cases like this where
there is no simple way to make the feature work.

Differential Revision: https://developer.blender.org/D15774

===================================================================

M	build_files/cmake/config/blender_release.cmake
M	intern/cycles/cmake/external_libs.cmake
M	intern/cycles/kernel/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index a663d8840b8..eac51756853 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -87,5 +87,5 @@ if(NOT APPLE)
   set(WITH_CYCLES_CUBIN_COMPILER  OFF CACHE BOOL "" FORCE)
   set(WITH_CYCLES_HIP_BINARIES    ON  CACHE BOOL "" FORCE)
   set(WITH_CYCLES_DEVICE_ONEAPI   ON  CACHE BOOL "" FORCE)
-  set(WITH_CYCLES_ONEAPI_BINARIES OM CACHE BOOL "" FORCE)
+  set(WITH_CYCLES_ONEAPI_BINARIES ON  CACHE BOOL "" FORCE)
 endif()
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
index 51830250f2e..00a824ca99a 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -654,15 +654,29 @@ endif()
 # oneAPI
 ###########################################################################
 
-if (WITH_CYCLES_DEVICE_ONEAPI)
+if(WITH_CYCLES_DEVICE_ONEAPI)
   find_package(SYCL)
   find_package(LevelZero)
 
-  if (SYCL_FOUND AND LEVEL_ZERO_FOUND)
+  if(SYCL_FOUND AND LEVEL_ZERO_FOUND)
     message(STATUS "Found oneAPI: ${SYCL_LIBRARY}")
     message(STATUS "Found Level Zero: ${LEVEL_ZERO_LIBRARY}")
+
+    if(WITH_CYCLES_ONEAPI_BINARIES)
+      if(NOT OCLOC_INSTALL_DIR)
+        get_filename_component(_sycl_compiler_root ${SYCL_COMPILER} DIRECTORY)
+        get_filename_component(OCLOC_INSTALL_DIR "${_sycl_compiler_root}/../lib/ocloc" ABSOLUTE)
+        unset(_sycl_compiler_root)
+      endif()
+
+      if(NOT EXISTS ${OCLOC_INSTALL_DIR})
+        message(STATUS "oneAPI ocloc not found in ${OCLOC_INSTALL_DIR}, disabling WITH_CYCLES_ONEAPI_BINARIES."
+                       " A different ocloc directory can be set using OCLOC_INSTALL_DIR cmake variable.")
+        set(WITH_CYCLES_ONEAPI_BINARIES OFF)
+      endif()
+    endif()
   else()
-    message(STATUS "oneAPI or Level Zero not found, disabling oneAPI device from Cycles")
+    message(STATUS "oneAPI or Level Zero not found, disabling WITH_CYCLES_DEVICE_ONEAPI")
     set(WITH_CYCLES_DEVICE_ONEAPI OFF)
   endif()
 endif()
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index b00515eb037..7c31b21797f 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -785,14 +785,6 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
   get_filename_component(sycl_compiler_root ${SYCL_COMPILER} DIRECTORY)
   get_filename_component(sycl_compiler_compiler_name ${SYCL_COMPILER} NAME_WE)
 
-  if(NOT OCLOC_INSTALL_DIR)
-    get_filename_component(OCLOC_INSTALL_DIR "${sycl_compiler_root}/../lib/ocloc" ABSOLUTE)
-  endif()
-  if(WITH_CYCLES_ONEAPI_BINARIES AND NOT EXISTS ${OCLOC_INSTALL_DIR})
-    message(FATAL_ERROR "WITH_CYCLES_ONEAPI_BINARIES requires ocloc but ${OCLOC_INSTALL_DIR} directory doesn't exist."
-                        " A different ocloc directory can be set using OCLOC_INSTALL_DIR cmake variable.")
-  endif()
-
   if(UNIX AND NOT APPLE)
     if(NOT WITH_CXX11_ABI)
       check_library_exists(sycl



More information about the Bf-blender-cvs mailing list