Created
October 28, 2010 17:58
-
-
Save nfarring/651931 to your computer and use it in GitHub Desktop.
This script manually builds a Python wrapper library for a C library. There is an easier/better way to do this using distutils.
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
# Generate my_python_library_wrap.c and MyPythonLibrary.py | |
# | |
swig -python my_python_library.i | |
# | |
# Generate _MyPythonLibrary.so | |
# | |
gcc `python-config --cflags --ldflags` -I/path/to/my/c/library/headers -L/path/to/my/c/library -lmy_c_library my_python_library_wrap.c -fPIC -shared -o _MyPythonLibrary.so | |
# | |
# Now you can copy MyPythonLibrary.py and _MyPythonLibrary.so into your python site-packages/ directory. | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment