pepijndevos / futhark-pycffi

Python library using the Futhark C backend via CFFI
MIT License
23 stars 7 forks source link

Modify the API to build.py #27

Closed mortvest closed 3 years ago

mortvest commented 3 years ago

I am currently working on a library that uses futhark-pycffi generated bindings for the Futhark code. I am using setuptools to build the library, and the setuptools CFFI extension to automate the preparation of CFFI modules. This is accomplished by adding following to setup.py:

setup(
       .....
       cffi_modules=[
               "package/builder.py:ffibuilder_a",
               "package/builder.py:ffibuilder_b",
               .....
       ])

I currently have to copy the contents of the build.py to builder.py and then use the modified version of build() function to create ffbuilder_a and ffbuilder_b objects, that can then be used by setuptools.

I have to modify the build() function to take two arguments: the base name of the c and h files and output name for the generated shared library.

It would be great, if in builder.py, I could just write:

from futhark_ffi.build import build

ffibuilder_a = build("package/src/code_a", "package/code_a")
ffibuilder_b = build("package/src/code_b", "package/code_b")

I can make a PR, if you are okay with this :)

athas commented 3 years ago

Make a PR; what you suggest makes perfect sense.

Also, I got a Tex Shinobi and it is great.

athas commented 3 years ago

Fixed in #28.