From 7f748ceb18646814f4ff01a9a2c7d91b62f16cba Mon Sep 17 00:00:00 2001 From: kaoru Date: Fri, 18 Oct 2024 13:36:51 +0800 Subject: [PATCH] use vcpkg ports for rapidjson --- ports/rlottie/portfile.cmake | 2 +- ports/rlottie/vcpkg.json | 5 +- ...me-and-modify-pixman.patch => vcpkg.patch} | 186 +++++++++--------- versions/r-/rlottie.json | 2 +- 4 files changed, 99 insertions(+), 96 deletions(-) rename ports/rlottie/{0001-export-runtime-and-modify-pixman.patch => vcpkg.patch} (72%) diff --git a/ports/rlottie/portfile.cmake b/ports/rlottie/portfile.cmake index ecb72c0141741c..ed244a24d4e40d 100644 --- a/ports/rlottie/portfile.cmake +++ b/ports/rlottie/portfile.cmake @@ -4,7 +4,7 @@ vcpkg_from_github( REF e3026b1e1a516fff3c22d2b1b9f26ec864f89a82 SHA512 3b9985606d9c475e77ecb018cfe65cde1170f10e9d2c3e18b60178d3954a4870e5141aa06bb79e803fcdbcf98742bcf72a359625a3b1409125ec3a4a1b0126c4 PATCHES - 0001-export-runtime-and-modify-pixman.patch + vcpkg.patch ) vcpkg_cmake_configure( diff --git a/ports/rlottie/vcpkg.json b/ports/rlottie/vcpkg.json index 53953872dd97a0..fb3b28eecd8b32 100644 --- a/ports/rlottie/vcpkg.json +++ b/ports/rlottie/vcpkg.json @@ -4,10 +4,7 @@ "description": "A platform independent standalone library that plays Lottie Animation.", "homepage": "https://github.com/Samsung/rlottie", "dependencies": [ - { - "name": "freetype", - "default-features": false - }, + "rapidjson", { "name": "vcpkg-cmake", "host": true diff --git a/ports/rlottie/0001-export-runtime-and-modify-pixman.patch b/ports/rlottie/vcpkg.patch similarity index 72% rename from ports/rlottie/0001-export-runtime-and-modify-pixman.patch rename to ports/rlottie/vcpkg.patch index c127d57cba366f..316e11779b3460 100644 --- a/ports/rlottie/0001-export-runtime-and-modify-pixman.patch +++ b/ports/rlottie/vcpkg.patch @@ -1,90 +1,96 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 38a9862..3bb9d39 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -75,8 +75,6 @@ endif() - - if (WIN32 AND NOT BUILD_SHARED_LIBS) - target_compile_definitions(rlottie PUBLIC -DRLOTTIE_BUILD=0) -- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") -- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") - endif() - - #declare dependancy -@@ -88,13 +86,6 @@ target_link_libraries(rlottie - "${CMAKE_THREAD_LIBS_INIT}" - ) - --if (NOT APPLE AND NOT WIN32) -- target_link_libraries(rlottie -- PRIVATE -- "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/rlottie.expmap" -- ) --endif() -- - if (LOTTIE_MODULE) - # for dlopen, dlsym and dlclose dependancy - target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS}) -@@ -165,6 +156,7 @@ install( TARGETS rlottie EXPORT rlottie-targets - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} - INCLUDES DESTINATION include -+ RUNTIME DESTINATION bin - ) - - #install config file. -diff --git a/src/vector/freetype/CMakeLists.txt b/src/vector/freetype/CMakeLists.txt -index add0d42..d7d487d 100644 ---- a/src/vector/freetype/CMakeLists.txt -+++ b/src/vector/freetype/CMakeLists.txt -@@ -1,11 +1,2 @@ --target_sources(rlottie -- PRIVATE -- "${CMAKE_CURRENT_LIST_DIR}/v_ft_math.cpp" -- "${CMAKE_CURRENT_LIST_DIR}/v_ft_raster.cpp" -- "${CMAKE_CURRENT_LIST_DIR}/v_ft_stroker.cpp" -- ) -- --target_include_directories(rlottie -- PRIVATE -- "${CMAKE_CURRENT_LIST_DIR}" -- ) -+find_package(Freetype REQUIRED) -+target_link_libraries(rlottie PRIVATE Freetype::Freetype) -diff --git a/src/vector/vdrawhelper_neon.cpp b/src/vector/vdrawhelper_neon.cpp -index 681eabb..e178012 100644 ---- a/src/vector/vdrawhelper_neon.cpp -+++ b/src/vector/vdrawhelper_neon.cpp -@@ -2,28 +2,20 @@ - - #include "vdrawhelper.h" - --extern "C" void pixman_composite_src_n_8888_asm_neon(int32_t w, int32_t h, -- uint32_t *dst, -- int32_t dst_stride, -- uint32_t src); -- --extern "C" void pixman_composite_over_n_8888_asm_neon(int32_t w, int32_t h, -- uint32_t *dst, -- int32_t dst_stride, -- uint32_t src); -- - void memfill32(uint32_t *dest, uint32_t value, int length) - { -- pixman_composite_src_n_8888_asm_neon(length, 1, dest, length, value); -+ memset(dest, value, length); - } - - static void color_SourceOver(uint32_t *dest, int length, - uint32_t color, - uint32_t const_alpha) - { -+ int ialpha, i; - if (const_alpha != 255) color = BYTE_MUL(color, const_alpha); - -- pixman_composite_over_n_8888_asm_neon(length, 1, dest, length, color); -+ ialpha = 255 - vAlpha(color); -+ for (i = 0; i < length; ++i) dest[i] = color + BYTE_MUL(dest[i], ialpha); - } - - void RenderFuncTable::neon() +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 38a9862..eca77d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,6 +16,10 @@ endif() + add_library( rlottie ) + set_target_properties( rlottie PROPERTIES DEFINE_SYMBOL RLOTTIE_BUILD ) + ++#use vcpkg ports ++find_package(RapidJSON CONFIG REQUIRED) ++target_link_libraries(rlottie PRIVATE rapidjson) ++ + #declare version of the target + set(player_version_major 0) + set(player_version_minor 2) +@@ -75,8 +79,6 @@ endif() + + if (WIN32 AND NOT BUILD_SHARED_LIBS) + target_compile_definitions(rlottie PUBLIC -DRLOTTIE_BUILD=0) +- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") +- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + endif() + + #declare dependancy +@@ -88,13 +90,6 @@ target_link_libraries(rlottie + "${CMAKE_THREAD_LIBS_INIT}" + ) + +-if (NOT APPLE AND NOT WIN32) +- target_link_libraries(rlottie +- PRIVATE +- "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/rlottie.expmap" +- ) +-endif() +- + if (LOTTIE_MODULE) + # for dlopen, dlsym and dlclose dependancy + target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS}) +@@ -165,6 +160,7 @@ install( TARGETS rlottie EXPORT rlottie-targets + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + INCLUDES DESTINATION include ++ RUNTIME DESTINATION bin + ) + + #install config file. +diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp +index b33effa..c7bb421 100644 +--- a/src/lottie/lottieparser.cpp ++++ b/src/lottie/lottieparser.cpp +@@ -56,7 +56,7 @@ + #include + + #include "lottiemodel.h" +-#include "rapidjson/document.h" ++#include + #include "zip/zip.h" + + RAPIDJSON_DIAG_PUSH +diff --git a/src/vector/vdrawhelper_neon.cpp b/src/vector/vdrawhelper_neon.cpp +index 681eabb..e178012 100644 +--- a/src/vector/vdrawhelper_neon.cpp ++++ b/src/vector/vdrawhelper_neon.cpp +@@ -2,28 +2,20 @@ + + #include "vdrawhelper.h" + +-extern "C" void pixman_composite_src_n_8888_asm_neon(int32_t w, int32_t h, +- uint32_t *dst, +- int32_t dst_stride, +- uint32_t src); +- +-extern "C" void pixman_composite_over_n_8888_asm_neon(int32_t w, int32_t h, +- uint32_t *dst, +- int32_t dst_stride, +- uint32_t src); +- + void memfill32(uint32_t *dest, uint32_t value, int length) + { +- pixman_composite_src_n_8888_asm_neon(length, 1, dest, length, value); ++ memset(dest, value, length); + } + + static void color_SourceOver(uint32_t *dest, int length, + uint32_t color, + uint32_t const_alpha) + { ++ int ialpha, i; + if (const_alpha != 255) color = BYTE_MUL(color, const_alpha); + +- pixman_composite_over_n_8888_asm_neon(length, 1, dest, length, color); ++ ialpha = 255 - vAlpha(color); ++ for (i = 0; i < length; ++i) dest[i] = color + BYTE_MUL(dest[i], ialpha); + } + + void RenderFuncTable::neon() diff --git a/versions/r-/rlottie.json b/versions/r-/rlottie.json index 19d2ce736fa1dc..a0547621c005c0 100644 --- a/versions/r-/rlottie.json +++ b/versions/r-/rlottie.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "1f320830fd26ad55a123e4fccf39ecee79e659a0", + "git-tree": "240aaf05996e3b5e5e3de0df92448bf60a5546c2", "version-date": "2024-08-26", "port-version": 0 }