From d0fdae78797979949ec7ead20ad52b901c8c7e9a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 28 Sep 2013 23:20:34 +0200 Subject: Fix OpenCL use on Mac Don't use glew but just include the which is present in the SDK and link to the OpenCL framework. Change-Id: I3e1c3773078bc5d2550be832a273273d89381dff --- sc/Library_scopencl.mk | 9 ++++++++- sc/source/core/opencl/openclwrapper.cxx | 6 +++++- sc/source/core/opencl/openclwrapper.hxx | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk index 2942e4709f68..c2ca1f397189 100644 --- a/sc/Library_scopencl.mk +++ b/sc/Library_scopencl.mk @@ -36,7 +36,8 @@ $(eval $(call gb_Library_use_libraries,scopencl,\ $(eval $(call gb_Library_add_exception_objects,scopencl,\ sc/source/core/opencl/formulagroupcl \ sc/source/core/opencl/openclwrapper \ - sc/source/core/opencl/clcc/clew \ + $(if $(filter-out MACOSX,$(OS)), \ + sc/source/core/opencl/clcc/clew) \ )) ifeq ($(OS),LINUX) @@ -45,4 +46,10 @@ $(eval $(call gb_Library_add_libs,scopencl,\ )) endif +ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_add_libs,scopencl,\ + -framework OpenCL \ +)) +endif + # vim: set noet sw=4 ts=4: diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index bc51148c5ce7..50bb0d1602e1 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -41,7 +41,7 @@ fprintf(stderr,"[OCL_ERROR] %s\n",str); #define OPENCL_DLL_NAME "OpenCL.dll" -#else +#elif !defined(MACOSX) #define OPENCL_DLL_NAME "libOpenCL.so" #endif @@ -2609,9 +2609,11 @@ bool createPlatformInfo(cl_platform_id nPlatformId, OpenclPlatformInfo& rPlatfor size_t getOpenCLPlatformCount() { +#ifndef MACOSX int status = clewInit(OPENCL_DLL_NAME); if (status < 0) return 0; +#endif cl_uint nPlatforms; cl_int nState = clGetPlatformIDs(0, NULL, &nPlatforms); @@ -2628,9 +2630,11 @@ const std::vector& fillOpenCLInfo() if(!aPlatforms.empty()) return aPlatforms; +#ifndef MACOSX int status = clewInit(OPENCL_DLL_NAME); if (status < 0) return aPlatforms; +#endif cl_uint nPlatforms; cl_int nState = clGetPlatformIDs(0, NULL, &nPlatforms); diff --git a/sc/source/core/opencl/openclwrapper.hxx b/sc/source/core/opencl/openclwrapper.hxx index c81c313dd96d..5fd39916211c 100644 --- a/sc/source/core/opencl/openclwrapper.hxx +++ b/sc/source/core/opencl/openclwrapper.hxx @@ -21,8 +21,16 @@ #include +#ifdef MACOSX + +#include + +#else + #include "clcc/clew.h" +#endif + // CL_MAP_WRITE_INVALIDATE_REGION is new in OpenCL 1.2. // When compiling against an older OpenCL, use CL_MAP_WRITE. -- cgit