| 1 |
PYTHON setup.py build_ext --inplace |
| 2 |
|
| 3 |
######## setup.py ######## |
| 4 |
|
| 5 |
from Cython.Build import cythonize |
| 6 |
from Cython.Distutils.extension import Extension |
| 7 |
|
| 8 |
ext_modules = [ |
| 9 |
Extension("a", ["a.pyx"]), |
| 10 |
Extension("x", ["x.pyx"]), |
| 11 |
Extension("y", ["y.pyx"]), |
| 12 |
] |
| 13 |
|
| 14 |
ext_modules = cythonize(ext_modules) |
| 15 |
|
| 16 |
assert len(ext_modules[0].libraries) == 2 |
| 17 |
assert ext_modules[1].libraries == ["lib_x"] |
| 18 |
assert ext_modules[2].libraries == ["lib_y"] |
| 19 |
|
| 20 |
######## libx.pxd ######## |
| 21 |
# distutils: libraries = lib_x |
| 22 |
|
| 23 |
######## liby.pxd ######## |
| 24 |
# distutils: libraries = lib_y |
| 25 |
|
| 26 |
######## a.pyx ######## |
| 27 |
cimport libx , liby |
| 28 |
|
| 29 |
######## x.pyx ######## |
| 30 |
cimport libx |
| 31 |
|
| 32 |
######## y.pyx ######## |
| 33 |
cimport liby |