From 6ddc5b283246bac42842d918dab260529759c8d6 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sat, 6 Feb 2016 13:46:21 -0600
Subject: [PATCH] Enable event callbacks on Windows on VS 2015+

---
 src/c_wrapper/wrap_cl.h | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/c_wrapper/wrap_cl.h b/src/c_wrapper/wrap_cl.h
index 8b58e71b..32a7614c 100644
--- a/src/c_wrapper/wrap_cl.h
+++ b/src/c_wrapper/wrap_cl.h
@@ -13,7 +13,7 @@
 
 #ifdef __APPLE__
 
-// Mac ------------------------------------------------------------------------
+// {{{ Mac
 #include <OpenCL/opencl.h>
 
 #define PYOPENCL_HAVE_EVENT_SET_CALLBACK
@@ -26,21 +26,39 @@
 #include <OpenCL/cl_gl.h>
 #include <OpenCL/cl_gl_ext.h>
 #endif
+// }}}
 
 #else
 
-// elsewhere ------------------------------------------------------------------
+// {{{ elsewhere
+
 #include <CL/cl.h>
 #include <CL/cl_ext.h>
 
 #if defined(_WIN32)
+
+// {{{ Windows
+
 #define NOMINMAX
 #include <windows.h>
 #define strdup _strdup
 #define strcasecmp _stricmp
+
+#if _MSC_VER >= 1900 /* VS 2015 and higher */
+#define PYOPENCL_HAVE_EVENT_SET_CALLBACK
+#endif
+
+// }}}
+
 #else
+
+// {{{ non-Windows
+
 #include <unistd.h>
 #define PYOPENCL_HAVE_EVENT_SET_CALLBACK
+
+// }}}
+
 #endif
 
 #ifdef HAVE_GL
@@ -52,8 +70,14 @@
 #define PYOPENCL_GL_SHARING_VERSION cl_khr_gl_sharing
 #endif
 
+// }}}
+
 #endif
 
+// }}}
+
+
+// {{{ version handling
 
 #ifdef PYOPENCL_PRETEND_CL_VERSION
 #define PYOPENCL_CL_VERSION PYOPENCL_PRETEND_CL_VERSION
@@ -71,6 +95,8 @@
 
 #endif
 
+// }}}
+
 #ifndef CL_VERSION_2_0
 typedef void* CLeglImageKHR;
 typedef void* CLeglDisplayKHR;
@@ -132,3 +158,5 @@ extern "C" {
 #endif
 
 #endif
+
+// vim: foldmethod=marker
-- 
GitLab