Fix broken OPTIX_ROOT_DIR environment variable for setting up build

Changes in 42713bf made it ignore the environment variable if there is a
defined but empty CMake variable. Also make similar changes for other
GPU compute APIs, to guard against future problems like this.

Pull Request: https://projects.blender.org/blender/blender/pulls/111928
This commit is contained in:
Brecht Van Lommel
2023-09-04 17:28:00 +02:00
committed by Brecht Van Lommel
parent 564bbdf6e7
commit 526f935981
4 changed files with 8 additions and 4 deletions

View File

@@ -8,7 +8,7 @@
# HIP_FOUND, if the HIP toolkit is found.
# If `HIP_ROOT_DIR` was defined in the environment, use it.
if(DEFINED HIP_ROOT_DIR)
if(DEFINED HIP_ROOT_DIR AND HIP_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{HIP_ROOT_DIR})
set(HIP_ROOT_DIR $ENV{HIP_ROOT_DIR})

View File

@@ -8,7 +8,7 @@
# HIPRT_FOUND, if SDK found
# If `HIPRT_ROOT_DIR` was defined in the environment, use it.
if(DEFINED HIPRT_ROOT_DIR)
if(DEFINED HIPRT_ROOT_DIR AND HIPRT_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{HIPRT_ROOT_DIR})
set(HIPRT_ROOT_DIR $ENV{HIPRT_ROOT_DIR})

View File

@@ -12,7 +12,7 @@
# OPTIX_FOUND, If false, do not try to use OptiX.
# If `OPTIX_ROOT_DIR` was defined in the environment, use it.
if(DEFINED OPTIX_ROOT_DIR)
if(DEFINED OPTIX_ROOT_DIR AND OPTIX_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{OPTIX_ROOT_DIR})
set(OPTIX_ROOT_DIR $ENV{OPTIX_ROOT_DIR})

View File

@@ -12,8 +12,12 @@
# This can also be an environment variable.
# SYCL_FOUND, If false, then don't try to use SYCL.
if(NOT SYCL_ROOT_DIR AND NOT $ENV{SYCL_ROOT_DIR} STREQUAL "")
if(DEFINED SYCL_ROOT_DIR AND SYCL_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{SYCL_ROOT_DIR} AND NOT $ENV{SYCL_ROOT_DIR} STREQUAL "")
set(SYCL_ROOT_DIR $ENV{SYCL_ROOT_DIR})
else()
set(SYCL_ROOT_DIR "")
endif()
set(_sycl_search_dirs