diff --git a/thirdparty/tinyexr/HPKBUILD b/thirdparty/tinyexr/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..990dfddb683187e01473ef5cd87a0ddc36b08197 --- /dev/null +++ b/thirdparty/tinyexr/HPKBUILD @@ -0,0 +1,77 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han + +pkgname=tinyexr +pkgver=v1.0.2 +pkgrel=0 +pkgdesc="Tiny OpenEXR image loader/saver library" +url="https://github.com/syoyo/tinyexr" +archs=("armeabi-v7a" "arm64-v8a") +license=("3-clause BSD" "public domain") +depends=() +makedepends=() +install= +source="https://github.com/syoyo/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +patchflag=true + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../tinyexr_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -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 + # 源库Makefile没有make install,这里手动copy到usr目录 + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/include/ + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + cp tinyexr.h deps/miniz/miniz.h $LYCIUM_ROOT/usr/$pkgname/$ARCH/include/ + cp $ARCH-build/libminiz.a $ARCH-build/libtinyexr.a $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # test CMD + # ./test_tinyexr .././transparent.exr + # Load EXR err: Loading multipart or DeepImage is not supported in LoadEXR() API(code -4) + # ./test_tinyexr .././asakusa.exr + # Wrote output.exr. + # ./test_tinyexr .././test/unit/regression/日本語.exr + # Wrote output.exr. + # ./test_tinyexr ../././test/unit/regression/tiled_half_1x1_alpha.exr + # Wrote output.exr. + # ./test_tinyexr .././test/unit/regression/flaga.exr + # Load EXR err: Layer Not Found. Seems EXR contains channels with layer(e.g. `diffuse.R`). if you are using LoadEXR(), please try LoadEXRWithLayer(). LoadEXR() cannot load EXR having channels with layer.(code -13) + # ./test_tinyexr .././test/unit/regression/piz-bug-issue-100.exr + # Wrote output.exr. + # ./test_tinyexr .././test/unit/regression/2by2.exr + # Wrote output.exr. + # ./test_tinyexr .././test/unit/regression/issue-160-piz-decode.exr +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/tinyexr/README.OpenSource b/thirdparty/tinyexr/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..a42474094ca828b967ee1f04080dc60427efaa90 --- /dev/null +++ b/thirdparty/tinyexr/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "tinyexr", + "License": "3-clause BSD" "public domain", + "License File": "License.txt", + "Version Number": "v1.0.2", + "Owner": "chenbaodi@huawei.com", + "Upstream URL": "https://github.com/syoyo/tinyexr/archive/refs/tags/v1.0.2.tar.gz", + "Description": "Tiny OpenEXR image loader/saver library" + } +] diff --git a/thirdparty/tinyexr/README_zh.md b/thirdparty/tinyexr/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..1340911c331008e45460ee4ed27dc7782f6f857c --- /dev/null +++ b/thirdparty/tinyexr/README_zh.md @@ -0,0 +1,12 @@ +# tinyexr三方库说明 +## 功能简介 +tinyexr是加载和保存OpenEXR(.exr) 映像的小型库。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Release +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:v1.0.2 +- 当前适配的功能:支持加载和保存OpenEXR的能力 +- [3-clause BSD/public domain](https://github.com/syoyo/tinyexr#readme) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/tinyexr/SHA512SUM b/thirdparty/tinyexr/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..cbc89fe052eb5841a655569b954b4ccde48ac358 --- /dev/null +++ b/thirdparty/tinyexr/SHA512SUM @@ -0,0 +1,2 @@ +af4a9150eb1e205ec4b6c75529446c24f9e67a9f1f35a391d97a2d3f850ea085a8ee16134c2d866b90821bba5e878562b8c45046c55d815a7a88068c38dd217a tinyexr-1.0.2.tar.gz +59e15ba8b81e3e17827756404de30d9abaaa319c0e67dff3eb1ed9f51967ea8b5ed0495a20e18c27b79b5081468422425a6428ae2a7123c0ed39967a579482f2 tinyexr_oh_pkg.patch diff --git a/thirdparty/tinyexr/docs/hap_integrate.md b/thirdparty/tinyexr/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..8629bb1415743f8eb83a4a8a29f5550ad68b71b5 --- /dev/null +++ b/thirdparty/tinyexr/docs/hap_integrate.md @@ -0,0 +1,81 @@ +# tinyexr集成到应用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环境准备) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/tinyexr #三方库tinyexr的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将tinyexr拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/tinyexr tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh tinyexr + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + tinyexr-arm64-v8a-install tinyexr-armeabi-v7a-install + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 +  + + ![thirdparty_install_dir](pic/tinyexr_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyexr/${OHOS_ARCH}/lib/libtinyexr.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyexr/${OHOS_ARCH}/lib/libminiz.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyexr-${OHOS_ARCH}-install/include) + ``` + ![tinyexr_usage](pic/tinyexr_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试 + +进入到构建目录,执行 +``` +./test_tinyexr .././transparent.exr +./test_tinyexr .././asakusa.exr +./test_tinyexr .././test/unit/regression/日本語.exr +./test_tinyexr ../././test/unit/regression/tiled_half_1x1_alpha.exr +./test_tinyexr .././test/unit/regression/flaga.exr +./test_tinyexr .././test/unit/regression/piz-bug-issue-100.exr +./test_tinyexr .././test/unit/regression/2by2.exr +./test_tinyexr .././test/unit/regression/issue-160-piz-decode.exr +``` +查看结果(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![tinyexr_test](pic/tinyexr_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/tinyexr/docs/pic/tinyexr_install_dir.png b/thirdparty/tinyexr/docs/pic/tinyexr_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..92a91e1e3e60e882b4a7fedb3264c893993da1e1 Binary files /dev/null and b/thirdparty/tinyexr/docs/pic/tinyexr_install_dir.png differ diff --git a/thirdparty/tinyexr/docs/pic/tinyexr_test.png b/thirdparty/tinyexr/docs/pic/tinyexr_test.png new file mode 100644 index 0000000000000000000000000000000000000000..812cb260e69c2cbd3aeb859b353c4b2db85f5791 Binary files /dev/null and b/thirdparty/tinyexr/docs/pic/tinyexr_test.png differ diff --git a/thirdparty/tinyexr/docs/pic/tinyexr_usage.png b/thirdparty/tinyexr/docs/pic/tinyexr_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..d255313f9a4acc8129581ddf97e494f65abb860b Binary files /dev/null and b/thirdparty/tinyexr/docs/pic/tinyexr_usage.png differ diff --git a/thirdparty/tinyexr/tinyexr_oh_pkg.patch b/thirdparty/tinyexr/tinyexr_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..8e80fce6b192541ed3b41759867a90159e0b5e0b --- /dev/null +++ b/thirdparty/tinyexr/tinyexr_oh_pkg.patch @@ -0,0 +1,12 @@ +diff -rupN tinyexr-1.0.2/CMakeLists.txt tinyexr-1.0.2_patch/CMakeLists.txt +--- tinyexr-1.0.2/CMakeLists.txt 2022-12-28 17:12:46.000000000 +0800 ++++ tinyexr-1.0.2_patch/CMakeLists.txt 2023-04-21 17:06:43.275414969 +0800 +@@ -43,7 +43,7 @@ target_link_libraries(${BUILD_TARGET} ${ + + # Increase warning level for clang. + IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set_source_files_properties(${TINYEXR_SOURCES} PROPERTIES COMPILE_FLAGS "-Weverything -Werror -Wno-padded -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function") ++ set_source_files_properties(${TINYEXR_SOURCES} PROPERTIES COMPILE_FLAGS "-Weverything -Wno-padded -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function") + ENDIF () + + if (TINYEXR_BUILD_SAMPLE)