From d017e914d29d6bf2fa36e42153ad249935e9a390 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 09:40:31 +0800 Subject: [PATCH 01/11] Add cpp-pinyin to vcpkg --- ports/cpp-pinyin/portfile.cmake | 24 ++++++++++++++++++++++++ ports/cpp-pinyin/usage | 16 ++++++++++++++++ ports/cpp-pinyin/vcpkg.json | 17 +++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 ports/cpp-pinyin/portfile.cmake create mode 100644 ports/cpp-pinyin/usage create mode 100644 ports/cpp-pinyin/vcpkg.json diff --git a/ports/cpp-pinyin/portfile.cmake b/ports/cpp-pinyin/portfile.cmake new file mode 100644 index 00000000000000..1489b6a377d41a --- /dev/null +++ b/ports/cpp-pinyin/portfile.cmake @@ -0,0 +1,24 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO wolfgitpr/cpp-pinyin + REF "${VERSION}" + SHA512 cdd78cdc493ab352bfd7c5adfb4642bc587fb26f65b4d81a07e7c89c377222a30730f3e800f028106b66cbc35e32709c1a0e470e9737b6ee9718e3ce9da8137a + HEAD_REF main +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCPP_PINYIN_BUILD_STATIC=FALSE + -DCPP_PINYIN_BUILD_TESTS=FALSE + -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(PACKAGE_NAME ${PORT} CONFIG_PATH lib/cmake/${PORT}) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) \ No newline at end of file diff --git a/ports/cpp-pinyin/usage b/ports/cpp-pinyin/usage new file mode 100644 index 00000000000000..0779525d0c3c6d --- /dev/null +++ b/ports/cpp-pinyin/usage @@ -0,0 +1,16 @@ +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 ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/cpp-pinyin/dict + $/dict +) + +To generate your own dictionary files, you can use the pinyin-makedict tool provided by cpp-pinyin. + +https://github.com/wolfgitpr/pinyin-makedict \ No newline at end of file diff --git a/ports/cpp-pinyin/vcpkg.json b/ports/cpp-pinyin/vcpkg.json new file mode 100644 index 00000000000000..7654ecbfe91991 --- /dev/null +++ b/ports/cpp-pinyin/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "cpp-pinyin", + "version": "1.0.0", + "homepage": "https://github.com/wolfgitpr/cpp-pinyin", + "description": "A lightweight Chinese/Cantonese to Pinyin library.", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} \ No newline at end of file From 0736753ed1ce3149ce0fbcde4b42e1b8a43c32f9 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 09:42:55 +0800 Subject: [PATCH 02/11] version database --- ports/cpp-pinyin/vcpkg.json | 34 +++++++++++++++++----------------- versions/baseline.json | 4 ++++ versions/c-/cpp-pinyin.json | 9 +++++++++ 3 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 versions/c-/cpp-pinyin.json diff --git a/ports/cpp-pinyin/vcpkg.json b/ports/cpp-pinyin/vcpkg.json index 7654ecbfe91991..07b23eedb70000 100644 --- a/ports/cpp-pinyin/vcpkg.json +++ b/ports/cpp-pinyin/vcpkg.json @@ -1,17 +1,17 @@ -{ - "name": "cpp-pinyin", - "version": "1.0.0", - "homepage": "https://github.com/wolfgitpr/cpp-pinyin", - "description": "A lightweight Chinese/Cantonese to Pinyin library.", - "license": "Apache-2.0", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } - ] -} \ No newline at end of file +{ + "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 + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 4121d1883ed954..baeb5da4fd9ae8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -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 diff --git a/versions/c-/cpp-pinyin.json b/versions/c-/cpp-pinyin.json new file mode 100644 index 00000000000000..2eff949d47d99c --- /dev/null +++ b/versions/c-/cpp-pinyin.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "65ed5e970724ce8a265398fe39f3a346f7a06d52", + "version": "1.0.0", + "port-version": 0 + } + ] +} From 2eb5d6248bc9da9321cd922db8ad083cb1a96da1 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 10:27:47 +0800 Subject: [PATCH 03/11] test fix static build --- ports/cpp-pinyin/portfile.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/cpp-pinyin/portfile.cmake b/ports/cpp-pinyin/portfile.cmake index 1489b6a377d41a..366cea9bf4cd3d 100644 --- a/ports/cpp-pinyin/portfile.cmake +++ b/ports/cpp-pinyin/portfile.cmake @@ -20,5 +20,9 @@ vcpkg_cmake_config_fixup(PACKAGE_NAME ${PORT} CONFIG_PATH lib/cmake/${PORT}) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin") +endif() + file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) \ No newline at end of file From 02b307b761f6ab4e317263d73eff08da6ca9c9d3 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 11:01:36 +0800 Subject: [PATCH 04/11] update version database --- versions/c-/cpp-pinyin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/c-/cpp-pinyin.json b/versions/c-/cpp-pinyin.json index 2eff949d47d99c..eb64ef6d48ff86 100644 --- a/versions/c-/cpp-pinyin.json +++ b/versions/c-/cpp-pinyin.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "65ed5e970724ce8a265398fe39f3a346f7a06d52", + "git-tree": "01820c37c425c0c99bd1d32ba8b26fe115661cb2", "version": "1.0.0", "port-version": 0 } From 62c629702301b874a2b566742858f296f3d3d8a6 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:41:55 +0800 Subject: [PATCH 05/11] Modify format --- ports/cpp-pinyin/portfile.cmake | 18 +++++++++--------- ports/cpp-pinyin/usage | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ports/cpp-pinyin/portfile.cmake b/ports/cpp-pinyin/portfile.cmake index 366cea9bf4cd3d..62f7472d650bae 100644 --- a/ports/cpp-pinyin/portfile.cmake +++ b/ports/cpp-pinyin/portfile.cmake @@ -1,14 +1,14 @@ vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO wolfgitpr/cpp-pinyin - REF "${VERSION}" - SHA512 cdd78cdc493ab352bfd7c5adfb4642bc587fb26f65b4d81a07e7c89c377222a30730f3e800f028106b66cbc35e32709c1a0e470e9737b6ee9718e3ce9da8137a - HEAD_REF main + OUT_SOURCE_PATH SOURCE_PATH + REPO wolfgitpr/cpp-pinyin + REF "${VERSION}" + SHA512 cdd78cdc493ab352bfd7c5adfb4642bc587fb26f65b4d81a07e7c89c377222a30730f3e800f028106b66cbc35e32709c1a0e470e9737b6ee9718e3ce9da8137a + HEAD_REF main ) vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS -DCPP_PINYIN_BUILD_STATIC=FALSE -DCPP_PINYIN_BUILD_TESTS=FALSE -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} @@ -16,7 +16,7 @@ vcpkg_cmake_configure( vcpkg_cmake_install() -vcpkg_cmake_config_fixup(PACKAGE_NAME ${PORT} CONFIG_PATH lib/cmake/${PORT}) +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") @@ -24,5 +24,5 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin") endif() -file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) \ No newline at end of file diff --git a/ports/cpp-pinyin/usage b/ports/cpp-pinyin/usage index 0779525d0c3c6d..186b25788dca6a 100644 --- a/ports/cpp-pinyin/usage +++ b/ports/cpp-pinyin/usage @@ -1,16 +1,16 @@ cpp-pinyin provides CMake targets: -find_package(cpp-pinyin CONFIG REQUIRED) -target_link_libraries(main PRIVATE cpp-pinyin::cpp-pinyin) + 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. + To use the library, you need to copy the dictionary files to the binary directory. -add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/cpp-pinyin/dict - $/dict -) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/cpp-pinyin/dict + $/dict + ) -To generate your own dictionary files, you can use the pinyin-makedict tool provided by cpp-pinyin. + To generate your own dictionary files, you can use the pinyin-makedict tool provided by cpp-pinyin. -https://github.com/wolfgitpr/pinyin-makedict \ No newline at end of file + https://github.com/wolfgitpr/pinyin-makedict From 028d69bee0af4ea374b96e5702f2c68d01a4e58b Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:42:14 +0800 Subject: [PATCH 06/11] update version database --- versions/c-/cpp-pinyin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/c-/cpp-pinyin.json b/versions/c-/cpp-pinyin.json index eb64ef6d48ff86..7ee73b83eccbfb 100644 --- a/versions/c-/cpp-pinyin.json +++ b/versions/c-/cpp-pinyin.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "01820c37c425c0c99bd1d32ba8b26fe115661cb2", + "git-tree": "c4bab2c85575f31dcd749b2fdf2b49eb9ad57a3e", "version": "1.0.0", "port-version": 0 } From 5b540990eaf55c32ab50a0e5f2e6db8ce30ae1f3 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:26:50 +0800 Subject: [PATCH 07/11] fix static build --- ports/cpp-pinyin/portfile.cmake | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ports/cpp-pinyin/portfile.cmake b/ports/cpp-pinyin/portfile.cmake index 62f7472d650bae..f02bef60d27409 100644 --- a/ports/cpp-pinyin/portfile.cmake +++ b/ports/cpp-pinyin/portfile.cmake @@ -6,13 +6,23 @@ vcpkg_from_github( HEAD_REF main ) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DCPP_PINYIN_BUILD_STATIC=FALSE - -DCPP_PINYIN_BUILD_TESTS=FALSE - -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} -) +if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCPP_PINYIN_BUILD_STATIC=TRUE + -DCPP_PINYIN_BUILD_TESTS=FALSE + -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} + ) +elseif (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCPP_PINYIN_BUILD_STATIC=FALSE + -DCPP_PINYIN_BUILD_TESTS=FALSE + -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} + ) +endif() vcpkg_cmake_install() @@ -20,9 +30,5 @@ vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin") -endif() - vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") -configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) \ No newline at end of file +configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) From 2170a30db19a21f316bd3de3428b956f71bfee04 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:26:58 +0800 Subject: [PATCH 08/11] update version database --- versions/c-/cpp-pinyin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/c-/cpp-pinyin.json b/versions/c-/cpp-pinyin.json index 7ee73b83eccbfb..92d7b118b4d24c 100644 --- a/versions/c-/cpp-pinyin.json +++ b/versions/c-/cpp-pinyin.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "c4bab2c85575f31dcd749b2fdf2b49eb9ad57a3e", + "git-tree": "63bc214f34d1acbbbdcd3a8307b1020d70b2e653", "version": "1.0.0", "port-version": 0 } From 366d7e23f59d6c85d79394b9c8867e9eaeafe2be Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:45:15 +0800 Subject: [PATCH 09/11] Update ports/cpp-pinyin/portfile.cmake Co-authored-by: Kai Pastor --- ports/cpp-pinyin/portfile.cmake | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/ports/cpp-pinyin/portfile.cmake b/ports/cpp-pinyin/portfile.cmake index f02bef60d27409..30b6a6101aa125 100644 --- a/ports/cpp-pinyin/portfile.cmake +++ b/ports/cpp-pinyin/portfile.cmake @@ -6,23 +6,15 @@ vcpkg_from_github( HEAD_REF main ) -if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") - vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DCPP_PINYIN_BUILD_STATIC=TRUE - -DCPP_PINYIN_BUILD_TESTS=FALSE - -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} - ) -elseif (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DCPP_PINYIN_BUILD_STATIC=FALSE - -DCPP_PINYIN_BUILD_TESTS=FALSE - -DVCPKG_DICT_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} - ) -endif() +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() From b59b9ed9cbb90e2d273a8baf891027f1b7d766ac Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:45:23 +0800 Subject: [PATCH 10/11] Update ports/cpp-pinyin/usage Co-authored-by: Kai Pastor --- ports/cpp-pinyin/usage | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ports/cpp-pinyin/usage b/ports/cpp-pinyin/usage index 186b25788dca6a..23b6a783d6dc56 100644 --- a/ports/cpp-pinyin/usage +++ b/ports/cpp-pinyin/usage @@ -1,16 +1,12 @@ cpp-pinyin provides CMake targets: - find_package(cpp-pinyin CONFIG REQUIRED) - target_link_libraries(main PRIVATE cpp-pinyin::cpp-pinyin) + 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. +To use the library, you need to copy the dictionary files to the binary directory. - add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/cpp-pinyin/dict - $/dict - ) - - To generate your own dictionary files, you can use the pinyin-makedict tool provided by cpp-pinyin. - - https://github.com/wolfgitpr/pinyin-makedict + add_custom_command(TARGET main POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory + "${cpp-pinyin_DIR}/dict" + "$/dict" + ) From 79eabb371590169157101c05dd749678de693a46 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:46:31 +0800 Subject: [PATCH 11/11] update version database --- versions/c-/cpp-pinyin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/c-/cpp-pinyin.json b/versions/c-/cpp-pinyin.json index 92d7b118b4d24c..592b2b3010e191 100644 --- a/versions/c-/cpp-pinyin.json +++ b/versions/c-/cpp-pinyin.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "63bc214f34d1acbbbdcd3a8307b1020d70b2e653", + "git-tree": "f3a4b0cc31a8acaecebdee019de6f0a07b45037a", "version": "1.0.0", "port-version": 0 }