Skip to content

Commit

Permalink
Added CL_USE_SHIPPED_EXT Switch in setup.py to use src/c_wrapper/clin…
Browse files Browse the repository at this point in the history
…fo_ext.h instead of CL/cl_ext.h.
  • Loading branch information
Shane-J-Latham committed Jun 11, 2016
1 parent 405fb44 commit 8758099
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
8 changes: 8 additions & 0 deletions setup.py
Expand Up @@ -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."),

Expand Down Expand Up @@ -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(".")]
Expand Down
24 changes: 24 additions & 0 deletions 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 <OpenCL/opencl.h>

#else

#include <CL/cl.h>
#include <CL/cl_ext.h>

#endif

#endif

#endif

6 changes: 2 additions & 4 deletions src/c_wrapper/wrap_cl.h
Expand Up @@ -9,12 +9,13 @@

#include <stdint.h>

#include "pyopencl_ext.h"

#define CL_USE_DEPRECATED_OPENCL_1_1_APIS

#ifdef __APPLE__

// {{{ Mac
#include <OpenCL/opencl.h>

#define PYOPENCL_HAVE_EVENT_SET_CALLBACK

Expand All @@ -32,9 +33,6 @@

// {{{ elsewhere

#include <CL/cl.h>
#include <CL/cl_ext.h>

#if defined(_WIN32)

// {{{ Windows
Expand Down

0 comments on commit 8758099

Please sign in to comment.