mosesdecoder/Jamroot

346 lines
11 KiB
Plaintext
Raw Normal View History

2011-11-25 21:30:36 +04:00
#BUILDING MOSES
2011-11-25 21:30:36 +04:00
#PACKAGES
#Language models (optional):
2011-11-25 15:55:36 +04:00
#--with-irstlm=/path/to/irstlm
2012-11-12 23:56:18 +04:00
#--with-srilm=/path/to/srilm See moses/LM/Jamfile for more options.
#--with-maxent-srilm=true (requires a maxent-enabled version of SRILM to be specified via --with-srilm)
#--with-nplm=/path/to/nplm
#--with-randlm=/path/to/randlm
#KenLM is always compiled.
#
2011-11-25 15:55:36 +04:00
#--with-boost=/path/to/boost
#If Boost is in a non-standard location, specify it here. This directory is
#expected to contain include and lib or lib64.
#
2011-11-21 21:19:24 +04:00
#--with-xmlrpc-c=/path/to/xmlrpc-c for libxmlrpc-c (used by server)
#Note that, like language models, this is the --prefix where the library was
#installed, not some executable within the library.
#
2015-10-01 19:33:45 +03:00
#--no-xmlrpc-c
# Don't use xmlrpc-c library, even if it exists. Don't build moses server
#
2012-08-05 00:49:42 +04:00
#Compact phrase table and compact lexical reordering table
#--with-cmph=/path/to/cmph
#
#Thread-caching malloc (if present, used for multi-threaded builds by default)
#--without-tcmalloc does not compile with tcmalloc even if present
#--full-tcmalloc links against the full version (useful for memory profiling)
2011-11-21 21:19:24 +04:00
#
#REGRESSION TESTING
#--with-regtest=/path/to/moses-reg-test-data
#
2011-11-25 20:53:02 +04:00
#INSTALLATION
2012-05-31 15:55:05 +04:00
#--prefix=/path/to/prefix sets the install prefix [default is source root].
2011-11-28 16:01:33 +04:00
#--bindir=/path/to/prefix/bin sets the bin directory [PREFIX/bin]
#--libdir=/path/to/prefix/lib sets the lib directory [PREFIX/lib]
2012-02-13 23:31:37 +04:00
#--includedir=/path/to/prefix/include installs headers.
# Does not install if missing. No argument defaults to PREFIX/include .
2011-11-25 20:53:02 +04:00
#--install-scripts=/path/to/scripts copies scripts into a directory.
# Does not install if missing. No argument defaults to PREFIX/scripts .
2011-11-28 16:01:33 +04:00
#--git appends the git revision to the prefix directory.
2011-11-21 21:19:24 +04:00
#
2011-11-25 21:30:36 +04:00
#
#BUILD OPTIONS
2011-11-23 15:29:42 +04:00
# By default, the build is multi-threaded, optimized, and statically linked.
# Pass these to change the build:
#
2011-11-23 15:29:42 +04:00
# threading=single|multi controls threading (default multi)
#
2011-11-23 15:29:42 +04:00
# variant=release|debug|profile builds optimized (default), for debug, or for
# profiling
#
# link=static|shared controls preferred linking (default static)
# --static forces static linking (the default will fall
# back to shared)
2011-11-23 15:29:42 +04:00
#
2015-10-05 02:05:38 +03:00
# debug-symbols=on|off include or exclude (default) debugging
2011-11-23 15:29:42 +04:00
# information also known as -g
2011-11-25 22:09:07 +04:00
# --notrace compiles without TRACE macros
2011-11-25 21:30:36 +04:00
#
# --enable-boost-pool uses Boost pools for the memory SCFG tabgle
2011-11-27 20:53:40 +04:00
#
2011-12-16 01:54:56 +04:00
# --enable-mpi switch on mpi
# --without-libsegfault does not link with libSegFault
#
# --max-kenlm-order maximum ngram order that kenlm can process (default 6)
2011-11-23 15:29:42 +04:00
#
# --max-factors maximum number of factors (default 4)
#
# --unlabelled-source ignore source labels (redundant in hiero or string-to-tree system)
# for better performance
2011-11-25 21:30:36 +04:00
#CONTROLLING THE BUILD
2011-11-21 21:19:24 +04:00
#-a to build from scratch
#-j$NCPUS to compile in parallel
2011-11-23 15:29:42 +04:00
#--clean to clean
#--debug-build to build with Og. Only available with gcc 4.8+
2015-03-26 15:21:55 +03:00
import os ;
2011-12-05 15:09:48 +04:00
import option ;
import modules ;
2012-03-31 03:57:05 +04:00
import path ;
path-constant TOP : . ;
2015-03-26 15:21:55 +03:00
include $(TOP)/jam-files/sanity.jam ;
2015-03-26 15:21:55 +03:00
home = [ os.environ "HOME" ] ;
if [ path.exists $(home)/moses-environment.jam ]
{
# for those of use who don't like typing in command line bjam options all day long
include $(home)/moses-environment.jam ;
}
2015-03-26 15:21:55 +03:00
include $(TOP)/jam-files/check-environment.jam ; # get resource locations
# from environment variables
include $(TOP)/jam-files/xmlrpc-c.jam ; # xmlrpc-c stuff for the server
# include $(TOP)/jam-files/curlpp.jam ; # curlpp stuff for bias lookup (MMT only)
2015-03-26 15:21:55 +03:00
# exit "done" : 0 ;
2015-03-26 15:21:55 +03:00
max-order = [ option.get "max-kenlm-order" : 6 : 6 ] ;
if ! [ option.get "max-kenlm-order" ]
{
2015-03-26 15:21:55 +03:00
# some classes in Moses pull in header files from KenLM, so this needs to be
# defined here, not in moses/lm/Jamfile
option.set "max-kenlm-order" : 6 ;
requirements += <define>KENLM_MAX_ORDER=$(max-order) ;
}
2015-03-26 15:21:55 +03:00
# exit "all done" : 0 ;
boost 104400 ;
external-lib z ;
2013-09-12 12:17:18 +04:00
#lib dl : : <runtime-link>static:<link>static <runtime-link>shared:<link>shared ;
#requirements += <library>dl ;
2017-01-10 19:31:33 +03:00
requirements += <cxxflags>-std=c++0x ;
# Allow moses to report the git commit hash of the version used for compilation
moses_githash = [ _shell "git describe --dirty" ] ;
requirements += <define>MOSES_VERSION_ID=\\\"$(moses_githash)\\\" ;
if ! [ option.get "without-tcmalloc" : : "yes" ] && [ test_library "tcmalloc_minimal" ] {
if [ option.get "full-tcmalloc" : : "yes" ] {
2013-08-21 17:29:00 +04:00
external-lib unwind ;
2013-08-22 13:16:12 +04:00
external-lib tcmalloc_and_profiler : : unwind ;
requirements += <library>tcmalloc_and_profiler <library>unwind <cflags>-fno-omit-frame-pointer <cxxflags>-fno-omit-frame-pointer ;
} else {
2013-08-21 17:29:00 +04:00
external-lib tcmalloc_minimal ;
2014-03-01 11:42:32 +04:00
requirements += <threading>multi:<library>tcmalloc_minimal ;
}
} else {
echo "Tip: install tcmalloc for faster threading. See BUILD-INSTRUCTIONS.txt for more information." ;
}
if [ option.get "filter-warnings" : : "yes" ] {
# given the low coding standards in Moses, we may want to filter out
# warnings about poor coding practice that no-one is ever going to fix
# anyway ...
requirements += <cxxflags>-Wno-deprecated ;
requirements += <cxxflags>-Wno-reorder ;
requirements += <cxxflags>-Wno-sign-compare ;
requirements += <cxxflags>-Wno-unused-but-set-variable ;
requirements += <cxxflags>-Wno-unused-result ;
requirements += <cxxflags>-Wno-unused-variable ;
requirements += <cxxflags>-Wno-comment ;
requirements += <cxxflags>-Wno-strict-aliasing ;
requirements += <cxxflags>-Wno-overloaded-virtual ;
}
if [ option.get "debug-build" : : "yes" ] {
requirements += <cxxflags>-Og ;
echo "Building with -Og to enable easier profiling and debugging. Only available on gcc 4.8+." ;
}
if [ option.get "with-address-sanitizer" : : "yes" ] {
requirements += <cxxflags>-fsanitize=address ;
requirements += <cxxflags>-fno-omit-frame-pointer ;
requirements += <linkflags>-fsanitize=address ;
echo "Building with AddressSanitizer to enable debugging of memory errors. Only available on gcc 4.8+." ;
}
2011-12-16 01:54:56 +04:00
if [ option.get "enable-mpi" : : "yes" ] {
import mpi ;
using mpi ;
2012-06-07 03:26:22 +04:00
external-lib boost_mpi ;
external-lib boost_serialization ;
2011-12-16 01:54:56 +04:00
requirements += <define>MPI_ENABLE ;
requirements += <library>mpi ;
requirements += <library>boost_mpi ;
requirements += <library>boost_serialization ;
}
2015-09-04 02:00:31 +03:00
mmt = [ option.get "mmt" ] ;
if $(mmt) {
requirements += <define>MMT ;
requirements += <include>$(mmt) ;
mmt_githash = [ _shell "cd $(mmt) && git describe --dirty" ] ;
requirements += <define>MMT_VERSION_ID=\\\"$(mmt_githash)\\\" ;
2015-09-04 02:00:31 +03:00
}
requirements += [ option.get "notrace" : <define>TRACE_ENABLE=1 ] ;
requirements += [ option.get "enable-boost-pool" : : <define>USE_BOOST_POOL ] ;
2014-02-08 22:18:45 +04:00
requirements += [ option.get "with-mm" : : <define>PT_UG ] ;
requirements += [ option.get "with-mm" : : <define>MAX_NUM_FACTORS=4 ] ;
requirements += [ option.get "unlabelled-source" : : <define>UNLABELLED_SOURCE ] ;
2011-11-28 13:35:46 +04:00
2014-10-09 01:07:19 +04:00
if [ option.get "with-oxlm" ] {
2014-07-15 18:26:50 +04:00
external-lib gomp ;
requirements += <library>boost_serialization ;
requirements += <library>gomp ;
}
if [ option.get "with-cmph" : : "yes" ] {
requirements += <define>HAVE_CMPH ;
}
if [ option.get "with-icu" : : "yes" ]
{
external-lib icuuc ;
external-lib icuio ;
external-lib icui18n ;
requirements += <library>icuuc/<link>shared ;
requirements += <library>icuio/<link>shared ;
requirements += <library>icui18n/<link>shared ;
requirements += <cxxflags>-fPIC ;
requirements += <address-model>64 ;
# requirements += <runtime-link>shared ;
}
2015-12-18 03:26:25 +03:00
# for probing pt
external-lib boost_serialization ;
requirements += <library>boost_serialization/<runtime-link>static ;
2014-01-23 00:57:06 +04:00
if [ option.get "with-vw" ] {
requirements += <define>HAVE_VW ;
}
project : default-build
<threading>multi
<warnings>on
<debug-symbols>off
<variant>release
<link>static
;
#Apparently OS X likes to link against iconv for fgetsUTF8.
lib iconv ;
2013-07-01 13:57:06 +04:00
requirements += <os>MACOSX:<library>iconv ;
project : requirements
<threading>multi:<define>WITH_THREADS
<threading>multi:<library>boost_thread
2013-07-25 18:56:20 +04:00
<library>boost_system
<library>boost_program_options
<define>_FILE_OFFSET_BITS=64 <define>_LARGE_FILES
$(requirements)
2012-11-14 17:43:04 +04:00
<include>.
;
#Add directories here if you want their incidental targets too (i.e. tests).
2015-01-08 15:37:34 +03:00
build-projects lm util phrase-extract phrase-extract/syntax-common search moses moses/LM mert moses-cmd scripts regression-testing ;
# contrib/mira
if [ option.get "with-mm-extras" : : "yes" ]
{
alias mm-extras :
2015-04-21 19:55:10 +03:00
moses/TranslationModel/UG//bitext-find
moses/TranslationModel/UG//ptable-describe-features
moses/TranslationModel/UG//count-ptable-features
moses/TranslationModel/UG//ptable-sigtest-filter
moses/TranslationModel/UG//ptable-lookup
moses/TranslationModel/UG//ptable-lookup-corpus
moses/TranslationModel/UG//check-coverage
moses/TranslationModel/UG/mm//mtt-demo1
moses/TranslationModel/UG/mm//mtt-dump
moses/TranslationModel/UG/mm//mam2symal
moses/TranslationModel/UG/mm//mam_verify
2014-03-20 00:41:29 +04:00
moses/TranslationModel/UG/mm//mmlex-lookup
2014-02-08 22:18:45 +04:00
moses/TranslationModel/UG/mm//mtt-count-words
2014-03-18 16:17:07 +04:00
moses/TranslationModel/UG/mm//calc-coverage
2014-02-21 03:56:45 +04:00
moses/TranslationModel/UG//try-align
;
}
else
{
alias mm-extras ;
}
if [ option.get "with-mm" : : "yes" ]
{
alias mm :
moses/TranslationModel/UG/mm//mtt-build
moses/TranslationModel/UG/mm//symal2mam
moses/TranslationModel/UG/mm//mmlex-build
;
}
else
{
alias mm ;
}
2014-10-21 18:10:50 +04:00
if [ option.get "with-rephraser" : : "yes" ]
{
alias rephraser :
contrib/rephraser//paraphrase
;
}
else
{
alias rephraser ;
}
2013-09-25 03:11:11 +04:00
alias programs :
lm//programs
moses-cmd//programs
OnDiskPt//CreateOnDiskPt
OnDiskPt//queryOnDiskPt
mert//programs
misc//programs
symal
phrase-extract
phrase-extract//lexical-reordering
phrase-extract//extract-ghkm
phrase-extract//pcfg-extract
phrase-extract//pcfg-score
2014-08-29 18:55:48 +04:00
phrase-extract//extract-mixed-syntax
phrase-extract//score-stsg
phrase-extract//filter-rule-table
phrase-extract//postprocess-egret-forests
2013-09-25 03:11:11 +04:00
biconcor
# contrib/mira//mira
2013-09-25 03:11:11 +04:00
contrib/server//mosesserver
mm
mm-extras
2014-10-21 18:10:50 +04:00
rephraser
2015-01-25 17:00:35 +03:00
contrib/c++tokenizer//tokenizer
2015-10-02 22:11:35 +03:00
contrib/expected-bleu-training//train-expected-bleu
contrib/expected-bleu-training//prepare-expected-bleu-training
2016-01-18 18:37:04 +03:00
2017-02-15 23:37:50 +03:00
probingpt//programs
2017-02-01 01:21:59 +03:00
moses2//programs
2013-09-25 03:11:11 +04:00
;
2011-11-28 16:01:33 +04:00
install-bin-libs programs ;
2014-10-10 18:09:56 +04:00
install-headers headers-base : [ path.glob-tree biconcor contrib lm mert misc moses-cmd OnDiskPt phrase-extract symal util : *.hh *.h ] : . ;
2012-11-12 23:56:18 +04:00
install-headers headers-moses : moses//headers-to-install : moses ;
2012-02-13 23:31:37 +04:00
alias install : prefix-bin prefix-lib headers-base headers-moses ;
2012-03-31 03:57:05 +04:00
if ! [ option.get "includedir" : : $(prefix)/include ] {
explicit install headers-base headers-moses ;
}
2012-06-01 03:13:01 +04:00
if [ path.exists $(TOP)/dist ] && $(prefix) != dist {
echo "You have a $(TOP)/dist directory, but the build system now places files directly in the root i.e. $(TOP)/bin ." ;
echo "To disable this message, delete $(TOP)/dist ." ;
echo ;
}
#local temp = [ _shell "bash source ./s.sh" ] ;
local temp = [ _shell "mkdir -p $(PREFIX)/bin" ] ;
local temp = [ _shell "rm -f $(PREFIX)/bin/moses_chart" ] ;
local temp = [ _shell "cd $(PREFIX)/bin && ln -sf moses moses_chart" ] ;
local temp = [ _shell "cd $(PREFIX)/bin && ln -sf CreateProbingPT CreateProbingPT2" ] ;
2016-10-06 15:31:18 +03:00