Skip to content

Commit

Permalink
add option to disable building data
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored and wengxt committed Dec 28, 2023
1 parent 16b1112 commit 51010b1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ option(ENABLE_TEST "Build Test" On)
option(ENABLE_COVERAGE "Build the project with gcov support (Need ENABLE_TEST=On)" Off)
set(GCOV_TOOL "gcov" CACHE STRING "Path to gcov tool used by coverage.")
option(ENABLE_DOC "Build doxygen" Off)
option(ENABLE_DATA "Build data" On)

#########################################
# Dependency
Expand Down Expand Up @@ -56,7 +57,10 @@ endif()

add_subdirectory(src)
add_subdirectory(tools)
add_subdirectory(data)

if (ENABLE_DATA)
add_subdirectory(data)
endif()

if (ENABLE_DOC)
find_package(Doxygen REQUIRED)
Expand Down
30 changes: 21 additions & 9 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,42 @@ set(LIBIME_SINGLE_FILE_TEST
testtable
testpinyindata
testpinyinencoder
testpinyinime_unit
testinputbuffer
testhistorybigram
testshuangpinprofile
testtrie
testautophrasedict
testdecoder
testpinyincontext
testpinyindictionary
testprediction
testpinyinprediction
testtableime_unit
testtablerule
)

if (ENABLE_DATA)
list(APPEND LIBIME_SINGLE_FILE_TEST
testpinyinime_unit
testdecoder
testpinyincontext
testpinyindictionary
testprediction
testpinyinprediction
testtableime_unit
)
endif()

foreach(TESTCASE ${LIBIME_SINGLE_FILE_TEST})
add_executable(${TESTCASE} ${TESTCASE}.cpp)
target_link_libraries(${TESTCASE} LibIME::Core LibIME::Pinyin LibIME::Table )
add_test(NAME ${TESTCASE}
COMMAND ${TESTCASE})
endforeach()

add_dependencies(testdecoder dict lm)
add_dependencies(testpinyindictionary dict)
if (ENABLE_DATA)
add_dependencies(testpinyinime_unit lm)
add_dependencies(testdecoder dict lm)
add_dependencies(testpinyincontext lm)
add_dependencies(testpinyindictionary dict)
add_dependencies(testprediction lm)
add_dependencies(testpinyinprediction lm)
add_dependencies(testtableime_unit lm)
endif()

add_executable(triebench triebench.cpp)
target_link_libraries(triebench LibIME::Core)
Expand Down

0 comments on commit 51010b1

Please sign in to comment.