mirror of
https://github.com/cemu-project/vcpkg.git
synced 2024-11-23 19:29:49 +00:00
parent
49313b8bba
commit
82a6235770
47
ports/mecab/CMakeLists.txt
Normal file
47
ports/mecab/CMakeLists.txt
Normal file
@ -0,0 +1,47 @@
|
||||
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
||||
|
||||
PROJECT(Mecab)
|
||||
|
||||
file(GLOB SOURCE_FILE
|
||||
"*.cpp"
|
||||
"*.c"
|
||||
)
|
||||
file(GLOB HEADERS_FILE
|
||||
"*.h"
|
||||
)
|
||||
|
||||
message(STATUS "current cmake path: ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
list(REMOVE_ITEM SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/mecab-cost-train.cpp)
|
||||
list(REMOVE_ITEM SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/mecab-dict-gen.cpp)
|
||||
list(REMOVE_ITEM SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/mecab-dict-index.cpp)
|
||||
list(REMOVE_ITEM SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/mecab-system-eval.cpp)
|
||||
list(REMOVE_ITEM SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/mecab-test-gen.cpp)
|
||||
#list(REMOVE_ITEM SOURCE_FILE "mecab-cost-train.cpp" "mecab-dict-gen.cpp" "mecab-dict-index.cpp" "mecab-system-eval.cpp" "mecab-test-gen.cpp")
|
||||
|
||||
add_library (Mecab ${SOURCE_FILE} ${HEADERS_FILE})
|
||||
|
||||
if(UNIX)
|
||||
target_compile_definitions(Mecab PUBLIC -DHAVE_UNISTD_H -DHAVE_FCNTL_H -DHAVE_STDINT_H -DHAVE_SYS_TYPES_H -DHAVE_SYS_STAT_H -DHAVE_DIRENT_H -DDIC_VERSION=102 -DVERSION="@VERSION@" -DPACKAGE="mecab" -DMECAB_DEFAULT_RC="./mecabrc")
|
||||
endif(UNIX)
|
||||
if(WIN32)
|
||||
target_compile_definitions(Mecab PUBLIC -D_CRT_SECURE_NO_DEPRECATE -DMECAB_USE_THREAD -DDLL_EXPORT -DHAVE_GETENV -DHAVE_WINDOWS_H -DDIC_VERSION=102 -DVERSION="@VERSION@" -DPACKAGE="mecab" -DUNICODE -D_UNICODE -DMECAB_DEFAULT_RC="mecabrc")
|
||||
endif(WIN32)
|
||||
|
||||
install(TARGETS Mecab
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(cmake_package_name Mecab)
|
||||
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "")
|
||||
set(cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${cmake_package_name}")
|
||||
set(config_file "${generated_dir}/${cmake_package_name}Config.cmake")
|
||||
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in"
|
||||
"${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir})
|
||||
#install(FILES ${config_file} DESTINATION ${cmake_files_install_dir} CONFIGURATIONS Release)
|
||||
install(FILES ${config_file} DESTINATION share/mecab CONFIGURATIONS Release)
|
||||
message(STATUS "ccmake_files_install_dir: ${cmake_files_install_dir}")
|
||||
|
||||
install(FILES ${HEADERS_FILE} DESTINATION include CONFIGURATIONS Release)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
3
ports/mecab/CONTROL
Normal file
3
ports/mecab/CONTROL
Normal file
@ -0,0 +1,3 @@
|
||||
Source: mecab
|
||||
Version:0.996
|
||||
Description: A morphological analysis engine based on CRF
|
1
ports/mecab/Config.cmake.in
Normal file
1
ports/mecab/Config.cmake.in
Normal file
@ -0,0 +1 @@
|
||||
@PACKAGE_INIT@
|
40
ports/mecab/fix_wpath_unsigned.patch
Normal file
40
ports/mecab/fix_wpath_unsigned.patch
Normal file
@ -0,0 +1,40 @@
|
||||
diff --git a/mecab/src/common.h b/mecab/src/common.h
|
||||
index d1fc459..2951d5a 100644
|
||||
--- a/mecab/src/common.h
|
||||
+++ b/mecab/src/common.h
|
||||
@@ -86,7 +86,8 @@
|
||||
#define WPATH_FORCE(path) (MeCab::Utf8ToWide(path).c_str())
|
||||
#define WPATH(path) (path)
|
||||
#else
|
||||
-#define WPATH(path) WPATH_FORCE(path)
|
||||
+#define WPATH_FORCE(path) (MeCab::Utf8ToWide(path).c_str())
|
||||
+#define WPATH(path) (path)
|
||||
#endif
|
||||
#else
|
||||
#define WPATH_FORCE(path) (path)
|
||||
diff --git a/mecab/src/feature_index.cpp b/mecab/src/feature_index.cpp
|
||||
index 051bdf8..fdd0145 100644
|
||||
--- a/mecab/src/feature_index.cpp
|
||||
+++ b/mecab/src/feature_index.cpp
|
||||
@@ -353,7 +353,7 @@ bool FeatureIndex::buildUnigramFeature(LearnerPath *path,
|
||||
if (!r) goto NEXT;
|
||||
os_ << r;
|
||||
} break;
|
||||
- case 't': os_ << (size_t)path->rnode->char_type; break;
|
||||
+ case 't': os_ << (int)(size_t)path->rnode->char_type; break;
|
||||
case 'u': os_ << ufeature; break;
|
||||
case 'w':
|
||||
if (path->rnode->stat == MECAB_NOR_NODE) {
|
||||
diff --git a/mecab/src/writer.cpp b/mecab/src/writer.cpp
|
||||
index 0ef6975..f068fa3 100644
|
||||
--- a/mecab/src/writer.cpp
|
||||
+++ b/mecab/src/writer.cpp
|
||||
@@ -257,7 +257,7 @@ bool Writer::writeNode(Lattice *lattice,
|
||||
// input sentence
|
||||
case 'S': os->write(lattice->sentence(), lattice->size()); break;
|
||||
// sentence length
|
||||
- case 'L': *os << lattice->size(); break;
|
||||
+ case 'L': *os << (int)lattice->size(); break;
|
||||
// morph
|
||||
case 'm': os->write(node->surface, node->length); break;
|
||||
case 'M': os->write(reinterpret_cast<const char *>
|
35
ports/mecab/portfile.cmake
Normal file
35
ports/mecab/portfile.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
if (VCPKG_TARGET_TRIPLET STREQUAL "x64-uwp" OR VCPKG_TARGET_TRIPLET STREQUAL "arm64-windows" OR VCPKG_TARGET_TRIPLET STREQUAL "arm-uwp")
|
||||
message(FATAL_ERROR "mecab does not support on this platform")
|
||||
endif()
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
set(MECAB_VERSION 0.996)
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO taku910/mecab
|
||||
REF master
|
||||
SHA512 2a7f1d159ddca846357b5bcab2d2b5de2e6a27dca4301cdd1cc52c155c352f9c7030b77d1187afe9c0a7f1b131a1acdcc40ee81ce7ba5c0fa6b2325c56676353
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix_wpath_unsigned.patch
|
||||
)
|
||||
|
||||
message(STATUS "source path is : ${SOURCE_PATH}")
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/mecab/src)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH}/mecab/src)
|
||||
file(COPY ${SOURCE_PATH}/mecab/COPYING DESTINATION ${SOURCE_PATH}/mecab/src)
|
||||
|
||||
message(STATUS "CURRENT_PACKAGES_DIR is : ${CURRENT_PACKAGES_DIR}")
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}/mecab/src
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
file(COPY ${SOURCE_PATH}/mecab/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mecab)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/mecab/COPYING ${CURRENT_PACKAGES_DIR}/share/mecab/copyright)
|
||||
|
||||
# Post-build test for cmake libraries
|
||||
# vcpkg_test_cmake(PACKAGE_NAME mecab)
|
Loading…
Reference in New Issue
Block a user