Cython has moved to github.
cython-devel
view Demos/libraries/setup.py @ 2813:fce98451e2dd
Library linking demo.
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Thu Jan 21 22:31:20 2010 -0800 (2 years ago) |
| parents | |
| children |
line source
1 import os
3 from distutils.core import setup
4 from distutils.extension import Extension
5 from Cython.Distutils import build_ext
8 # For demo purposes, we build our own tiny library.
9 try:
10 print "building libmymath.a"
11 assert os.system("gcc -c mymath.c -o mymath.o") == 0
12 assert os.system("ar rcs libmymath.a mymath.o") == 0
13 except:
14 if not os.path.exists("libmymath.a"):
15 print "Error building external library, please create libmymath.a manually."
16 sys.exit(1)
18 # Here is how to use the library built above.
19 ext_modules=[
20 Extension("call_mymath",
21 sources = ["call_mymath.pyx"],
22 include_dirs = [os.getcwd()], # path to .h file(s)
23 library_dirs = [os.getcwd()], # path to .a or .so file(s)
24 libraries = ['mymath'])
25 ]
27 setup(
28 name = 'Demos',
29 cmdclass = {'build_ext': build_ext},
30 ext_modules = ext_modules,
31 )
