diff --git a/thirdparty/libwebp/OAT.xml b/thirdparty/libwebp/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..59bfaa37935f10e40e862ab0f657aa7f0bbc2823 --- /dev/null +++ b/thirdparty/libwebp/OAT.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/libwebp/README.OpenSource b/thirdparty/libwebp/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..7fdec81dd196e264b328a3c353eba37d047f7fe7 --- /dev/null +++ b/thirdparty/libwebp/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libwebp", + "License": "BSD-3-Clause license", + "License File": "https://github.com/webmproject/libwebp/blob/main/COPYING", + "Version Number": "v1.3.1", + "Owner": "1596268623@qq.com", + "Upstream URL": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.1.tar.gz", + "Description": "WebP codec is a library to encode and decode images in WebP format. This package contains the library that can be used in other programs to add WebP support, as well as the command line tools 'cwebp' and 'dwebp' to compress and decompress images respectively." + } +] diff --git a/thirdparty/libwebp/README_zh.md b/thirdparty/libwebp/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..b9c9d8cef17dc183d483dbd427501abb604f1e07 --- /dev/null +++ b/thirdparty/libwebp/README_zh.md @@ -0,0 +1,12 @@ +# libwebp 三方库说明 +## 功能简介 +WebP 编解码器是一个用于编码和解码 WebP 格式图像的库。该软件包包含可用于其他程序以添加WebP支持的库,以及分别用于压缩和解压缩图像的命令行工具“cwebp”和“dwebp”。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Release +- SDK版本:ohos_sdk_public 4.0.8.1 (API Version 9 Release) +- 三方库版本:v1.3.1 +- WebP 编解码器是一个用于编码和解码 WebP 格式图像的库。该软件包包含可用于其他程序以添加WebP支持的库,以及分别用于压缩和解压缩图像的命令行工具“cwebp”和“dwebp”。 +- [GNU Library General Public License](https://github.com/webmproject/libwebp/blob/main/COPYING) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/libwebp/docs/hap_integrate.md b/thirdparty/libwebp/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..9383193c88c8a058e3013dd21c3f45e5dbc5f51a --- /dev/null +++ b/thirdparty/libwebp/docs/hap_integrate.md @@ -0,0 +1,88 @@ +# libwebp集成到应用hap +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- ubuntu20.04 +- [OpenHarmony3.2Release镜像](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fdayu200_standard_arm32.tar.gz) +- [ohos_sdk_public 4.0.8.1 (API Version 10 Release)](https://gitee.com/link?target=http%3A%2F%2Fdownload.ci.openharmony.cn%2Fversion%2FMaster_Version%2FOpenHarmony_4.0.8.1%2F20230608_091058%2Fversion-Master_Version-OpenHarmony_4.0.8.1-20230608_091058-ohos-sdk-public.tar.gz) +- [DevEco Studio 3.1 Release](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2F81%2Fv3%2FtgRUB84wR72nTfE8Ir_xMw%2Fdevecostudio-windows-3.1.0.501.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230621T074329Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../tools/README.md#编译环境准备) +- [准备三方库测试环境](../../../tools/README.md#ci环境准备) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libwebp #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将三方库拷贝至tools/main目录下 + ```shell + cd tpc_c_cplusplus + mkdir -p tools/main + cp thirdparty/libpng tools/main/ -rf + cp thirdparty/libwebp tools/main/ -rf + cp thirdparty/libjpeg-turbo tools/main/ -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh libwebp libpng libjpeg-turbo + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + libwebp/arm64-v8a + libwebp/armeabi-v7a + libpng/arm64-v8a + libpng/armeabi-v7a + libjpeg-turbo/arm64-v8a + libjpeg-turbo/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示 + ![thirdparty_install_dir](pic/install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + +``` +#将三方库加入工程中 +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libjpeg.a) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libturbojpeg.a) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libpng.a) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libpng16.a) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libsharpyuv.so) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libwebp.so) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libwebpdecoder.so) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libwebpdemux.so) +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libwebpmux.so) +#将三方库的头文件加入工程中 +target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/include) +target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/include) +target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/include) +``` + ![thirdparty_usage](pic/usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试 + +进入到构建目录获取,执行ctest,运行测试用例(libwebp-arm64-v8a-build为构建64位的目录,libwebp-armeabi-v7a-build为构建32位的目录) + ![thirdparty_test_result](pic/test_result.png) + + +## 参考资料 +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [通过DevEco Studio开发一个NAPI工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) diff --git a/thirdparty/libwebp/docs/pic/install_dir.png b/thirdparty/libwebp/docs/pic/install_dir.png new file mode 100755 index 0000000000000000000000000000000000000000..69df7204b9585b9b5fbbedc67f1aa8eb7c5bb7b7 Binary files /dev/null and b/thirdparty/libwebp/docs/pic/install_dir.png differ diff --git a/thirdparty/libwebp/docs/pic/test_result.png b/thirdparty/libwebp/docs/pic/test_result.png new file mode 100755 index 0000000000000000000000000000000000000000..68e54d0603f11309e9aedbcc0844eab26a6446b4 Binary files /dev/null and b/thirdparty/libwebp/docs/pic/test_result.png differ diff --git a/thirdparty/libwebp/docs/pic/usage.png b/thirdparty/libwebp/docs/pic/usage.png new file mode 100755 index 0000000000000000000000000000000000000000..98867b6a1d8b1bd6d6258d677c44243b56b4b0a8 Binary files /dev/null and b/thirdparty/libwebp/docs/pic/usage.png differ