mosesdecoder/moses/LM/Jamfile

151 lines
6.8 KiB
Plaintext
Raw Permalink Normal View History

2012-03-20 18:45:16 +04:00
#This is somewhat hairy due to the number of optional language models.
#Currently, the optional models are IRSTLM, SRILM, and RandLM. These are
#activated by --with-irstlm, --with-srilm, and --with-randlm respectively.
#The value is the path where it's installed e.g. --with-irstlm=/path/to/irst.
#Each optional model has a section below. The top level rule is lib LM, which
#appears after the optional models.
import option path ;
local dependencies = ;
2013-07-19 01:54:52 +04:00
local lmmacros = ;
2012-03-20 18:45:16 +04:00
#IRSTLM
local with-irstlm = [ option.get "with-irstlm" ] ;
if $(with-irstlm) {
lib irstlm : : <search>$(with-irstlm)/lib <search>$(with-irstlm)/lib64 ;
obj IRST.o : IRST.cpp ..//headers : <include>$(with-irstlm)/include <include>$(with-irstlm)/include/irstlm ;
alias irst : IRST.o irstlm : : : <define>LM_IRST ;
dependencies += irst ;
2013-07-19 01:54:52 +04:00
lmmacros += LM_IRST ;
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
echo "!!! You are linking with the IRSTLM library; be sure the release is >= 5.80.07 !!!" ;
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
}
2012-03-20 18:45:16 +04:00
#SRILM
local with-srilm = [ option.get "with-srilm" ] ;
local with-maxent-srilm = [ option.get "with-maxent-srilm" ] ;
if $(with-srilm) {
2015-03-09 00:25:24 +03:00
#echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
#echo "!!! You are linking with the SRILM library; Do NOT use version >= 1.7.1 !!!" ;
#echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
2014-09-30 13:06:52 +04:00
if [ option.get "with-srilm-dynamic" : no : yes ] = yes {
2012-03-20 18:45:16 +04:00
lib srilm ;
alias sri-libs : srilm ;
} else {
sri-arch = [ option.get "with-srilm-arch" ] ;
sri-arch ?= [ _shell $(with-srilm)/sbin/machine-type ] ;
sri-lib = <search>$(with-srilm)/lib/$(sri-arch) <search>$(with-srilm)/lib <search>$(with-srilm)/lib64 <search>$(with-srilm)/flm/obj/$(sri-arch) ;
lib flm : : $(sri-lib) ;
lib misc : flm : $(sri-lib) ;
lib dstruct : misc flm : $(sri-lib) ;
lib oolm : dstruct misc flm : $(sri-lib) ;
alias sri-libs : oolm dstruct misc flm ;
}
obj SRI.o : SRI.cpp ..//headers : <include>$(with-srilm)/include <include>$(with-srilm)/include/srilm <warnings>off ;
obj ParallelBackoff.o : ParallelBackoff.cpp ..//headers : <include>$(with-srilm)/include <include>$(with-srilm)/include/srilm <warnings>off ;
if $(with-maxent-srilm) {
lib lbfgs : : $(sri-lib) ;
obj MaxEntSRI.o : MaxEntSRI.cpp ..//headers : <include>$(with-srilm)/include <include>$(with-srilm)/lm/src <include>$(with-srilm)/include/srilm <warnings>off ;
2015-03-09 00:23:13 +03:00
alias sri : SRI.o MaxEntSRI.o ParallelBackoff.o lbfgs sri-libs : : : <define>LM_SRI <define>LM_MAXENT_SRI <linkflags>-fopenmp ;
dependencies += sri ;
lmmacros += LM_SRI ;
lmmacros += LM_MAXENT_SRI ;
} else {
2015-03-09 00:23:13 +03:00
alias sri : SRI.o ParallelBackoff.o sri-libs : : : <define>LM_SRI <linkflags>-fopenmp ;
dependencies += sri ;
lmmacros += LM_SRI ;
}
}
2012-03-20 18:45:16 +04:00
#RandLM
local with-randlm = [ option.get "with-randlm" ] ;
if $(with-randlm) {
lib RandLM : : <search>$(with-randlm)/lib <search>$(with-randlm)/lib64 ;
obj Rand.o : Rand.cpp RandLM ..//headers : <include>$(with-randlm)/include <include>$(with-randlm)/include/RandLM ;
alias rand : Rand.o RandLM : : : <define>LM_RAND ;
dependencies += rand ;
2013-07-19 01:54:52 +04:00
lmmacros += LM_RAND ;
}
# LDHTLM
local with-ldhtlm = [ option.get "with-ldhtlm" ] ;
if $(with-ldhtlm) {
lib LDHT : : <search>$(with-ldhtlm)/lib ;
lib ticpp : LDHT : <search>$(with-ldhtlm)/lib ;
obj LDHT.o : LDHT.cpp LDHT ..//headers : <include>$(with-ldhtlm)/include <include>$(with-ldhtlm)/include/LDHT ;
alias ldht : LDHT.o LDHT ticpp : : : <define>LM_LDHT ;
dependencies += ldht ;
2013-07-19 01:54:52 +04:00
lmmacros += LM_LDHT ;
}
2013-10-29 03:21:02 +04:00
#NPLM
local with-nplm = [ option.get "with-nplm" ] ;
if $(with-nplm) {
lib nplm : : <search>$(with-nplm)/lib <search>$(with-nplm)/lib64 ;
obj NeuralLMWrapper.o : NeuralLMWrapper.cpp nplm ..//headers : <include>$(with-nplm)/src <include>$(with-nplm)/3rdparty/eigen <define>NPLM_DOUBLE_PRECISION=0 ;
obj BiLM_NPLM.o : bilingual-lm/BiLM_NPLM.cpp nplm ..//headers : <include>$(with-nplm)/src <include>$(with-nplm)/3rdparty/eigen <cxxflags>-fopenmp <define>NPLM_DOUBLE_PRECISION=0 ;
obj RDLM.o : RDLM.cpp nplm ..//headers : <include>$(with-nplm)/src <include>$(with-nplm)/3rdparty/eigen <define>NPLM_DOUBLE_PRECISION=0 ;
2015-03-18 20:39:45 +03:00
alias neural : NeuralLMWrapper.o nplm : : : <cxxflags>-fopenmp <linkflags>-fopenmp <define>LM_NEURAL ;
alias bilinguallm : BiLM_NPLM.o nplm : : : <cxxflags>-fopenmp <linkflags>-fopenmp <define>LM_NEURAL ;
alias rdlm : RDLM.o nplm : : : <cxxflags>-fopenmp <linkflags>-fopenmp <define>LM_NEURAL ;
dependencies += neural ;
2015-03-18 20:39:45 +03:00
dependencies += bilinguallm ;
dependencies += rdlm ;
2013-10-29 03:21:02 +04:00
lmmacros += LM_NEURAL ;
}
2014-10-09 01:07:19 +04:00
#OxLM
local with-oxlm = [ option.get "with-oxlm" ] ;
if $(with-oxlm) {
lib lbl : : <search>$(with-oxlm)/lib <search>$(with-oxlm)/lib64 ;
lib murmurhash : : <search>$(with-oxlm)/lib <search>$(with-oxlm)/lib64 ;
obj OxLM.o : oxlm/OxLM.cpp lbl ..//headers : <include>$(with-oxlm)/src <include>$(with-oxlm)/third_party/eigen ;
obj SourceOxLM.o : oxlm/SourceOxLM.cpp lbl ..//headers : <include>$(with-oxlm)/src <include>$(with-oxlm)/third_party/eigen ;
2014-10-09 01:07:19 +04:00
obj OxLMMapper.o : oxlm/OxLMMapper.cpp lbl ..//headers : <include>$(with-oxlm)/src <include>$(with-oxlm)/third_party/eigen ;
2014-09-27 02:20:26 +04:00
obj OxLMParallelMapper.o : oxlm/OxLMParallelMapper.cpp lbl ..//headers : <include>$(with-oxlm)/src <include>$(with-oxlm)/third_party/eigen ;
alias oxlm : OxLM.o SourceOxLM.o OxLMMapper.o OxLMParallelMapper.o lbl murmurhash /top//boost_filesystem : : : <cxxflags>-std=c++0x <define>LM_OXLM ;
2014-10-09 01:07:19 +04:00
dependencies += oxlm ;
lmmacros += LM_OXLM ;
2014-07-10 19:14:22 +04:00
}
2014-07-15 18:26:50 +04:00
2013-11-11 18:39:53 +04:00
#DALM
local with-dalm = [ option.get "with-dalm" ] ;
if $(with-dalm) {
2013-11-21 23:19:34 +04:00
lib dalm : : <search>$(with-dalm)/lib ;
2014-02-07 10:04:35 +04:00
if [ path.exists $(with-dalm)/lib/libMurmurHash3.a ] {
lib MurmurHash3 : : <search>$(with-dalm)/lib ;
alias dalm-libs : dalm MurmurHash3 ;
} else {
alias dalm-libs : dalm ;
}
obj DALM.o : DALMWrapper.cpp dalm-libs ..//headers : <include>$(with-dalm)/include <include>$(with-dalm)/darts-clone ;
alias dalmALIAS : DALM.o dalm-libs : : : <define>LM_DALM ;
2013-11-11 22:27:15 +04:00
dependencies += dalmALIAS ;
lmmacros += LM_DALM ;
2013-11-11 18:39:53 +04:00
}
2012-03-20 18:45:16 +04:00
#ORLM is always compiled but needs special headers
2015-08-17 20:11:04 +03:00
#obj ORLM.o : ORLM.cpp ..//headers ../TranslationModel/DynSAInclude//dynsa : : : <include>../TranslationModel/DynSAInclude ;
2012-03-20 18:45:16 +04:00
#Top-level LM library. If you've added a file that doesn't depend on external
#libraries, put it here.
2017-04-26 15:10:32 +03:00
alias LM : Backward.cpp BackwardLMState.cpp Base.cpp BilingualLM.cpp Implementation.cpp InMemoryPerSentenceOnDemandLM.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp ExampleLM.cpp
2012-11-12 23:56:18 +04:00
../../lm//kenlm ..//headers $(dependencies) ;
2013-07-19 21:50:12 +04:00
alias macros : : : : <define>$(lmmacros) ;
#Unit test for Backward LM
import testing ;
run BackwardTest.cpp ..//moses LM ../../lm//kenlm /top//boost_unit_test_framework : : backward.arpa ;
2013-10-01 16:57:47 +04:00