summaryrefslogtreecommitdiff
path: root/python/setup.py.in
blob: 4d77fbc760aee3cda54d555b48c41c8839d0668d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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']

# 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'],
        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'}
)