diff --git a/thirdparty/jasper/HPKBUILD b/thirdparty/jasper/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c3b82556ac9395761a4e7da8f8d631a355e52231 --- /dev/null +++ b/thirdparty/jasper/HPKBUILD @@ -0,0 +1,58 @@ + +# Contributor: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> + +pkgname=jasper +pkgver=version-4.0.0 +pkgrel=0 +pkgdesc="" +url= +archs=("armeabi-v7a" "arm64-v8a") +license=("jasper license files") +depends=("libjpeg-turbo") +makedepends=() +install=usr +source="https://github.com/${pkgname}-software/${pkgname}/archive/refs/tags/${pkgver}.tar.gz" + +builddir=${pkgname}-${pkgver} +packagename=${builddir}.tar.gz +autounpack=true +downloadpackage=true +patchflag=true +buildtools="cmake" + +prepare() { + mkdir -p ${builddir}/${ARCH}-build + if [ $patchflag == true ]; then + cd ${builddir} + patch -p1 < ../jasper_oh_pkg.patch + + patchflag=false + cd $OLDPWD + fi +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=${ARCH} -DJAS_ENABLE_SHARED=OFF -DJAS_STDC_VERSION=199901L -B${ARCH}-build -S./ -L > `pwd`/${ARCH}-build/build.log 2>&1 + make -j4 -C ${ARCH}-build >> `pwd`/${ARCH}-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd ${builddir} + make -C ${ARCH}-build install >> `pwd`/${ARCH}-build/build.log 2>&1 + cd ${OLDPWD} +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test CMD + # ctest +} + +cleanbuild(){ + rm -rf ${PWD}/${builddir} #${PWD}/$packagename +} diff --git a/thirdparty/jasper/README.OpenSource b/thirdparty/jasper/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..3b49d97f1bd9726bea5b626da7479ef0916a2d87 --- /dev/null +++ b/thirdparty/jasper/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "Jasper", + "License": "Jasper license file", + "License File": "LICENSE.txt", + "Version Number": "4.0.0", + "Owner": "zhongluping1@huawei.com", + "Upstream URL": "https://github.com/jasper-software/jasper/tree/version-4.0.0", + "Description": " JasPer is a collection of software (i.e., a library and application programs) for the coding and manipulation of images" + } +] diff --git a/thirdparty/jasper/README_zh.md b/thirdparty/jasper/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..25cdfc5a2b27233c9fb18c72e8e15e6258b07365 --- /dev/null +++ b/thirdparty/jasper/README_zh.md @@ -0,0 +1,17 @@ +# JasPer 三方库说明 + +## 功能简介 + +JasPer是一个用于图像编码和操作的软件集合. + +## 使用约束 + +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:4.0.0 +- 当前适配的功能:支持图像编码和读写操作。 +- [jasper license files](https://github.com/jasper-software/jasper/blob/master/LICENSE.txt) + +## 集成方式 + +- [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/jasper/SHA512SUM b/thirdparty/jasper/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d0908b4969db4e1c01ea59a4109ef811a1a9f001 --- /dev/null +++ b/thirdparty/jasper/SHA512SUM @@ -0,0 +1 @@ +dc03434870e85b1fdbdf41a3e07ce5a8044c8d225717d3d7a5969d45e3bd716bfb2abc4b4e0b8cec2f4071a7520c5d3e48939dba0cabe6d192eacd593de0c563 jasper-version-4.0.0.tar.gz diff --git a/thirdparty/jasper/docs/hap_integrate.md b/thirdparty/jasper/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..9b7059b5646b5e29e985957715df35ac606bb658 --- /dev/null +++ b/thirdparty/jasper/docs/hap_integrate.md @@ -0,0 +1,96 @@ +# jasper 集成到应用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 3.2.11.9 (API Version 9 Release)](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fohos-sdk-windows_linux-public.tar.gz) +- [DevEco Studio 3.1 Beta2](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2Ff3%2Fv3%2FuJyuq3syQ2ak4hE1QZmAug%2Fdevecostudio-windows-3.1.0.400.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230408T013335Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70) +- [准备三方库构建环境](../../../tools/README.md#编译环境准备) +- [准备三方库测试环境](../../../tools/README.md#ci环境准备) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/jasper # 三方库jasper的目录结构如下 + ├── docs # 三方库相关文档的文件夹 + ├── HPKBUILD # 构建脚本 + ├── SHA512SUM # 三方库校验文件 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将jasper拷贝至tools/main目录下 + + jasper编译依赖了`libjpeg-turbo`,因此编译时需要同时[编译`libjpeg-turbo`](../../libjpeg-turbo) + + ```shell + cd tpc_c_cplusplus + cp thirdparty/jasper tools/main -rf ## 拷贝jasper三方库 + cp thirdparty/libjpeg-turbo tools/main -rf ## 拷贝jasper依赖库libjpeg-turbo + ``` + +- 在tools目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + + ```shell + cd tools + ./build.sh jasper libjpeg-turbo + ``` + +- 三方库头文件及生成的库 + + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + jasper/arm64-v8a jasper/armeabi-v7a libjpeg-turbo/arm64-v8a libjpeg-turbo/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](pic/jasper_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + # 将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jasper/${OHOS_ARCH}/lib/libjasper.a) + # 将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jasper/${OHOS_ARCH}/include) + # 将三方库的依赖库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/lib/libjpeg.a) + # 将三方库的依赖库头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/include) + ``` + + ![jasper_usage](pic/jasper_usage.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![jasper_test](pic/jasper_test.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/jasper/docs/pic/jasper_install_dir.png b/thirdparty/jasper/docs/pic/jasper_install_dir.png new file mode 100755 index 0000000000000000000000000000000000000000..cefab25c930e35f00ffc63299d91cc29fdbb2603 Binary files /dev/null and b/thirdparty/jasper/docs/pic/jasper_install_dir.png differ diff --git a/thirdparty/jasper/docs/pic/jasper_test.png b/thirdparty/jasper/docs/pic/jasper_test.png new file mode 100755 index 0000000000000000000000000000000000000000..edba1b27becd2395583f41e629861d6edd8c9b28 Binary files /dev/null and b/thirdparty/jasper/docs/pic/jasper_test.png differ diff --git a/thirdparty/jasper/docs/pic/jasper_usage.png b/thirdparty/jasper/docs/pic/jasper_usage.png new file mode 100755 index 0000000000000000000000000000000000000000..bb2c232dd93373f3f1527e138c9a9cedd1d7c988 Binary files /dev/null and b/thirdparty/jasper/docs/pic/jasper_usage.png differ diff --git a/thirdparty/jasper/jasper_oh_pkg.patch b/thirdparty/jasper/jasper_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..a22116d39e2fd6db1cce92d5ea45c285a9bff9dc --- /dev/null +++ b/thirdparty/jasper/jasper_oh_pkg.patch @@ -0,0 +1,11 @@ +diff -Naur jasper-version-4.0.0/CMakeLists.txt jasper_patch/CMakeLists.txt +--- jasper-version-4.0.0/CMakeLists.txt 2022-11-06 01:06:53.000000000 +0800 ++++ jasper_patch/CMakeLists.txt 2023-05-09 11:44:01.636103253 +0800 +@@ -724,6 +724,7 @@ + set(JAS_HAVE_LIBJPEG 0) + set(JAS_LIBJPEG_TARGET) + if(JAS_ENABLE_LIBJPEG) ++ set(JPEG_NAMES libjpeg.a) + find_package(JPEG) + if (TARGET JPEG::JPEG) + # In some versions of the JPEG library, the header file jpeglib.h