Write setup.py to compile liblex and friends.

This commit is contained in:
Danila Fedorin 2017-05-05 19:58:40 -07:00
parent e747bd4907
commit a2faeb0c9d

23
setup.py Normal file
View File

@ -0,0 +1,23 @@
from distutils.core import setup, Extension
def source_paths(base_path, sources):
return [base_path + s for s in sources]
liblex_path = 'external/liblex/'
liblex_sources = ['eval.c', 'pairmap.c', 'pattern.c']
liblex_source_paths = source_paths(liblex_path + 'src/', liblex_sources)
liblex_libds_path = 'external/libds/'
liblex_libds_sources = ['ht.c', 'libds.c', 'll.c', 'sprs.c', 'vec.c']
liblex_libds_source_paths = source_paths(liblex_path + liblex_libds_path + 'src/', liblex_libds_sources)
liblex_all_source_paths = liblex_libds_source_paths + liblex_source_paths
pyliblex = Extension('pyliblex',
sources = ['src/pyliblexmodule.c'] + liblex_all_source_paths,
include_dirs = [liblex_path + 'include', liblex_path + liblex_libds_path + 'include', 'include'])
setup(name='pyliblex',
version='0.0',
ext_modules = [pyliblex])