This requires a minimum driver version of 535, however most devices were already requiring 570 due to the CUDA toolkit version. The update is required to be able to use an API function for correct stack size calculation. Code for older API versions has been removed. Fix #138185: OSL custom camera errors with OptiX Pull Request: https://projects.blender.org/blender/blender/pulls/139801
66 lines
1.7 KiB
CMake
66 lines
1.7 KiB
CMake
# SPDX-FileCopyrightText: 2019 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# - Find OptiX library
|
|
# Find the native OptiX includes and library
|
|
# This module defines
|
|
# OPTIX_INCLUDE_DIRS, where to find optix.h, Set when
|
|
# OPTIX_INCLUDE_DIR is found.
|
|
# OPTIX_ROOT_DIR, The base directory to search for OptiX.
|
|
# This can also be an environment variable.
|
|
# OPTIX_FOUND, If false, do not try to use OptiX.
|
|
|
|
if(NOT (DEFINED OPTIX_ROOT_DIR))
|
|
set(OPTIX_ROOT_DIR "")
|
|
endif()
|
|
|
|
# If `OPTIX_ROOT_DIR` was defined in the environment, use it.
|
|
if(OPTIX_ROOT_DIR)
|
|
# Pass.
|
|
elseif(DEFINED ENV{OPTIX_ROOT_DIR})
|
|
set(OPTIX_ROOT_DIR $ENV{OPTIX_ROOT_DIR})
|
|
endif()
|
|
|
|
set(_optix_SEARCH_DIRS
|
|
${OPTIX_ROOT_DIR}
|
|
)
|
|
|
|
find_path(OPTIX_INCLUDE_DIR
|
|
NAMES
|
|
optix.h
|
|
HINTS
|
|
${_optix_SEARCH_DIRS}
|
|
PATH_SUFFIXES
|
|
include
|
|
)
|
|
|
|
if(EXISTS "${OPTIX_INCLUDE_DIR}/optix.h")
|
|
file(STRINGS "${OPTIX_INCLUDE_DIR}/optix.h" _optix_version REGEX "^#define OPTIX_VERSION[ \t].*$")
|
|
string(REGEX MATCHALL "[0-9]+" _optix_version ${_optix_version})
|
|
|
|
math(EXPR _optix_version_major "${_optix_version} / 10000")
|
|
math(EXPR _optix_version_minor "(${_optix_version} % 10000) / 100")
|
|
math(EXPR _optix_version_patch "${_optix_version} % 100")
|
|
|
|
set(OPTIX_VERSION "${_optix_version_major}.${_optix_version_minor}.${_optix_version_patch}")
|
|
endif()
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if
|
|
# all listed variables are TRUE
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(OptiX
|
|
REQUIRED_VARS OPTIX_INCLUDE_DIR
|
|
VERSION_VAR OPTIX_VERSION)
|
|
|
|
if(OPTIX_FOUND)
|
|
set(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
|
|
endif()
|
|
|
|
mark_as_advanced(
|
|
OPTIX_INCLUDE_DIR
|
|
OPTIX_VERSION
|
|
)
|
|
|
|
unset(_optix_SEARCH_DIRS)
|