summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILDING34
-rw-r--r--CMakeLists.txt32
-rw-r--r--README.md9
-rw-r--r--cmake/FindEigen3.cmake81
-rw-r--r--config.h.cmake1
-rw-r--r--decoder/CMakeLists.txt1
-rw-r--r--training/dpmert/CMakeLists.txt8
-rw-r--r--training/dtrain/CMakeLists.txt11
-rw-r--r--training/mira/CMakeLists.txt4
-rw-r--r--training/pro/CMakeLists.txt8
10 files changed, 157 insertions, 32 deletions
diff --git a/BUILDING b/BUILDING
index d5a086e8..055c6f82 100644
--- a/BUILDING
+++ b/BUILDING
@@ -1,36 +1,28 @@
To build cdec, you'll need:
* boost headers & boost program_options (you may need to install a package
- like boost-devel)
+ like libboost-dev)
Instructions for building
-----------------------------------
- 1) Use automake / autoconf to generate the configure script.
- I'm not an expert at using these tools, but this should be sufficient:
+ 1) Create a build directory and generate Makefiles using CMake
- autoreconf -ifv
+ mkdir build
+ cd build
+ cmake ..
+
+ If the cmake command completes successfully, you can proceed. If you have
+ libraries (such as Boost) installed in nonstandard locations, you may need
+ to run cmake with special options like -DBOOST_ROOT=/path/to/boost.
- 2) Configure and build. Your command will look something like this.
-
- ./configure
- make
-
- If you get errors during configure about missing BOOST macros, then step 3
- failed, and you need to keep working at it. If you get errors during the
- build, it's probably a problem with step 3 or possibly with some compiler
- version idiosyncracies (generally, I assume you have a relatively new
- of g++).
-
- If you're building on cygwin, their libtool is buggy; this make command
- works for now:
-
- make LIBS+="-lz -lboost_program_options" \
- CFLAGS+="-Wno-sign-compare"
+ 2) Build
+ make -j 2
+
3) Test
-
+ make test
./tests/run-system-tests.pl
Everything should pass.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89275948..06d82061 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8)
+project(cdec)
add_definitions(-DKENLM_MAX_ORDER=6 -DHAVE_CONFIG_H)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
@@ -7,8 +8,21 @@ set(METEOR_JAR "" CACHE FILEPATH "Path to meteor.jar")
enable_testing()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
-#### packages
+# core packages
+find_package(LibDL REQUIRED)
+find_package(Boost COMPONENTS regex filesystem serialization program_options unit_test_framework system thread REQUIRED)
+include_directories(${Boost_INCLUDE_DIR})
+
+# eigen, used in some modeling extensions
+find_package(Eigen3)
+if(EIGEN3_FOUND)
+ include_directories(${EIGEN3_INCLUDE_DIR})
+ set(HAVE_EIGEN 1)
+endif(EIGEN3_FOUND)
+
+# compression packages (primarily used by KenLM)
find_package(ZLIB REQUIRED)
if(ZLIB_FOUND)
set(HAVE_ZLIB 1)
@@ -22,14 +36,10 @@ if(LIBLZMA_FOUND)
set(HAVE_XZLIB 1)
endif(LIBLZMA_FOUND)
-find_package(LibDL REQUIRED)
-
# for pycdec
find_package(PythonInterp 2.7 REQUIRED)
-find_package(Boost COMPONENTS regex filesystem serialization program_options unit_test_framework system thread REQUIRED)
-include_directories(${Boost_INCLUDE_DIR})
-
+# generate config.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_subdirectory(utils)
@@ -46,3 +56,13 @@ add_subdirectory(word-aligner)
add_subdirectory(extractor)
add_subdirectory(example_extff)
+set(CPACK_PACKAGE_VERSION_MAJOR "2015")
+set(CPACK_PACKAGE_VERSION_MINOR "04")
+set(CPACK_PACKAGE_VERSION_PATCH "26")
+set(CPACK_SOURCE_GENERATOR "TBZ2")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME
+ "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+set(CPACK_SOURCE_IGNORE_FILES
+ "/.git/;/.gitignore;/Testing/;/build/;/.bzr/;~$;/CMakeCache.txt;/CMakeFiles/;${CPACK_SOURCE_IGNORE_FILES}")
+include(CPack)
+
diff --git a/README.md b/README.md
index 413eddac..25190b33 100644
--- a/README.md
+++ b/README.md
@@ -10,17 +10,16 @@
- You may need to build your own C++ compiler or upgrade your operating system's.
- [Boost C++ libraries (version 1.44 or later)](http://www.boost.org/)
- If you build your own boost, you _must install it_ using `bjam install` (to install it into a customized location use `--prefix=/path/to/target`).
- - Older versions of Boost _may_ work, but problems have been reported with command line option parsing on some platforms with older versions.
- [GNU Flex](http://flex.sourceforge.net/)
- [cmake](http://www.cmake.org/) - <font color="red"><b>(NEW)</b></font>
-## Building the software from a git clone
-
-In addition to the standard `cdec` third party software requirements, you will additionally need the following software to work with the `cdec` source code directly from git:
+## Building the software
Build instructions:
- cmake .
+ mkdir build
+ cd build
+ cmake ..
make -j4
make test
./tests/run-system-tests.pl
diff --git a/cmake/FindEigen3.cmake b/cmake/FindEigen3.cmake
new file mode 100644
index 00000000..9c546a05
--- /dev/null
+++ b/cmake/FindEigen3.cmake
@@ -0,0 +1,81 @@
+# - Try to find Eigen3 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+# find_package(Eigen3 3.1.2)
+# to require version 3.1.2 or newer of Eigen3.
+#
+# Once done this will define
+#
+# EIGEN3_FOUND - system has eigen lib with correct version
+# EIGEN3_INCLUDE_DIR - the eigen include directory
+# EIGEN3_VERSION - eigen version
+
+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+if(NOT Eigen3_FIND_VERSION)
+ if(NOT Eigen3_FIND_VERSION_MAJOR)
+ set(Eigen3_FIND_VERSION_MAJOR 2)
+ endif(NOT Eigen3_FIND_VERSION_MAJOR)
+ if(NOT Eigen3_FIND_VERSION_MINOR)
+ set(Eigen3_FIND_VERSION_MINOR 91)
+ endif(NOT Eigen3_FIND_VERSION_MINOR)
+ if(NOT Eigen3_FIND_VERSION_PATCH)
+ set(Eigen3_FIND_VERSION_PATCH 0)
+ endif(NOT Eigen3_FIND_VERSION_PATCH)
+
+ set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
+endif(NOT Eigen3_FIND_VERSION)
+
+macro(_eigen3_check_version)
+ file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
+
+ string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+ set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+ set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
+ set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
+
+ set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
+ if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+ set(EIGEN3_VERSION_OK FALSE)
+ else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+ set(EIGEN3_VERSION_OK TRUE)
+ endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+
+ if(NOT EIGEN3_VERSION_OK)
+
+ message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
+ "but at least version ${Eigen3_FIND_VERSION} is required")
+ endif(NOT EIGEN3_VERSION_OK)
+endmacro(_eigen3_check_version)
+
+if (EIGEN3_INCLUDE_DIR)
+
+ # in cache already
+ _eigen3_check_version()
+ set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+
+else (EIGEN3_INCLUDE_DIR)
+
+ find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include
+ ${KDE4_INCLUDE_DIR}
+ PATH_SUFFIXES eigen3 eigen
+ )
+
+ if(EIGEN3_INCLUDE_DIR)
+ _eigen3_check_version()
+ endif(EIGEN3_INCLUDE_DIR)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
+
+ mark_as_advanced(EIGEN3_INCLUDE_DIR)
+
+endif(EIGEN3_INCLUDE_DIR)
+
diff --git a/config.h.cmake b/config.h.cmake
index 6f270a60..a37f6388 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -5,5 +5,6 @@
#cmakedefine HAVE_ZLIB @HAVE_ZLIB@
#cmakedefine HAVE_BZLIB @HAVE_BZLIB@
#cmakedefine HAVE_XZLIB @HAVE_XZLIB@
+#cmakedefine HAVE_EIGEN @HAVE_EIGEN@
#endif // CONFIG_H
diff --git a/decoder/CMakeLists.txt b/decoder/CMakeLists.txt
index ad800588..07d85b9a 100644
--- a/decoder/CMakeLists.txt
+++ b/decoder/CMakeLists.txt
@@ -1,3 +1,4 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mteval)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../klm)
diff --git a/training/dpmert/CMakeLists.txt b/training/dpmert/CMakeLists.txt
index 382af070..6250ca43 100644
--- a/training/dpmert/CMakeLists.txt
+++ b/training/dpmert/CMakeLists.txt
@@ -28,6 +28,14 @@ set(mr_dpmert_reduce_SRCS
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)
+add_custom_command(TARGET mr_dpmert_reduce
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/dpmert.pl ${CMAKE_CURRENT_BINARY_DIR})
+
+add_custom_command(TARGET mr_dpmert_reduce
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/divide_refs.py ${CMAKE_CURRENT_BINARY_DIR})
+
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})
diff --git a/training/dtrain/CMakeLists.txt b/training/dtrain/CMakeLists.txt
index 8423675f..027c80e4 100644
--- a/training/dtrain/CMakeLists.txt
+++ b/training/dtrain/CMakeLists.txt
@@ -13,3 +13,14 @@ set(dtrain_SRCS
score.h)
add_executable(dtrain ${dtrain_SRCS})
target_link_libraries(dtrain libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${LIBLZMA_LIBRARIES} ${LIBDL_LIBRARIES})
+
+
+add_custom_command(TARGET dtrain
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/lplp.rb ${CMAKE_CURRENT_BINARY_DIR})
+
+add_custom_command(TARGET dtrain
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/parallelize.rb ${CMAKE_CURRENT_BINARY_DIR})
+
+
diff --git a/training/mira/CMakeLists.txt b/training/mira/CMakeLists.txt
index 55ca03e2..0d22f134 100644
--- a/training/mira/CMakeLists.txt
+++ b/training/mira/CMakeLists.txt
@@ -11,6 +11,10 @@ set(kbest_cut_mira_SRCS kbest_cut_mira.cc)
add_executable(kbest_cut_mira ${kbest_cut_mira_SRCS})
target_link_libraries(kbest_cut_mira libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${LIBLZMA_LIBRARIES} ${LIBDL_LIBRARIES})
+add_custom_command(TARGET kbest_cut_mira
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/mira.py ${CMAKE_CURRENT_BINARY_DIR}/mira.py)
+
set(ada_opt_sm_SRCS ada_opt_sm.cc)
add_executable(ada_opt_sm ${ada_opt_sm_SRCS})
target_link_libraries(ada_opt_sm training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${LIBLZMA_LIBRARIES} ${LIBDL_LIBRARIES})
diff --git a/training/pro/CMakeLists.txt b/training/pro/CMakeLists.txt
index 5ee09a74..5be1ab39 100644
--- a/training/pro/CMakeLists.txt
+++ b/training/pro/CMakeLists.txt
@@ -10,6 +10,14 @@ set(mr_pro_map_SRCS mr_pro_map.cc)
add_executable(mr_pro_map ${mr_pro_map_SRCS})
target_link_libraries(mr_pro_map training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
+add_custom_command(TARGET mr_pro_map
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/mr_pro_generate_mapper_input.pl ${CMAKE_CURRENT_BINARY_DIR})
+
+add_custom_command(TARGET mr_pro_map
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/pro.pl ${CMAKE_CURRENT_BINARY_DIR})
+
########### next target ###############
set(mr_pro_reduce_SRCS mr_pro_reduce.cc)