CMakeLists.txt
6.63 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
########## libmaca ###############
PROJECT(maca)
if(NOT LIBMACA_SRC_DATA_DIR)
message(FATAL_ERROR "There is no data for libmaca")
endif(NOT LIBMACA_SRC_DATA_DIR)
set(LIBMACA_PATH_SEPARATOR ";")
set(LIBMACA_INSTALL_DATA_DIR share/maca)
set(LIBMACA_DATA_DIR ".;${CMAKE_INSTALL_PREFIX}/${LIBMACA_INSTALL_DATA_DIR}")
set(LIBMACA_VERSION "${maca_ver_major}.${maca_ver_minor}.${maca_ver_patch}")
configure_file(config_d.in include/libmaca/config_d.h)
configure_file(version.in include/libmaca/version.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
add_definitions(-DHAVE_CONFIG_D_H)
add_definitions(-DHAVE_VERSION_H)
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/include/ )
#include_directories("/usr/include/sfst-1.0")
#set(LIBS ${LIBS} "sfst1")
find_package(Toki 1.0.0 REQUIRED)
set(LIBS ${LIBS} ${Toki_LIBRARY})
find_package(Corpus2 1.0.9 REQUIRED)
set(LIBS ${LIBS} ${Corpus2_LIBRARY})
include_directories(${Corpus2_INCLUDE_DIR})
find_package(PwrUtils REQUIRED)
set(LIBS ${LIBS} ${PwrUtils_LIBRARY})
find_package(ICU REQUIRED QUIET)
include_directories(${ICU_INCLUDE_DIR})
link_directories(${ICU_LIBRARY_DIRS})
if(UNIX)
set(LIBS ${LIBS} icuuc icuio)
else(UNIX)
set(LIBS ${LIBS} icuuc icuio icutu icuin)
endif(UNIX)
find_package(Loki REQUIRED QUIET)
find_package(LibXML++ REQUIRED QUIET)
include_directories(${LibXML++_INCLUDE_DIRS})
link_directories(${LibXML++_LIBRARY_DIRS})
set(LIBS ${LIBS} ${LibXML++_LIBRARIES})
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
SET(libmaca_STAT_SRC
exception.cpp
main.cpp
conv/attributecopier.cpp
conv/fold.cpp
conv/joinlayer.cpp
conv/joinrule.cpp
conv/layer.cpp
conv/predicate.cpp
conv/removedupes.cpp
conv/splitlayer.cpp
conv/tagconvert.cpp
conv/tagrule.cpp
conv/tagrulelayer.cpp
conv/tagsetconverter.cpp
io/text.cpp
io/premorph.cpp
morph/constanalyser.cpp
morph/convertinganalyser.cpp
morph/dispatchanalyser.cpp
morph/mapanalyser.cpp
morph/morphanalyser.cpp
morph/guesser2.cpp
util/confignode.cpp
util/debug.cpp
util/sentenceanalyser.cpp
util/settings.cpp
util/symboldictionary.cpp
util/tokentimer.cpp
)
if (UNIX)
set(SFST_PLUGIN ON CACHE BOOL "Build SFST analyser as a plugin")
set(MORFEUSZ_PLUGIN OFF CACHE BOOL "Build Morfeusz analyser as a plugin")
set(GUESSER_PLUGIN ON CACHE BOOL "Build Guesser analyser as a plugin")
endif(UNIX)
find_package(SFST)
if(BUILD_GPL_PLUGINS)
if (SFST_FOUND)
set(SFST_COMPONENT_BUILD True CACHE INTERNAL "SFST MARKER" PARENT_SCOPE)
if(SFST_PLUGIN)
message(STATUS "SFST support will be built as a plugin")
add_library(maca_sfst MODULE morph/sfstanalyser.cpp)
target_link_libraries(maca_sfst maca ${SFST_LIBRARY} )
set_target_properties(maca_sfst PROPERTIES
VERSION "${maca_ver_major}.${maca_ver_minor}"
SOVERSION ${maca_ver_major})
set_target_properties(maca_sfst PROPERTIES
COMPILE_FLAGS "-DSFST_AS_PLUGIN -I${SFST_INCLUDE_DIR} -Wno-deprecated"
)
install(TARGETS maca_sfst
LIBRARY DESTINATION lib)
else(SFST_PLUGIN)
message(STATUS "SFST support will be built-in")
set(LIBS ${LIBS} ${SFST_LIBRARY})
include_directories(${SFST_INCLUDE_DIR})
link_directories(${SFST_LIBRARY_DIRS})
set(HAVE_SFST 1)
SET(libmaca_STAT_SRC ${libmaca_STAT_SRC} morph/sfstanalyser.cpp)
endif(SFST_PLUGIN)
endif (SFST_FOUND)
endif(BUILD_GPL_PLUGINS)
find_package(Morfeusz)
if (MORFEUSZ_FOUND)
if(MORFEUSZ_PLUGIN)
message(STATUS "Morfeusz support will be built as a plugin")
add_library(maca_morfeusz MODULE morph/morfeuszanalyser.cpp)
#target_link_libraries ( maca_morfeusz maca ${MORFEUSZ_LIBRARY} )
set_target_properties(maca_morfeusz PROPERTIES
VERSION "${maca_ver_major}.${maca_ver_minor}"
SOVERSION ${maca_ver_major})
set_target_properties(maca_morfeusz PROPERTIES
COMPILE_FLAGS "-DMORFEUSZ_AS_PLUGIN -I${MORFEUSZ_INCLUDE_DIR}"
)
install(TARGETS maca_morfeusz
LIBRARY DESTINATION lib)
else(MORFEUSZ_PLUGIN)
message(STATUS "Morfeusz support will be built-in")
set(LIBS ${LIBS} ${MORFEUSZ_LIBRARY})
include_directories(${MORFEUSZ_INCLUDE_DIR})
link_directories(${MORFEUSZ_LIBRARY_DIRS})
set(HAVE_MORFEUSZ 1)
SET(libmaca_STAT_SRC ${libmaca_STAT_SRC} morph/morfeuszanalyser.cpp)
endif(MORFEUSZ_PLUGIN)
endif (MORFEUSZ_FOUND)
find_package(Morfeusz2)
if (MORFEUSZ2_FOUND)
set(LIBS ${LIBS} ${MORFEUSZ2_LIBRARY})
include_directories(${MORFEUSZ2_INCLUDE_DIR})
link_directories(${MORFEUSZ2_LIBRARY_DIRS})
set(libmaca_STAT_SRC ${libmaca_STAT_SRC} morph/morfeusz2analyser.cpp)
endif (MORFEUSZ2_FOUND)
find_package(Corpus)
if(BUILD_GPL_PLUGINS)
if (CORPUS_FOUND)
set(GUESSER_COMPONENT_BUILD True CACHE INTERNAL "GUESSER MARKER" PARENT_SCOPE)
if(GUESSER_PLUGIN)
message(STATUS "Guesser support will be built as a plugin")
add_library(maca_guesser MODULE morph/guesser.cpp)
target_link_libraries ( maca_guesser maca ${CORPUS_LIBRARY} )
set_target_properties(maca_guesser PROPERTIES
VERSION "${maca_ver_major}.${maca_ver_minor}"
SOVERSION ${maca_ver_major})
set_target_properties(maca_guesser PROPERTIES
COMPILE_FLAGS "-DGUESSER_AS_PLUGIN"
)
install(TARGETS maca_guesser
LIBRARY DESTINATION lib)
else(GUESSER_PLUGIN)
set(LIBS ${LIBS} ${CORPUS_LIBRARY})
set(HAVE_CORPUS 1)
SET(libmaca_STAT_SRC ${libmaca_STAT_SRC} morph/guesser.cpp)
endif(GUESSER_PLUGIN)
endif (CORPUS_FOUND)
endif(BUILD_GPL_PLUGINS)
file(GLOB_RECURSE INCS "*.h")
add_library(maca SHARED ${libmaca_STAT_SRC} ${INCS})
target_link_libraries ( maca ${LIBS} )
set_target_properties(maca PROPERTIES
VERSION "${maca_ver_major}.${maca_ver_minor}"
SOVERSION ${maca_ver_major})
if(UNIX)
set_target_properties(maca PROPERTIES
LINK_FLAGS -Wl,-e,LIBMACA_entry_)
endif(UNIX)
# Newer LibXML requires C++11
if(NOT ${LibXML++_PKGCONF_VERSION} VERSION_LESS 2.40)
set_target_properties(maca PROPERTIES
CXX_STANDARD 11)
endif(NOT ${LibXML++_PKGCONF_VERSION} VERSION_LESS 2.40)
install(TARGETS maca
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION include
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN "bin" EXCLUDE
PATTERN "build" EXCLUDE
PATTERN "CMake*" EXCLUDE
)
install(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION include
FILES_MATCHING PATTERN "version.h"
)
install(
DIRECTORY ${LIBMACA_SRC_DATA_DIR}/
DESTINATION ${LIBMACA_INSTALL_DATA_DIR}
FILES_MATCHING PATTERN "*.ini"
PATTERN "*.tagset"
PATTERN "*.conv"
PATTERN "*.xml"
PATTERN "*.txt"
PATTERN "*.fst"
PATTERN ".svn" EXCLUDE
PATTERN "local/*" EXCLUDE
)