From 883cd6999718883d9b35d8b63fd7abb65210b5f6 Mon Sep 17 00:00:00 2001 From: Ihar Hubchyk Date: Mon, 18 Mar 2024 22:47:41 +0800 Subject: [PATCH] Fix macOS build --- src/opencl/image_buffer_opencl.h | 5 +++-- src/opencl/opencl_device.cpp | 6 ++++++ src/opencl/opencl_device.h | 5 +++-- src/opencl/opencl_helper.h | 5 +++-- src/opencl/opencl_memory.h | 5 +++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/opencl/image_buffer_opencl.h b/src/opencl/image_buffer_opencl.h index fefe7f8b..5ebe84c3 100644 --- a/src/opencl/image_buffer_opencl.h +++ b/src/opencl/image_buffer_opencl.h @@ -20,11 +20,12 @@ #pragma once -#define CL_TARGET_OPENCL_VERSION 210 - #if defined( __APPLE__ ) || defined( __MACOSX ) #include #else + +#define CL_TARGET_OPENCL_VERSION 210 + #include #endif diff --git a/src/opencl/opencl_device.cpp b/src/opencl/opencl_device.cpp index 5f362f9e..bbd5357f 100644 --- a/src/opencl/opencl_device.cpp +++ b/src/opencl/opencl_device.cpp @@ -144,7 +144,13 @@ namespace multiCL OpenCLQueue::OpenCLQueue( const OpenCLContext & context, cl_device_id deviceId ) { cl_int error; + +#if defined( __APPLE__ ) || defined( __MACOSX ) + _commandQueue = clCreateCommandQueue( context(), deviceId, 0, &error ); +#else _commandQueue = clCreateCommandQueueWithProperties( context(), deviceId, 0, &error ); +#endif + openCLCheck( error ); } diff --git a/src/opencl/opencl_device.h b/src/opencl/opencl_device.h index 0a740618..edae8c15 100644 --- a/src/opencl/opencl_device.h +++ b/src/opencl/opencl_device.h @@ -20,11 +20,12 @@ #pragma once -#define CL_TARGET_OPENCL_VERSION 210 - #if defined( __APPLE__ ) || defined( __MACOSX ) #include #else + +#define CL_TARGET_OPENCL_VERSION 210 + #include #endif diff --git a/src/opencl/opencl_helper.h b/src/opencl/opencl_helper.h index cda68e83..cc7c65f7 100644 --- a/src/opencl/opencl_helper.h +++ b/src/opencl/opencl_helper.h @@ -20,11 +20,12 @@ #pragma once -#define CL_TARGET_OPENCL_VERSION 210 - #if defined( __APPLE__ ) || defined( __MACOSX ) #include #else + +#define CL_TARGET_OPENCL_VERSION 210 + #include #endif diff --git a/src/opencl/opencl_memory.h b/src/opencl/opencl_memory.h index 532651dd..c34177e0 100644 --- a/src/opencl/opencl_memory.h +++ b/src/opencl/opencl_memory.h @@ -20,11 +20,12 @@ #pragma once -#define CL_TARGET_OPENCL_VERSION 210 - #if defined( __APPLE__ ) || defined( __MACOSX ) #include #else + +#define CL_TARGET_OPENCL_VERSION 210 + #include #endif