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
This commit is contained in:
Brecht Van Lommel 2022-08-24 15:36:29 +02:00
parent 8c38a994c6
commit e65f0337e9
Notes: blender-bot 2023-02-14 05:28:01 +01:00
Referenced by issue #100614, Typo flag for WITH_CYCLES_ONEAPI_BINARIES
3 changed files with 18 additions and 12 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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