-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildStandalone.cmake
41 lines (35 loc) · 1.15 KB
/
BuildStandalone.cmake
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
cmake_minimum_required(VERSION 3.1)
file(GLOB
KENLM_PYTHON_STANDALONE_SRCS
"util/*.cc"
"lm/*.cc"
"util/double-conversion/*.cc"
"python/*.cc"
)
list(FILTER KENLM_PYTHON_STANDALONE_SRCS EXCLUDE REGEX ".*main.cc")
list(FILTER KENLM_PYTHON_STANDALONE_SRCS EXCLUDE REGEX ".*test.cc")
add_library(
kenlm
SHARED
${KENLM_PYTHON_STANDALONE_SRCS}
)
target_include_directories(kenlm PRIVATE ${PROJECT_SOURCE_DIR})
target_compile_definitions(kenlm PRIVATE KENLM_MAX_ORDER=${KENLM_MAX_ORDER})
find_package(ZLIB)
find_package(BZip2)
find_package(LibLZMA)
if (ZLIB_FOUND)
target_link_libraries(kenlm PRIVATE ${ZLIB_LIBRARIES})
target_include_directories(kenlm PRIVATE ${ZLIB_INCLUDE_DIRS})
target_compile_definitions(kenlm PRIVATE HAVE_ZLIB)
endif()
if(BZIP2_FOUND)
target_link_libraries(kenlm PRIVATE ${BZIP2_LIBRARIES})
target_include_directories(kenlm PRIVATE ${BZIP2_INCLUDE_DIR})
target_compile_definitions(kenlm PRIVATE HAVE_BZLIB)
endif()
if(LIBLZMA_FOUND)
target_link_libraries(kenlm PRIVATE ${LIBLZMA_LIBRARIES})
target_include_directories(kenlm PRIVATE ${LIBLZMA_INCLUDE_DIRS})
target_compile_definitions(kenlm PRIVATE HAVE_LZMA)
endif()