forked from coccoc/coccoc-tokenizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (52 loc) · 2.89 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
PROJECT (coccoc-tokenizer)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
INCLUDE (CMakeMacro.cmake)
INCLUDE_DIRECTORIES (${PROJECT_BINARY_DIR}/auto)
INCLUDE_DIRECTORIES (tokenizer)
ADD_EXECUTABLE (dict_compiler utils/dict_compiler.cpp)
ADD_EXECUTABLE (tokenizer utils/tokenizer.cpp)
ADD_EXECUTABLE (vn_lang_tool utils/vn_lang_tool.cpp)
SET (MULTITERM_DICT_DUMP "multiterm_trie.dump")
SET (SYLLABLE_DICT_DUMP "syllable_trie.dump")
SET (NONTONE_PAIR_DICT_DUMP "nontone_pair_freq_map.dump")
LIST (APPEND DICT_DUMPS ${MULTITERM_DICT_DUMP})
LIST (APPEND DICT_DUMPS ${SYLLABLE_DICT_DUMP})
LIST (APPEND DICT_DUMPS ${NONTONE_PAIR_DICT_DUMP})
# We don't use GLOB here because it also takes hidden files and we are too lazy to cope with it
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/acronyms")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/chemical_comp")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/Freq2NontoneUniFile")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/keyword.freq")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/nontone_pair_freq")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/special_token.strong")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/special_token.weak")
LIST (APPEND DICT_SOURCES "${CMAKE_SOURCE_DIR}/dicts/tokenizer/vndic_multiterm")
ADD_CUSTOM_TARGET (compile_dict ALL DEPENDS ${DICT_DUMPS})
ADD_CUSTOM_COMMAND (
OUTPUT ${DICT_DUMPS}
COMMAND ${CMAKE_BINARY_DIR}/dict_compiler "${CMAKE_SOURCE_DIR}/dicts" "${CMAKE_BINARY_DIR}"
DEPENDS dict_compiler "${DICT_SOURCES}"
VERBATIM
)
INSTALL (TARGETS tokenizer DESTINATION bin)
INSTALL (TARGETS vn_lang_tool DESTINATION bin)
INSTALL (TARGETS dict_compiler DESTINATION bin)
INSTALL (DIRECTORY tokenizer/ DESTINATION include/tokenizer FILES_MATCHING PATTERN "*.h")
INSTALL (DIRECTORY tokenizer/ DESTINATION include/tokenizer FILES_MATCHING PATTERN "*.hpp")
INSTALL (DIRECTORY tokenizer/ DESTINATION include/tokenizer FILES_MATCHING PATTERN "*.tcc")
INSTALL_TEMPLATE (tokenizer/config.h.in DESTINATION include/tokenizer)
INSTALL (DIRECTORY dicts/ DESTINATION share/tokenizer/dicts_text)
INSTALL (DIRECTORY dicts/vn_lang_tool/ DESTINATION share/tokenizer/dicts)
INSTALL (FILES ${CMAKE_BINARY_DIR}/${MULTITERM_DICT_DUMP} DESTINATION share/tokenizer/dicts)
INSTALL (FILES ${CMAKE_BINARY_DIR}/${SYLLABLE_DICT_DUMP} DESTINATION share/tokenizer/dicts)
INSTALL (FILES ${CMAKE_BINARY_DIR}/${NONTONE_PAIR_DICT_DUMP} DESTINATION share/tokenizer/dicts)
IF (${BUILD_JAVA})
ADD_CUSTOM_TARGET (compile_java ALL DEPENDS ${CMAKE_BINARY_DIR}/coccoc-tokenizer.jar)
ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_BINARY_DIR}/coccoc-tokenizer.jar
COMMAND ${CMAKE_SOURCE_DIR}/java/build_java.sh ${CMAKE_BINARY_DIR}
VERBATIM
)
INSTALL (FILES ${CMAKE_BINARY_DIR}/coccoc-tokenizer.jar DESTINATION share/java)
INSTALL (FILES ${CMAKE_BINARY_DIR}/libcoccoc_tokenizer_jni.so DESTINATION lib)
ENDIF ()