2021-01-20 19:23:41 -08:00
|
|
|
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
|
2019-09-25 02:25:22 +08:00
|
|
|
PROJECT(crfsuite)
|
2021-01-20 19:23:41 -08:00
|
|
|
|
2019-09-25 02:25:22 +08:00
|
|
|
file(GLOB SOURCE_FILE_CQDB
|
2021-01-20 19:23:41 -08:00
|
|
|
"lib/cqdb/src/*.c"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
file(GLOB HEADERS_FILE_CQDB
|
2021-01-20 19:23:41 -08:00
|
|
|
"lib/cqdb/include/*.h"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB SOURCE_FILE_CRF
|
2021-01-20 19:23:41 -08:00
|
|
|
"lib/crf/src/*.c"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
file(GLOB HEADERS_FILE_CRF
|
2021-01-20 19:23:41 -08:00
|
|
|
"lib/crf/src/*.h"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
file(GLOB SOURCE_FILE_FRONTEND
|
2021-01-20 19:23:41 -08:00
|
|
|
"frontend/*.c"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
file(GLOB HEADERS_FILE_FRONTEND
|
2021-01-20 19:23:41 -08:00
|
|
|
"frontend/*.h"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
file(GLOB SOURCE_FILE
|
2021-01-20 19:23:41 -08:00
|
|
|
"swig/*.cpp"
|
|
|
|
"frontend/*.c"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
file(GLOB HEADERS_FILE
|
2021-01-20 19:23:41 -08:00
|
|
|
"include/*.h"
|
|
|
|
"include/*.hpp"
|
|
|
|
"frontend/*.h"
|
2019-09-25 02:25:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library(LBFGS_LIBRARY lbfgs)
|
|
|
|
|
|
|
|
include_directories(lib/cqdb/include/)
|
|
|
|
include_directories(include/)
|
|
|
|
include_directories(win32/liblbfgs/)
|
|
|
|
|
2021-01-20 19:23:41 -08:00
|
|
|
add_library(cqdb STATIC ${SOURCE_FILE_CQDB} ${HEADERS_FILE_CQDB})
|
|
|
|
add_library(crf STATIC ${SOURCE_FILE_CRF} ${HEADERS_FILE_CRF})
|
|
|
|
add_library(crfsuite STATIC ${SOURCE_FILE} ${HEADERS_FILE})
|
2019-09-25 02:25:22 +08:00
|
|
|
|
|
|
|
target_link_libraries(crf PUBLIC cqdb ${LBFGS_LIBRARY})
|
|
|
|
target_link_libraries(crfsuite PUBLIC crf)
|
|
|
|
|
|
|
|
install(TARGETS cqdb crf crfsuite
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
)
|
|
|
|
|
|
|
|
if (WIN32)
|
2021-01-20 19:23:41 -08:00
|
|
|
add_executable(frontend ${SOURCE_FILE_FRONTEND} ${HEADERS_FILE_FRONTEND})
|
|
|
|
target_link_libraries(frontend PUBLIC crf)
|
|
|
|
install(TARGETS frontend
|
|
|
|
RUNTIME DESTINATION tools
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
)
|
2019-09-25 02:25:22 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2021-01-20 19:23:41 -08:00
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${HEADERS_FILE}
|
|
|
|
${HEADERS_FILE_CQDB}
|
|
|
|
${HEADERS_FILE_CRF}
|
|
|
|
${HEADERS_FILE_FRONTEND}
|
|
|
|
DESTINATION
|
|
|
|
include/crfsuite
|
|
|
|
)
|