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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
from distutils.core import setup
from distutils.extension import Extension
import os
import sys
available_switches = ['--with-cmph']
with_cmph = False
while sys.argv[-1] in available_switches:
switch = sys.argv.pop()
if switch == '--with-cmph':
with_cmph = True
#### From here you probably don't need to change anything
#### unless a new dependency shows up in Moses
mosesdir = os.path.abspath('../../')
includes = [mosesdir, os.path.join(mosesdir, 'moses/src'), os.path.join(mosesdir, 'util')]
libdir = os.path.join(mosesdir, 'lib')
basic=['z', 'stdc++', 'pthread', 'm', 'gcc_s', 'c', 'boost_system', 'boost_thread', 'boost_filesystem', 'rt']
moses=['OnDiskPt', 'kenutil', 'kenlm', 'LM', 'mert_lib', 'moses_internal', 'CYKPlusParser', 'Scope3Parser', 'fuzzy-match', 'RuleTable', 'CompactPT', 'moses', 'dynsa', 'pcfg_common' ]
additional=[]
if with_cmph:
additional.append('cmph')
exobj = [os.path.join(libdir, 'lib' + l + '.so') for l in moses]
ext_modules = [
Extension(name = 'binpt',
sources = ['binpt/binpt.cpp'],
language = 'C++',
include_dirs = includes,
extra_objects = exobj,
library_dirs = [libdir],
runtime_library_dirs = [libdir],
libraries = basic + moses + additional,
extra_compile_args = ['-O3', '-DNDEBUG'],
)
]
setup(
name='binpt',
ext_modules=ext_modules
)
|