-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
100 lines (81 loc) · 2.05 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 3.7)
project(fstalign LANGUAGES CXX C)
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
enable_testing()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(DEFINED ENV{OPENFST_ROOT})
set(OPENFST_ROOT $ENV{OPENFST_ROOT} CACHE STRING "Path to OpenFST")
endif()
message(STATUS "OpenFST root: ${OPENFST_ROOT}")
set(FSTALIGN_INCLUDES
${PROJECT_SOURCE_DIR}/third-party/spdlog/include
${PROJECT_SOURCE_DIR}/third-party/CLI11/include
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/third-party
${PROJECT_SOURCE_DIR}/third-party/inih
${PROJECT_SOURCE_DIR}/third-party/inih/cpp
)
find_package(Threads REQUIRED)
set(FSTALIGN_LIBRARIES
jsoncpp_lib_static
${PROJECT_SOURCE_DIR}/third-party/inih/ini.c
)
set(OPENFST_INCLUDES
${OPENFST_ROOT}/include
)
if(DYNAMIC_OPENFST)
set(OPENFST_LIBRARIES
${OPENFST_ROOT}/lib/libfst.so
)
else()
set(OPENFST_LIBRARIES
${OPENFST_ROOT}/lib/libfst.a -ldl
)
endif()
add_library(fstaligner-common
src/fstalign.cpp
src/wer.cpp
src/fast-d.cpp
src/AdaptedComposition.cpp
src/StandardComposition.cpp
src/AlignmentTraversor.cpp
src/Ctm.cpp
src/FstLoader.cpp
src/FstFileLoader.cpp
src/logging.cpp
src/Nlp.cpp
src/OneBestFstLoader.cpp
src/PathHeap.cpp
src/SynonymEngine.cpp
src/utilities.cpp
src/Walker.cpp
third-party/inih/cpp/INIReader.cpp
)
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/icu4c") # for Mac users
find_package(ICU REQUIRED COMPONENTS uc)
target_link_libraries(fstaligner-common
Threads::Threads
${FSTALIGN_LIBRARIES}
${FST_KALDI_LIBRARIES}
${ICU_LIBRARIES}
)
add_subdirectory(third-party/jsoncpp)
add_subdirectory(third-party/catch2)
add_executable(fstalign src/main.cpp)
include_directories(fstalign
${FSTALIGN_INCLUDES}
${OPENFST_INCLUDES}
${ICU_INCLUDE_DIRS}
)
target_link_libraries(fstalign
fstaligner-common
${CMAKE_DL_LIBS}
${FSTALIGN_LIBRARIES}
${OPENFST_LIBRARIES}
)
add_subdirectory(test)