diff --git a/thirdparty/lcms2/HPKBUILD b/thirdparty/lcms2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..a15c1d18e6dfe54e9cdda338d2ce56b22c199419 --- /dev/null +++ b/thirdparty/lcms2/HPKBUILD @@ -0,0 +1,80 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=lcms2 +pkgver=2.15 +pkgrel=0 +pkgdesc="Little cms is a color management library. Implements fast transforms between ICC profiles. It is focused on speed, and is portable across several platforms." +url="https://sourceforge.net/projects/lcms/" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() + +source="https://sourceforge.net/projects/lcms/files/lcms/$pkgver/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz +buildtools="configure" + +source envset.sh + +host= +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host="--host=arm-linux" + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host="--host=aarch64-linux" + fi +} + +build() { + cd $builddir/$ARCH-build + ../configure "$@" $host > `pwd`/build.log 2>&1 + make -j4 >> `pwd`/build.log 2>&1 + res=$? + cd $OLDPWD + return $res +} + +package() { + + cd $builddir/$ARCH-build + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + unset host + +} + +check() { + cd $builddir/$ARCH-build + # 原库的check将构建测试和执行测试合并在一起了,这里将构建测试和执行测试进行分离,构建测试不变,执行测试修改成check-TESTS + sed -i 's/check:$/check-TESTS:/g' testbed/Makefile + make check >> `pwd`/build.log 2>&1 + res=$? + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # 上板测试,进入到构建目录下执行 + # make check-TESTS -C testbed + return $res +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/lcms2/README.OpenSource b/thirdparty/lcms2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..ff2e227f0e961f2e698e4a20195028c1d9a3da26 --- /dev/null +++ b/thirdparty/lcms2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "lcms2", + "License": " MIT license", + "License File": "COPYING", + "Version Number": "2.15", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://sourceforge.net/projects/lcms/files/lcms/2.15/lcms2-2.15.tar.gz", + "Description": "Little cms is a color management library. Implements fast transforms between ICC profiles. It is focused on speed, and is portable across several platforms." + } +] diff --git a/thirdparty/lcms2/README_zh.md b/thirdparty/lcms2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..5308597b0599b1bfdf7b876d32a685c01bb4f533 --- /dev/null +++ b/thirdparty/lcms2/README_zh.md @@ -0,0 +1,12 @@ +# lcms2三方库说明 +## 功能简介 +lcms2是一个用于像素操作的低级软件库,提供图像合成和梯形光栅化等功能。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:0.42.2 +- 当前适配的功能:像素操作,图像合成,光栅化 +- [ MIT license](https://sourceforge.net/projects/lcms) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/lcms2/SHA512SUM b/thirdparty/lcms2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d51a5eaff9113d475b3efc58afeb458dc770a282 --- /dev/null +++ b/thirdparty/lcms2/SHA512SUM @@ -0,0 +1 @@ +ab038c369e66736e0dd3810fbac6cf5381bc3102c4dd693819367b1224f59d9e853ede081388464c0e7c213d92e6cddc48c23020953af10ad6c6802cfa17e213 lcms2-2.15.tar.gz \ No newline at end of file diff --git a/thirdparty/lcms2/docs/hap_integrate.md b/thirdparty/lcms2/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..a6ecfae18c6adc4b78f29214667678b5b19ace50 --- /dev/null +++ b/thirdparty/lcms2/docs/hap_integrate.md @@ -0,0 +1,71 @@ +# lcms2集成到应用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/lcms2 #三方库lcms2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将lcms2拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/lcms2 tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh lcms2 + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + lcms2/arm64-v8a lcms2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/lcms2_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/liblcms2.so.2) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/include/lcms2/${OHOS_ARCH}) + + ``` + ![lcms2_usage](pic/lcms2_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![lcms2_test](pic/lcms2_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/lcms2/docs/pic/lcms2_install_dir.png b/thirdparty/lcms2/docs/pic/lcms2_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..a9c837946c4fb5ae1bb03e32f05b01164d2e2231 Binary files /dev/null and b/thirdparty/lcms2/docs/pic/lcms2_install_dir.png differ diff --git a/thirdparty/lcms2/docs/pic/lcms2_test.png b/thirdparty/lcms2/docs/pic/lcms2_test.png new file mode 100644 index 0000000000000000000000000000000000000000..b80083e3d2a20ce78eb3c12c035542c25a33c764 Binary files /dev/null and b/thirdparty/lcms2/docs/pic/lcms2_test.png differ diff --git a/thirdparty/lcms2/docs/pic/lcms2_usage.png b/thirdparty/lcms2/docs/pic/lcms2_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..522b3f5fef269886665a8b80a7d97869c1412e2a Binary files /dev/null and b/thirdparty/lcms2/docs/pic/lcms2_usage.png differ