Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert wrapper to ahead-of-time, verified build (some extensions mis…
…sing so far)
- Loading branch information
Showing
48 changed files
with
222 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,5 @@ virtualenv-[0-9]* | |
pytest.xml | ||
setuptools*tar.gz | ||
build-and-test-py-project.sh | ||
|
||
cffi_build.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
from __future__ import absolute_import, print_function | ||
|
||
__copyright__ = """ | ||
Copyright (C) 2009-15 Andreas Kloeckner | ||
Copyright (C) 2013 Marko Bencun | ||
Copyright (C) 2014 Yuyi Chao | ||
""" | ||
|
||
__license__ = """ | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
""" | ||
|
||
|
||
from cffi import FFI | ||
|
||
ffi = FFI() | ||
|
||
|
||
with open("cl_types.h", "rt") as f: | ||
ffi.cdef(f.read()) | ||
|
||
if {CL_ENABLE_GL}: | ||
with open("cl_gl_types.h") as f: | ||
ffi.cdef(f.read()) | ||
|
||
with open("src/c_wrapper/wrap_cl_core.h", "rt") as f: | ||
ffi.cdef(f.read()) | ||
|
||
if {CL_ENABLE_GL}: | ||
with open("wrap_cl_gl_core.h") as f: | ||
ffi.cdef(f.read()) | ||
|
||
ffi.set_source("pyopencl._cffi", | ||
""" | ||
#include <CL/cl.h> | ||
|
||
extern "C" {{ | ||
#include <wrap_cl_core.h> | ||
#ifdef HAVE_GL | ||
#include <wrap_cl_gl_core.h> | ||
#endif | ||
}} | ||
""", | ||
define_macros=list({EXTRA_DEFINES}.items()), | ||
include_dirs=( | ||
{CL_INC_DIR} + ["src/c_wrapper/"]), | ||
library_dirs={CL_LIB_DIR}, | ||
libraries={CL_LIBNAME}, | ||
extra_compile_args=( | ||
['-std=c++0x'] + {CXXFLAGS}), | ||
extra_link_args={LDFLAGS}, | ||
source_extension=".cpp", | ||
sources=[ | ||
"src/c_wrapper/wrap_cl.cpp", | ||
"src/c_wrapper/wrap_constants.cpp", | ||
"src/c_wrapper/bitlog.cpp", | ||
"src/c_wrapper/pyhelper.cpp", | ||
"src/c_wrapper/platform.cpp", | ||
"src/c_wrapper/device.cpp", | ||
"src/c_wrapper/context.cpp", | ||
"src/c_wrapper/command_queue.cpp", | ||
"src/c_wrapper/event.cpp", | ||
"src/c_wrapper/memory_object.cpp", | ||
"src/c_wrapper/image.cpp", | ||
"src/c_wrapper/gl_obj.cpp", | ||
"src/c_wrapper/memory_map.cpp", | ||
"src/c_wrapper/buffer.cpp", | ||
"src/c_wrapper/sampler.cpp", | ||
"src/c_wrapper/program.cpp", | ||
"src/c_wrapper/kernel.cpp", | ||
"src/c_wrapper/debug.cpp", | ||
] | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
ffi.compile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* cl_gl.h */ | ||
typedef cl_uint cl_gl_object_type; | ||
typedef cl_uint cl_gl_texture_info; | ||
typedef cl_uint cl_gl_platform_info; | ||
typedef struct __GLsync *cl_GLsync; | ||
typedef cl_uint cl_gl_context_info; | ||
|
||
/* cl_egl.h */ | ||
typedef void* CLeglImageKHR; | ||
typedef void* CLeglDisplayKHR; | ||
typedef void* CLeglSyncKHR; | ||
typedef intptr_t cl_egl_image_properties_khr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.