diff options
Diffstat (limited to 'klm')
-rwxr-xr-x | klm/clean.sh | 2 | ||||
-rwxr-xr-x | klm/compile.sh | 11 | ||||
-rwxr-xr-x | klm/test.sh | 6 | ||||
-rw-r--r-- | klm/util/string_piece.hh | 6 |
4 files changed, 13 insertions, 12 deletions
diff --git a/klm/clean.sh b/klm/clean.sh index 685a2340..e8c6dbde 100755 --- a/klm/clean.sh +++ b/klm/clean.sh @@ -1,2 +1,2 @@ #!/bin/bash -rm */*.o query build_binary */*_test +rm -rf */*.o query build_binary */*_test lm/test.binary* lm/test.arpa?????? util/file_piece.cc.gz diff --git a/klm/compile.sh b/klm/compile.sh index d16dbe66..49e04db8 100755 --- a/klm/compile.sh +++ b/klm/compile.sh @@ -1,11 +1,14 @@ #!/bin/bash #This is just an example compilation. You should integrate these files into your build system. I can provide boost jam if you want. #If your code uses ICU, edit util/string_piece.hh and uncomment #define USE_ICU +#I use zlib by default. If you don't want to depend on zlib, remove #define USE_ZLIB from util/file_piece.hh + +#don't need to use if compiling with moses Makefiles already set -e -for i in util/{ersatz_progress,exception,file_piece,murmur_hash,scoped,string_piece,mmap} lm/{exception,virtual_interface,ngram}; do - g++ -I. -O3 -c $i.cc -o $i.o +for i in util/{bit_packing,ersatz_progress,exception,file_piece,murmur_hash,scoped,mmap} lm/{binary_format,config,lm_exception,model,read_arpa,search_hashed,search_trie,trie,virtual_interface,vocab}; do + g++ -I. -O3 $CXXFLAGS -c $i.cc -o $i.o done -g++ -I. -O3 lm/ngram_build_binary.cc {lm,util}/*.o -o build_binary -g++ -I. -O3 lm/ngram_query.cc {lm,util}/*.o -o query +g++ -I. -O3 $CXXFLAGS lm/build_binary.cc {lm,util}/*.o -lz -o build_binary +g++ -I. -O3 $CXXFLAGS lm/ngram_query.cc {lm,util}/*.o -lz -o query diff --git a/klm/test.sh b/klm/test.sh index b741cdf0..d02a3dc9 100755 --- a/klm/test.sh +++ b/klm/test.sh @@ -2,7 +2,7 @@ #Run tests. Requires Boost. set -e ./compile.sh -for i in util/{file_piece,joint_sort,key_value_packing,probing_hash_table,sorted_uniform}_test lm/ngram_test; do - g++ -I. -O3 $i.cc {lm,util}/*.o -lboost_test_exec_monitor -o $i - pushd $(dirname $i) && ./$(basename $i); popd +for i in util/{bit_packing,file_piece,joint_sort,key_value_packing,probing_hash_table,sorted_uniform}_test lm/model_test; do + g++ -I. -O3 $CXXFLAGS $i.cc {lm,util}/*.o -lboost_test_exec_monitor -lz -o $i + pushd $(dirname $i) >/dev/null && ./$(basename $i) || echo "$i failed"; popd >/dev/null done diff --git a/klm/util/string_piece.hh b/klm/util/string_piece.hh index 2583db5e..e5b16e38 100644 --- a/klm/util/string_piece.hh +++ b/klm/util/string_piece.hh @@ -48,10 +48,7 @@ #ifndef BASE_STRING_PIECE_H__ #define BASE_STRING_PIECE_H__ -//Uncomment this line if you use ICU in your code. -//#define HAVE_ICU -//Uncomment this line if you want boost hashing for your StringPieces. -//#define HAVE_BOOST +#include "util/have.hh" #ifdef HAVE_BOOST #include <boost/functional/hash/hash.hpp> @@ -67,6 +64,7 @@ U_NAMESPACE_BEGIN #else #include <algorithm> +#include <cstddef> #include <string> #include <string.h> |