[crfsuite] Add new port (#8233)

* [crfsuite] Add new port

* fix crfsuite

* remove patch file

* readd the patch file

* modify version of crfsuite, so no patch file are needed
This commit is contained in:
Yang 2019-09-25 02:25:22 +08:00 committed by dan-shaw
parent 45e70a9f78
commit e9047ef771
3 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
PROJECT(crfsuite)
file(GLOB SOURCE_FILE_CQDB
"lib/cqdb/src/*.c"
)
file(GLOB HEADERS_FILE_CQDB
"lib/cqdb/include/*.h"
)
file(GLOB SOURCE_FILE_CRF
"lib/crf/src/*.c"
)
file(GLOB HEADERS_FILE_CRF
"lib/crf/src/*.h"
)
file(GLOB SOURCE_FILE_FRONTEND
"frontend/*.c"
)
file(GLOB HEADERS_FILE_FRONTEND
"frontend/*.h"
)
file(GLOB SOURCE_FILE
"swig/*.cpp"
"frontend/*.c"
)
file(GLOB HEADERS_FILE
"include/*.h"
"include/*.hpp"
"frontend/*.h"
)
find_library(LBFGS_LIBRARY lbfgs)
include_directories(lib/cqdb/include/)
include_directories(include/)
include_directories(win32/liblbfgs/)
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})
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)
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
)
endif()
install(FILES ${HEADERS_FILE} ${HEADERS_FILE_CQDB} ${HEADERS_FILE_CRF} ${HEADERS_FILE_FRONTEND} DESTINATION include)

5
ports/crfsuite/CONTROL Normal file
View File

@ -0,0 +1,5 @@
Source: crfsuite
Version: 2019-07-21
Homepage: http://www.chokkan.org/software/crfsuite/
Build-Depends: liblbfgs
Description: CRFSuite is an implementation of Conditional Random Fields (CRFs) for labeling sequential data.

View File

@ -0,0 +1,33 @@
if (VCPKG_TARGET_TRIPLET STREQUAL "x64-uwp" OR VCPKG_TARGET_TRIPLET STREQUAL "arm-uwp")
message(FATAL_ERROR "crfsuite does not support on this platform")
endif()
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO chokkan/crfsuite
REF 5d1bd3b803bb26582ed5cc274d6b5af6cc7f9cae
SHA512 e7f329f96fb0dc0e347b3e7a3e26b23ceb45e6fae7b59ace05633a24d58a31665826ebc5280e5a864f50598772791e4b5b3e7da7f46994655cbe03806f823f73
HEAD_REF master
)
list(REMOVE_ITEM SOURCE_FILE ${SOURCE_PATH}/win32/liblbfgs/lbfgs.lib)
list(REMOVE_ITEM SOURCE_FILE ${SOURCE_PATH}/win32/liblbfgs/lbfgs_debug.lib)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFIX_NINJA
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/crfsuite RENAME copyright)