From e3497b6ae5ad161419857798068a1d1964d237e2 Mon Sep 17 00:00:00 2001 From: Kaoru Date: Fri, 1 Nov 2024 14:25:01 +0800 Subject: [PATCH] [rlottie]: add new port (#41890) --- ports/rlottie/portfile.cmake | 24 ++++++++ ports/rlottie/vcpkg.json | 17 ++++++ ports/rlottie/vcpkg.patch | 106 +++++++++++++++++++++++++++++++++++ versions/baseline.json | 4 ++ versions/r-/rlottie.json | 9 +++ 5 files changed, 160 insertions(+) create mode 100644 ports/rlottie/portfile.cmake create mode 100644 ports/rlottie/vcpkg.json create mode 100644 ports/rlottie/vcpkg.patch create mode 100644 versions/r-/rlottie.json diff --git a/ports/rlottie/portfile.cmake b/ports/rlottie/portfile.cmake new file mode 100644 index 0000000000..4b91e4f10e --- /dev/null +++ b/ports/rlottie/portfile.cmake @@ -0,0 +1,24 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Samsung/rlottie + REF e3026b1e1a516fff3c22d2b1b9f26ec864f89a82 + SHA512 3b9985606d9c475e77ecb018cfe65cde1170f10e9d2c3e18b60178d3954a4870e5141aa06bb79e803fcdbcf98742bcf72a359625a3b1409125ec3a4a1b0126c4 + PATCHES + vcpkg.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DLIB_INSTALL_DIR=lib + -DLOTTIE_MODULE=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/rlottie") +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/AUTHORS") diff --git a/ports/rlottie/vcpkg.json b/ports/rlottie/vcpkg.json new file mode 100644 index 0000000000..fb3b28eecd --- /dev/null +++ b/ports/rlottie/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "rlottie", + "version-date": "2024-08-26", + "description": "A platform independent standalone library that plays Lottie Animation.", + "homepage": "https://github.com/Samsung/rlottie", + "dependencies": [ + "rapidjson", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/rlottie/vcpkg.patch b/ports/rlottie/vcpkg.patch new file mode 100644 index 0000000000..9f311e4f2c --- /dev/null +++ b/ports/rlottie/vcpkg.patch @@ -0,0 +1,106 @@ +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/CMakeLists.txt b/src/vector/CMakeLists.txt +index 3ae96e6..15b86df 100644 +--- a/src/vector/CMakeLists.txt ++++ b/src/vector/CMakeLists.txt +@@ -1,5 +1,4 @@ + add_subdirectory(freetype) +-add_subdirectory(pixman) + add_subdirectory(stb) + + +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/baseline.json b/versions/baseline.json index b500bf5598..c5f5ef0176 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7932,6 +7932,10 @@ "baseline": "1.14.2", "port-version": 0 }, + "rlottie": { + "baseline": "2024-08-26", + "port-version": 0 + }, "rmlui": { "baseline": "6.0", "port-version": 1 diff --git a/versions/r-/rlottie.json b/versions/r-/rlottie.json new file mode 100644 index 0000000000..ff95b3f857 --- /dev/null +++ b/versions/r-/rlottie.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "df335ab1c8bf80f06eecb4df7b3a6d57f1a5d8b3", + "version-date": "2024-08-26", + "port-version": 0 + } + ] +}