From 87580995d342b063faa110ca349295f23a2c6119 Mon Sep 17 00:00:00 2001 From: Shane-J-Latham Date: Sat, 11 Jun 2016 16:43:07 +1000 Subject: [PATCH] Added CL_USE_SHIPPED_EXT Switch in setup.py to use src/c_wrapper/clinfo_ext.h instead of CL/cl_ext.h. --- setup.py | 8 ++++++++ src/c_wrapper/pyopencl_ext.h | 24 ++++++++++++++++++++++++ src/c_wrapper/wrap_cl.h | 6 ++---- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 src/c_wrapper/pyopencl_ext.h diff --git a/setup.py b/setup.py index fd88b646..ba00bb94 100644 --- a/setup.py +++ b/setup.py @@ -72,6 +72,11 @@ def get_config_schema(): return ConfigSchema([ Switch("CL_TRACE", False, "Enable OpenCL API tracing"), Switch("CL_ENABLE_GL", False, "Enable OpenCL<->OpenGL interoperability"), + Switch("CL_USE_SHIPPED_EXT", True, + "Use the pyopencl version of CL/cl_ext.h which includes" + + " a broader range of vendor-specific OpenCL extension attributes" + + " than the standard Khronos (or vendor specific) CL/cl_ext.h." + ), Option("CL_PRETEND_VERSION", None, "Dotted CL version (e.g. 1.2) which you'd like to use."), @@ -107,6 +112,9 @@ def main(): if conf["CL_ENABLE_GL"]: extra_defines["HAVE_GL"] = 1 + if conf["CL_USE_SHIPPED_EXT"]: + extra_defines["PYOPENCL_USE_SHIPPED_EXT"] = 1 + if conf["CL_PRETEND_VERSION"]: try: major, minor = [int(x) for x in conf["CL_PRETEND_VERSION"].split(".")] diff --git a/src/c_wrapper/pyopencl_ext.h b/src/c_wrapper/pyopencl_ext.h new file mode 100644 index 00000000..48e9444c --- /dev/null +++ b/src/c_wrapper/pyopencl_ext.h @@ -0,0 +1,24 @@ +#ifndef _PYOPENCL_EXT_H +#define _PYOPENCL_EXT_H + +#ifdef PYOPENCL_USE_SHIPPED_EXT + +#include "clinfo_ext.h" + +#else + +#ifdef __APPLE__ + +#include + +#else + +#include +#include + +#endif + +#endif + +#endif + diff --git a/src/c_wrapper/wrap_cl.h b/src/c_wrapper/wrap_cl.h index 98e26963..dbd4115b 100644 --- a/src/c_wrapper/wrap_cl.h +++ b/src/c_wrapper/wrap_cl.h @@ -9,12 +9,13 @@ #include +#include "pyopencl_ext.h" + #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #ifdef __APPLE__ // {{{ Mac -#include #define PYOPENCL_HAVE_EVENT_SET_CALLBACK @@ -32,9 +33,6 @@ // {{{ elsewhere -#include -#include - #if defined(_WIN32) // {{{ Windows -- GitLab