From 27aa5c03439c59b8a37ab656b0e52aee4b146fe2 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 May 2024 21:51:46 +0800 Subject: [PATCH] opencl.c: unbreak build on macOS with no OpenCL support (#940) Fixes: https://github.com/fastfetch-cli/fastfetch/issues/939 --- src/detection/opencl/opencl.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/detection/opencl/opencl.c b/src/detection/opencl/opencl.c index 957c1c1dc..f3339bee8 100644 --- a/src/detection/opencl/opencl.c +++ b/src/detection/opencl/opencl.c @@ -1,6 +1,13 @@ #include "detection/opencl/opencl.h" -#if defined(FF_HAVE_OPENCL) || defined(__APPLE__) +#ifdef __APPLE__ +#include +#if (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__) +#define MACOS_HAS_OPENCL +#endif +#endif + +#if defined(FF_HAVE_OPENCL) || defined(MACOS_HAS_OPENCL) #include "common/library.h" #include "common/parsing.h" @@ -64,7 +71,7 @@ static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result) return NULL; } -#endif // defined(FF_HAVE_OPENCL) || defined(__APPLE__) +#endif // defined(FF_HAVE_OPENCL) || defined(MACOS_HAS_OPENCL) const char* ffDetectOpenCL(FFOpenCLResult* result) { @@ -84,7 +91,7 @@ const char* ffDetectOpenCL(FFOpenCLResult* result) return openCLHandleData(&data, result); - #elif defined(__APPLE__) // FF_HAVE_OPENCL + #elif defined(MACOS_HAS_OPENCL) // FF_HAVE_OPENCL OpenCLData data; data.ffclGetPlatformIDs = clGetPlatformIDs;