Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp-pinyin] Add new port #42063

Merged
merged 11 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions ports/cpp-pinyin/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions ports/cpp-pinyin/usage
Original file line number Diff line number Diff line change
@@ -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"
)
17 changes: 17 additions & 0 deletions ports/cpp-pinyin/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,10 @@
"baseline": "1.9.0",
"port-version": 0
},
"cpp-pinyin": {
"baseline": "1.0.0",
"port-version": 0
},
"cpp-redis": {
"baseline": "4.3.1",
"port-version": 5
Expand Down
9 changes: 9 additions & 0 deletions versions/c-/cpp-pinyin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "f3a4b0cc31a8acaecebdee019de6f0a07b45037a",
"version": "1.0.0",
"port-version": 0
}
]
}