prefer system provided OpenCL library on macOS

This commit is contained in:
Axel Kohlmeyer
2021-05-07 09:28:13 -04:00
parent 09d59a981e
commit 69d081cd6a

View File

@ -145,7 +145,14 @@ if(GPU_API STREQUAL "CUDA")
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
elseif(GPU_API STREQUAL "OPENCL")
option(USE_STATIC_OPENCL_LOADER "Download and include a static OpenCL ICD loader" ON)
# the static OpenCL loader doesn't seem to work on macOS. use the system provided
# version by default instead (for as long as it will be available)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(_opencl_static_default OFF)
else()
set(_opencl_static_default ON)
endif()
option(USE_STATIC_OPENCL_LOADER "Download and include a static OpenCL ICD loader" ${_opencl_static_default})
mark_as_advanced(USE_STATIC_OPENCL_LOADER)
if (USE_STATIC_OPENCL_LOADER)
include(OpenCLLoader)