summaryrefslogtreecommitdiff
path: root/mteval
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2015-03-03 01:14:07 -0500
committerChris Dyer <redpony@gmail.com>2015-03-03 01:14:07 -0500
commit6cbdccb1d9a62b2723b962ba4b6e66f1631e48d3 (patch)
tree686d2e294f8a69cad620fced60106fcb1f6cac8e /mteval
parent24cee877f2bb4b490495ea578564d0266b1addd3 (diff)
migration to cmake
Diffstat (limited to 'mteval')
-rw-r--r--mteval/CMakeLists.txt68
-rw-r--r--mteval/Makefile.am52
-rw-r--r--mteval/ns.cc6
3 files changed, 72 insertions, 54 deletions
diff --git a/mteval/CMakeLists.txt b/mteval/CMakeLists.txt
new file mode 100644
index 00000000..8217c116
--- /dev/null
+++ b/mteval/CMakeLists.txt
@@ -0,0 +1,68 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
+
+set(fast_score_SRCS fast_score.cc)
+add_executable(fast_score ${fast_score_SRCS})
+target_link_libraries(fast_score mteval utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+set(mbr_kbest_SRCS mbr_kbest.cc)
+add_executable(mbr_kbest ${mbr_kbest_SRCS})
+target_link_libraries(mbr_kbest mteval utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+set(TEST_SRCS scorer_test.cc)
+
+foreach(testSrc ${TEST_SRCS})
+ #Extract the filename without an extension (NAME_WE)
+ get_filename_component(testName ${testSrc} NAME_WE)
+
+ #Add compile target
+ set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
+ add_executable(${testName} ${testSrc})
+
+ #link to Boost libraries AND your targets and dependencies
+ target_link_libraries(${testName} mteval utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
+
+ #I like to move testing binaries into a testBin directory
+ set_target_properties(${testName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ #Finally add it to test execution -
+ #Notice the WORKING_DIRECTORY and COMMAND
+ add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach(testSrc)
+
+
+
+set(mteval_STAT_SRCS
+ aer_scorer.h
+ comb_scorer.h
+ external_scorer.h
+ levenshtein.h
+ ns.h
+ ns_cer.h
+ ns_comb.h
+ ns_docscorer.h
+ ns_ext.h
+ ns_ssk.h
+ ns_ter.h
+ ns_wer.h
+ scorer.h
+ ter.h
+ aer_scorer.cc
+ comb_scorer.cc
+ external_scorer.cc
+ meteor_jar.cc
+ ns.cc
+ ns_cer.cc
+ ns_comb.cc
+ ns_docscorer.cc
+ ns_ext.cc
+ ns_ssk.cc
+ ns_ter.cc
+ ns_wer.cc
+ scorer.cc
+ ter.cc)
+
+add_library(mteval STATIC ${mteval_STAT_SRCS})
+
+
diff --git a/mteval/Makefile.am b/mteval/Makefile.am
deleted file mode 100644
index aac3e6b5..00000000
--- a/mteval/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-bin_PROGRAMS = \
- fast_score \
- mbr_kbest
-
-noinst_PROGRAMS = \
- scorer_test
-TESTS = scorer_test
-
-noinst_LIBRARIES = libmteval.a
-
-EXTRA_DIST = test_data
-
-libmteval_a_SOURCES = \
- aer_scorer.h \
- comb_scorer.h \
- external_scorer.h \
- levenshtein.h \
- ns.h \
- ns_cer.h \
- ns_comb.h \
- ns_docscorer.h \
- ns_ext.h \
- ns_ssk.h \
- ns_ter.h \
- ns_wer.h \
- scorer.h \
- ter.h \
- aer_scorer.cc \
- comb_scorer.cc \
- external_scorer.cc \
- meteor_jar.cc \
- ns.cc \
- ns_cer.cc \
- ns_comb.cc \
- ns_docscorer.cc \
- ns_ext.cc \
- ns_ssk.cc \
- ns_ter.cc \
- ns_wer.cc \
- scorer.cc \
- ter.cc
-
-fast_score_SOURCES = fast_score.cc
-fast_score_LDADD = libmteval.a ../utils/libutils.a
-
-mbr_kbest_SOURCES = mbr_kbest.cc
-mbr_kbest_LDADD = libmteval.a ../utils/libutils.a
-
-scorer_test_SOURCES = scorer_test.cc
-scorer_test_LDADD = libmteval.a ../utils/libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS)
-
-AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/mteval/test_data\" -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/utils -I$(top_srcdir)/klm
diff --git a/mteval/ns.cc b/mteval/ns.cc
index 075e0121..2c8bd806 100644
--- a/mteval/ns.cc
+++ b/mteval/ns.cc
@@ -13,6 +13,8 @@
#include <iostream>
#include <sstream>
+#include "config.h"
+
#include "tdict.h"
#include "filelib.h"
#include "stringlib.h"
@@ -272,14 +274,14 @@ EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) {
} else if (metric_id == "TER") {
m = new TERMetric;
} else if (metric_id == "METEOR") {
-#if HAVE_METEOR
+#ifdef METEOR_JAR
if (!FileExists(meteor_jar_path)) {
cerr << meteor_jar_path << " not found!\n";
abort();
}
m = new ExternalMetric("METEOR", string("java -Xmx1536m -jar ") + meteor_jar_path + " - - -mira -lower -t tune -l en");
#else
- cerr << "cdec was not built with the --with-meteor option." << endl;
+ cerr << "cdec was not built with the -DMETEOR_JAR=/path/to/meteor.jar option." << endl;
abort();
#endif
} else if (metric_id.find("COMB:") == 0) {