Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « lm - github.com/kpu/kenlm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb21f12df2f737bb464c719deac06b241410ca61 (plain)
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
# Explicitly list the source files for this subdirectory
#
# If you add any source files to this subdirectory
#    that should be included in the kenlm library,
#        (this excludes any unit test files)
#    you should add them to the following list:
set(KENLM_LM_SOURCE
	bhiksha.cc
	binary_format.cc
	config.cc
	lm_exception.cc
	model.cc
	quantize.cc
	read_arpa.cc
	search_hashed.cc
	search_trie.cc
	sizes.cc
	trie.cc
	trie_sort.cc
	value_build.cc
	virtual_interface.cc
	vocab.cc
)


# Group these objects together for later use.
#
# Given add_library(foo OBJECT ${my_foo_sources}),
# refer to these objects as $<TARGET_OBJECTS:foo>
#
add_subdirectory(common)

add_library(kenlm ${KENLM_LM_SOURCE} ${KENLM_LM_COMMON_SOURCE})
set_target_properties(kenlm PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(kenlm PUBLIC kenlm_util Threads::Threads)

set(KENLM_MAX_ORDER 6 CACHE STRING "Maximum supported ngram order")
target_compile_definitions(kenlm PUBLIC -DKENLM_MAX_ORDER=${KENLM_MAX_ORDER})

# This directory has children that need to be processed
add_subdirectory(builder)
add_subdirectory(filter)
add_subdirectory(interpolate)

# Explicitly list the executable files to be compiled
set(EXE_LIST
  query
  fragment
  build_binary
  kenlm_benchmark
)

set(LM_LIBS kenlm kenlm_util Threads::Threads)

install(
  TARGETS kenlm
  EXPORT kenlmTargets
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  INCLUDES DESTINATION include
)

AddExes(EXES ${EXE_LIST}
        LIBRARIES ${LM_LIBS})

if(BUILD_TESTING)

  set(KENLM_BOOST_TESTS_LIST left_test partial_test)
  AddTests(TESTS ${KENLM_BOOST_TESTS_LIST}
           LIBRARIES ${LM_LIBS}
           TEST_ARGS ${CMAKE_CURRENT_SOURCE_DIR}/test.arpa)

  # model_test requires an extra command line parameter
  KenLMAddTest(TEST model_test
               LIBRARIES ${LM_LIBS}
               TEST_ARGS ${CMAKE_CURRENT_SOURCE_DIR}/test.arpa
                         ${CMAKE_CURRENT_SOURCE_DIR}/test_nounk.arpa)
endif()