summaryrefslogtreecommitdiff
path: root/python/setup.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'python/setup.py.in')
-rw-r--r--python/setup.py.in33
1 files changed, 33 insertions, 0 deletions
diff --git a/python/setup.py.in b/python/setup.py.in
new file mode 100644
index 00000000..f191ef8b
--- /dev/null
+++ b/python/setup.py.in
@@ -0,0 +1,33 @@
+from distutils.core import setup
+from distutils.extension import Extension
+import re
+
+INC = ['..', 'src/', '../decoder', '../utils', '../mteval']
+LIB = ['../decoder', '../utils', '../mteval', '../training', '../klm/lm', '../klm/util', '../klm/search']
+
+# Set automatically by configure
+LIBS = re.findall('-l([^\s]+)', '@LIBS@')
+CPPFLAGS = re.findall('-[^\s]+', '@CPPFLAGS@')
+LDFLAGS = re.findall('-[^\s]+', '@LDFLAGS@')
+# Make sure linker flags go only to the linker
+LDFLAGS = [opt.replace('-R', '-Wl,-rpath,') for opt in LDFLAGS]
+
+ext_modules = [
+ Extension(name='cdec._cdec',
+ sources=['src/_cdec.cpp'],
+ include_dirs=INC,
+ library_dirs=LIB,
+ libraries=LIBS + ['z', 'cdec', 'utils', 'mteval', 'training', 'klm', 'klm_util', 'ksearch'],
+ extra_compile_args=CPPFLAGS,
+ extra_link_args=LDFLAGS),
+ Extension(name='cdec.sa._sa',
+ sources=['src/sa/_sa.c', 'src/sa/strmap.cc'])
+]
+
+setup(
+ name='cdec',
+ ext_modules=ext_modules,
+ requires=['configobj'],
+ packages=['cdec', 'cdec.sa'],
+ package_dir={'': 'pkg'}
+)