diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bdb53e9..dc36e64a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ option(WITH_MSR "Enable MSR mod & 1st-gen Ryzen fix" ON) option(WITH_ENV_VARS "Enable environment variables support in config file" ON) option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF) option(WITH_OPENCL "Enable OpenCL backend" ON) +set(WITH_OPENCL_VERSION 200 CACHE STRING "Target OpenCL version") +set_property(CACHE WITH_OPENCL_VERSION PROPERTY STRINGS 120 200 210 220) option(WITH_CUDA "Enable CUDA backend" ON) option(WITH_NVML "Enable NVML (NVIDIA Management Library) support (only if CUDA backend enabled)" ON) option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON) diff --git a/src/backend/opencl/opencl.cmake b/src/backend/opencl/opencl.cmake index acaed339..49134df7 100644 --- a/src/backend/opencl/opencl.cmake +++ b/src/backend/opencl/opencl.cmake @@ -5,9 +5,13 @@ if (BUILD_STATIC AND XMRIG_OS_UNIX AND WITH_OPENCL) endif() if (WITH_OPENCL) - add_definitions(/DCL_TARGET_OPENCL_VERSION=200) - add_definitions(/DCL_USE_DEPRECATED_OPENCL_1_2_APIS) add_definitions(/DXMRIG_FEATURE_OPENCL) + add_definitions(/DCL_USE_DEPRECATED_OPENCL_1_2_APIS) + if (XMRIG_OS_APPLE) + add_definitions(/DCL_TARGET_OPENCL_VERSION=120) + elseif (WITH_OPENCL_VERSION) + add_definitions(/DCL_TARGET_OPENCL_VERSION=${WITH_OPENCL_VERSION}) + endif() set(HEADERS_BACKEND_OPENCL src/backend/opencl/cl/OclSource.h