Created
March 10, 2016 23:13
-
-
Save euphoria/d3ed67b057ad09386105 to your computer and use it in GitHub Desktop.
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
# Imagine this is first/first_build.py | |
from cffi import FFI | |
ffi = FFI() | |
with open("/usr/local/include/tfc.h") as f: | |
ffi.cdef(f.read()) | |
ffi.set_source("first._first", | |
""" | |
#include "tfc.h" | |
#include "first.h" | |
""" | |
include_dirs=["/usr/local/include", "projects/first/include"], | |
library_dirs=["/usr/local/lib", "projects/first/lib"], | |
libraries=["c", "tfc", "first"] | |
) | |
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
# Imagine this is second/second_build.py | |
from cffi import FFI | |
ffi = FFI() | |
with open("/usr/local/include/tfc.h") as f: | |
ffi.cdef(f.read()) | |
ffi.set_source("second._second", | |
""" | |
#include "tfc.h" | |
#include "second.h" | |
""" | |
include_dirs=["/usr/local/include", "projects/second/include"], | |
library_dirs=["/usr/local/lib", "projects/second/lib"], | |
libraries=["c", "tfc", "second"] | |
) | |
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
# Imagine this is first/setup.py | |
setup( | |
name="first", | |
cffi_modules=["first_build.py:ffi"] | |
) |
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
# Imagine this is second/setup.py | |
setup( | |
name="second", | |
cffi_modules=["second_build.py:ffi"] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment