diff --git a/setup.py b/setup.py index fd88b6461ec742ecbf824d1b7dfc577ce42673f0..ba00bb944188617e8df40e6e93c7132e25dcb7cd 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 0000000000000000000000000000000000000000..48e9444c540b10afc5dd4b70720644b1f7276415 --- /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 98e26963d4c620f8ccdaf2ac12fd2f4a28575901..dbd4115b9e2ccb6f0ac1ff59ff7979112a0710f7 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