Skip to content

Commit acdbbba

Browse files
wolfgitprdg0yt
andauthored
[cpp-pinyin] Add new port (#42063)
Co-authored-by: Kai Pastor <[email protected]>
1 parent 796cc3b commit acdbbba

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

ports/cpp-pinyin/portfile.cmake

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO wolfgitpr/cpp-pinyin
4+
REF "${VERSION}"
5+
SHA512 cdd78cdc493ab352bfd7c5adfb4642bc587fb26f65b4d81a07e7c89c377222a30730f3e800f028106b66cbc35e32709c1a0e470e9737b6ee9718e3ce9da8137a
6+
HEAD_REF main
7+
)
8+
9+
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CPP_PINYIN_BUILD_STATIC)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}"
13+
OPTIONS
14+
-DCPP_PINYIN_BUILD_STATIC=${CPP_PINYIN_BUILD_STATIC}
15+
-DCPP_PINYIN_BUILD_TESTS=FALSE
16+
"-DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT}"
17+
)
18+
19+
vcpkg_cmake_install()
20+
21+
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
22+
23+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
24+
25+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
26+
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

ports/cpp-pinyin/usage

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cpp-pinyin provides CMake targets:
2+
3+
find_package(cpp-pinyin CONFIG REQUIRED)
4+
target_link_libraries(main PRIVATE cpp-pinyin::cpp-pinyin)
5+
6+
To use the library, you need to copy the dictionary files to the binary directory.
7+
8+
add_custom_command(TARGET main POST_BUILD
9+
COMMAND "${CMAKE_COMMAND}" -E copy_directory
10+
"${cpp-pinyin_DIR}/dict"
11+
"$<TARGET_FILE_DIR:main>/dict"
12+
)

ports/cpp-pinyin/vcpkg.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "cpp-pinyin",
3+
"version": "1.0.0",
4+
"description": "A lightweight Chinese/Cantonese to Pinyin library.",
5+
"homepage": "https://github.com/wolfgitpr/cpp-pinyin",
6+
"license": "Apache-2.0",
7+
"dependencies": [
8+
{
9+
"name": "vcpkg-cmake",
10+
"host": true
11+
},
12+
{
13+
"name": "vcpkg-cmake-config",
14+
"host": true
15+
}
16+
]
17+
}

versions/baseline.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,6 +1920,10 @@
19201920
"baseline": "1.9.0",
19211921
"port-version": 0
19221922
},
1923+
"cpp-pinyin": {
1924+
"baseline": "1.0.0",
1925+
"port-version": 0
1926+
},
19231927
"cpp-redis": {
19241928
"baseline": "4.3.1",
19251929
"port-version": 5

versions/c-/cpp-pinyin.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"versions": [
3+
{
4+
"git-tree": "f3a4b0cc31a8acaecebdee019de6f0a07b45037a",
5+
"version": "1.0.0",
6+
"port-version": 0
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)