diff options
Diffstat (limited to 'contrib/python/setup.py')
-rw-r--r-- | contrib/python/setup.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/contrib/python/setup.py b/contrib/python/setup.py index 66042fbc8..bc501b360 100644 --- a/contrib/python/setup.py +++ b/contrib/python/setup.py @@ -3,31 +3,38 @@ from distutils.extension import Extension import os import sys -available_switches = ['--with-cmph'] +available_switches = ['--with-cmph', '--moses-lib'] with_cmph = False -while sys.argv[-1] in available_switches: - switch = sys.argv.pop() - if switch == '--with-cmph': +mosesdir = os.path.abspath('../../') +includes = [mosesdir, os.path.join(mosesdir, 'moses/src'), os.path.join(mosesdir, 'util')] +libdir = os.path.join(mosesdir, 'lib') + +while sys.argv[-1].split('=')[0] in available_switches: + param = sys.argv.pop().split('=') + if param[0] == '--with-cmph': with_cmph = True + if param[0] == '--moses-lib': + libdir = param[1] +print >> sys.stderr, 'mosesdir=%s\nincludes=%s\nlibdir=%s\ncmph=%s' % (mosesdir, includes, libdir, with_cmph) #### 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] +print >> sys.stderr, 'basic=%s\nmoses=%s\nadditional=%s\nextra=%s' % (basic, moses, additional, exobj) + ext_modules = [ Extension(name = 'binpt', sources = ['binpt/binpt.cpp'], |