[cpp-pinyin] Add new port (#42063)

Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
wolfgitpr 2024-11-12 15:26:39 +08:00 committed by GitHub
parent 796cc3baea
commit acdbbbaab9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,26 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO wolfgitpr/cpp-pinyin
REF "${VERSION}"
SHA512 cdd78cdc493ab352bfd7c5adfb4642bc587fb26f65b4d81a07e7c89c377222a30730f3e800f028106b66cbc35e32709c1a0e470e9737b6ee9718e3ce9da8137a
HEAD_REF main
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CPP_PINYIN_BUILD_STATIC)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCPP_PINYIN_BUILD_STATIC=${CPP_PINYIN_BUILD_STATIC}
-DCPP_PINYIN_BUILD_TESTS=FALSE
"-DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

12
ports/cpp-pinyin/usage Normal file
View File

@ -0,0 +1,12 @@
cpp-pinyin provides CMake targets:
find_package(cpp-pinyin CONFIG REQUIRED)
target_link_libraries(main PRIVATE cpp-pinyin::cpp-pinyin)
To use the library, you need to copy the dictionary files to the binary directory.
add_custom_command(TARGET main POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${cpp-pinyin_DIR}/dict"
"$<TARGET_FILE_DIR:main>/dict"
)

View File

@ -0,0 +1,17 @@
{
"name": "cpp-pinyin",
"version": "1.0.0",
"description": "A lightweight Chinese/Cantonese to Pinyin library.",
"homepage": "https://github.com/wolfgitpr/cpp-pinyin",
"license": "Apache-2.0",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -1920,6 +1920,10 @@
"baseline": "1.9.0", "baseline": "1.9.0",
"port-version": 0 "port-version": 0
}, },
"cpp-pinyin": {
"baseline": "1.0.0",
"port-version": 0
},
"cpp-redis": { "cpp-redis": {
"baseline": "4.3.1", "baseline": "4.3.1",
"port-version": 5 "port-version": 5

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "f3a4b0cc31a8acaecebdee019de6f0a07b45037a",
"version": "1.0.0",
"port-version": 0
}
]
}