Skip to content

Commit 27aa5c0

Browse files
authored
opencl.c: unbreak build on macOS with no OpenCL support (#940)
Fixes: #939
1 parent 1d95f9b commit 27aa5c0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/detection/opencl/opencl.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#include "detection/opencl/opencl.h"
22

3-
#if defined(FF_HAVE_OPENCL) || defined(__APPLE__)
3+
#ifdef __APPLE__
4+
#include <AvailabilityMacros.h>
5+
#if (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__)
6+
#define MACOS_HAS_OPENCL
7+
#endif
8+
#endif
9+
10+
#if defined(FF_HAVE_OPENCL) || defined(MACOS_HAS_OPENCL)
411

512
#include "common/library.h"
613
#include "common/parsing.h"
@@ -64,7 +71,7 @@ static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result)
6471
return NULL;
6572
}
6673

67-
#endif // defined(FF_HAVE_OPENCL) || defined(__APPLE__)
74+
#endif // defined(FF_HAVE_OPENCL) || defined(MACOS_HAS_OPENCL)
6875

6976
const char* ffDetectOpenCL(FFOpenCLResult* result)
7077
{
@@ -84,7 +91,7 @@ const char* ffDetectOpenCL(FFOpenCLResult* result)
8491

8592
return openCLHandleData(&data, result);
8693

87-
#elif defined(__APPLE__) // FF_HAVE_OPENCL
94+
#elif defined(MACOS_HAS_OPENCL) // FF_HAVE_OPENCL
8895

8996
OpenCLData data;
9097
data.ffclGetPlatformIDs = clGetPlatformIDs;

0 commit comments

Comments
 (0)