From 95183b5760d7f168ae093ae8f9b29740628a278f Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 3 Mar 2015 01:14:07 -0500 Subject: migration to cmake --- training/dpmert/CMakeLists.txt | 59 ++++++++++++++++++++++++++++++++++++++++++ training/dpmert/Makefile.am | 27 ------------------- training/dpmert/ces.h | 4 +-- 3 files changed, 61 insertions(+), 29 deletions(-) create mode 100644 training/dpmert/CMakeLists.txt delete mode 100644 training/dpmert/Makefile.am (limited to 'training/dpmert') diff --git a/training/dpmert/CMakeLists.txt b/training/dpmert/CMakeLists.txt new file mode 100644 index 00000000..382af070 --- /dev/null +++ b/training/dpmert/CMakeLists.txt @@ -0,0 +1,59 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(dpmert_SRCS + mert_geometry.cc + ces.cc + error_surface.cc + mr_dpmert_map.cc + line_optimizer.cc + ces.h + error_surface.h + line_optimizer.h + mert_geometry.h) +add_library(dpmert ${dpmert_SRCS}) + +set(mr_dpmert_map_SRCS mr_dpmert_map.cc) + +add_executable(mr_dpmert_map ${mr_dpmert_map_SRCS}) +target_link_libraries(mr_dpmert_map dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +########### next target ############### + +set(mr_dpmert_reduce_SRCS + mr_dpmert_reduce.cc) + +add_executable(mr_dpmert_reduce ${mr_dpmert_reduce_SRCS}) +target_link_libraries(mr_dpmert_reduce dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + +set(mr_dpmert_generate_mapper_input_SRCS mr_dpmert_generate_mapper_input.cc) +add_executable(mr_dpmert_generate_mapper_input ${mr_dpmert_generate_mapper_input_SRCS}) +target_link_libraries(mr_dpmert_generate_mapper_input dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +set(TEST_SRCS lo_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} dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${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) + + + diff --git a/training/dpmert/Makefile.am b/training/dpmert/Makefile.am deleted file mode 100644 index b85bb275..00000000 --- a/training/dpmert/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -bin_PROGRAMS = \ - mr_dpmert_map \ - mr_dpmert_reduce \ - mr_dpmert_generate_mapper_input - -noinst_PROGRAMS = \ - lo_test -TESTS = lo_test - -mr_dpmert_generate_mapper_input_SOURCES = mr_dpmert_generate_mapper_input.cc line_optimizer.cc -mr_dpmert_generate_mapper_input_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -# nbest2hg_SOURCES = nbest2hg.cc -# nbest2hg_LDADD = $(top_srcdir)/decoder/libcdec.a $(top_srcdir)/mteval/libmteval.a $(top_srcdir)/utils/libutils.a -lfst - -mr_dpmert_map_SOURCES = mert_geometry.cc ces.cc error_surface.cc mr_dpmert_map.cc line_optimizer.cc ces.h error_surface.h line_optimizer.h mert_geometry.h -mr_dpmert_map_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -mr_dpmert_reduce_SOURCES = error_surface.cc ces.cc mr_dpmert_reduce.cc line_optimizer.cc mert_geometry.cc ces.h error_surface.h line_optimizer.h mert_geometry.h -mr_dpmert_reduce_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -lo_test_SOURCES = lo_test.cc ces.cc mert_geometry.cc error_surface.cc line_optimizer.cc ces.h error_surface.h line_optimizer.h mert_geometry.h -lo_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -EXTRA_DIST = test_data dpmert.pl - -AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/training/dpmert/test_data\" -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval diff --git a/training/dpmert/ces.h b/training/dpmert/ces.h index e4fa2080..b179499d 100644 --- a/training/dpmert/ces.h +++ b/training/dpmert/ces.h @@ -1,9 +1,9 @@ #ifndef _CES_H_ #define _CES_H_ -class ConvexHull; +struct ConvexHull; class Hypergraph; -class SegmentEvaluator; +struct SegmentEvaluator; class ErrorSurface; class EvaluationMetric; -- cgit v1.2.3