diff --git a/thirdparty/pixman/HPKBUILD b/thirdparty/pixman/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..3cb4551f2a0d449c7c74f13386635b868649c787 --- /dev/null +++ b/thirdparty/pixman/HPKBUILD @@ -0,0 +1,111 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=pixman +pkgver=0.42.2 +pkgrel=0 +pkgdesc="Pixman is a low-level software library for pixel manipulation, providing features such as image compositing and trapezoid rasterization." +url="http://www.pixman.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=("libpng") +makedepends=() + +source="https://www.cairographics.org/releases/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + fi + export CFLAGS="$CFLAGS -munaligned-access" +} + +build() { + cd $builddir/$ARCH-build + # 开启 simd neon 会导致编译失败 + PKG_CONFIG_PATH="${pkgconfigpath}" ../configure "$@" --host=$host --enable-libpng --disable-silent-rules --disable-arm-simd --disable-arm-neon --disable-arm-a64-neon > `pwd`/build.log 2>&1 + make VERBOSE=1 -j4 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD + unset host +} + +check() { + cd $builddir/$ARCH-build + # 屏蔽测试时,测试用例的编译(测试用例在 build() 时已经编译完成) + sed -i '/.*oob-test.log: oob-test$(EXEEXT)/c\oob-test.log: #oob-test$(EXEEXT)' test/Makefile + sed -i '/.*infinite-loop.log: infinite-loop$(EXEEXT)/c\infinite-loop.log: #infinite-loop$(EXEEXT)' test/Makefile + sed -i '/.*trap-crasher.log: trap-crasher$(EXEEXT)/c\trap-crasher.log: #trap-crasher$(EXEEXT)' test/Makefile + sed -i '/.*fence-image-self-test.log: fence-image-self-test$(EXEEXT)/c\fence-image-self-test.log: #fence-image-self-test$(EXEEXT)' test/Makefile + sed -i '/.*region-translate-test.log: region-translate-test$(EXEEXT)/c\region-translate-test.log: #region-translate-test$(EXEEXT)' test/Makefile + sed -i '/.*fetch-test.log: fetch-test$(EXEEXT)/c\fetch-test.log: #fetch-test$(EXEEXT)' test/Makefile + sed -i '/.*a1-trap-test.log: a1-trap-test$(EXEEXT)/c\a1-trap-test.log: #a1-trap-test$(EXEEXT)' test/Makefile + sed -i '/.*prng-test.log: prng-test$(EXEEXT)/c\prng-test.log: #prng-test$(EXEEXT)' test/Makefile + sed -i '/.*radial-invalid.log: radial-invalid$(EXEEXT)/c\radial-invalid.log: #radial-invalid$(EXEEXT)' test/Makefile + sed -i '/.*pdf-op-test.log: pdf-op-test$(EXEEXT)/c\pdf-op-test.log: #pdf-op-test$(EXEEXT)' test/Makefile + sed -i '/.*region-test.log: region-test$(EXEEXT)/c\region-test.log: #region-test$(EXEEXT)' test/Makefile + sed -i '/.*combiner-test.log: combiner-test$(EXEEXT)/c\combiner-test.log: #combiner-test$(EXEEXT)' test/Makefile + sed -i '/.*scaling-crash-test.log: scaling-crash-test$(EXEEXT)/c\scaling-crash-test.log: #scaling-crash-test$(EXEEXT)' test/Makefile + sed -i '/.*alpha-loop.log: alpha-loop$(EXEEXT)/c\alpha-loop.log: #alpha-loop$(EXEEXT)' test/Makefile + sed -i '/.*scaling-helpers-test.log: scaling-helpers-test$(EXEEXT)/c\scaling-helpers-test.log: #scaling-helpers-test$(EXEEXT)' test/Makefile + sed -i '/.*thread-test.log: thread-test$(EXEEXT)/c\thread-test.log: #thread-test$(EXEEXT)' test/Makefile + sed -i '/.*rotate-test.log: rotate-test$(EXEEXT)/c\rotate-test.log: #rotate-test$(EXEEXT)' test/Makefile + sed -i '/.*alphamap.log: alphamap$(EXEEXT)/c\alphamap.log: #alphamap$(EXEEXT)' test/Makefile + sed -i '/.*gradient-crash-test.log: gradient-crash-test$(EXEEXT)/c\gradient-crash-test.log: #gradient-crash-test$(EXEEXT)' test/Makefile + sed -i '/.*pixel-test.log: pixel-test$(EXEEXT)/c\pixel-test.log: #pixel-test$(EXEEXT)' test/Makefile + sed -i '/.*matrix-test.log: matrix-test$(EXEEXT)/c\matrix-test.log: #matrix-test$(EXEEXT)' test/Makefile + sed -i '/.*filter-reduction-test.log: filter-reduction-test$(EXEEXT)/c\filter-reduction-test.log: #filter-reduction-test$(EXEEXT)' test/Makefile + sed -i '/.*composite-traps-test.log: composite-traps-test$(EXEEXT)/c\composite-traps-test.log: #composite-traps-test$(EXEEXT)' test/Makefile + sed -i '/.*region-contains-test.log: region-contains-test$(EXEEXT)/c\region-contains-test.log: #region-contains-test$(EXEEXT)' test/Makefile + sed -i '/.*glyph-test.log: glyph-test$(EXEEXT)/c\glyph-test.log: #glyph-test$(EXEEXT)' test/Makefile + sed -i '/.*solid-test.log: solid-test$(EXEEXT)/c\solid-test.log: #solid-test$(EXEEXT)' test/Makefile + sed -i '/.*stress-test.log: stress-test$(EXEEXT)/c\stress-test.log: #stress-test$(EXEEXT)' test/Makefile + sed -i '/.*cover-test.log: cover-test$(EXEEXT)/c\cover-test.log: #cover-test$(EXEEXT)' test/Makefile + sed -i '/.*blitters-test.log: blitters-test$(EXEEXT)/c\blitters-test.log: #blitters-test$(EXEEXT)' test/Makefile + sed -i '/.*affine-test.log: affine-test$(EXEEXT)/c\affine-test.log: #affine-test$(EXEEXT)' test/Makefile + sed -i '/.*scaling-test.log: scaling-test$(EXEEXT)/c\scaling-test.log: #scaling-test$(EXEEXT)' test/Makefile + sed -i '/.*composite.log: composite$(EXEEXT)/c\composite.log: #composite$(EXEEXT)' test/Makefile + sed -i '/.*tolerance-test.log: tolerance-test$(EXEEXT)/c\tolerance-test.log: #tolerance-test$(EXEEXT)' test/Makefile + + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + echo "The test must be on an OpenHarmony device!" + # real test CMD + # make -C test check-TESTS +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/pixman/README.OpenSource b/thirdparty/pixman/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..50ee736de2d798f9af7ed372c44bf162ead9b7d0 --- /dev/null +++ b/thirdparty/pixman/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "pixman", + "License": " MIT license", + "License File": "COPYING", + "Version Number": "0.42.2", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://www.cairographics.org/releases/pixman-0.42.2.tar.gz", + "Description": "Pixman is a low-level software library for pixel manipulation, providing features such as image compositing and trapezoid rasterization." + } +] diff --git a/thirdparty/pixman/README_zh.md b/thirdparty/pixman/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..2b2d927baff7f920b8ce8631f714527e86d14a5d --- /dev/null +++ b/thirdparty/pixman/README_zh.md @@ -0,0 +1,12 @@ +# pixman三方库说明 +## 功能简介 +Pixman是一个用于像素操作的低级软件库,提供图像合成和梯形光栅化等功能。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:0.42.2 +- 当前适配的功能:像素操作,图像合成,光栅化 +- [ MIT license](http://www.pixman.org/) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/pixman/SHA512SUM b/thirdparty/pixman/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..3d7e4dee5fa09d251cc6c5b440069bae0f2ee143 --- /dev/null +++ b/thirdparty/pixman/SHA512SUM @@ -0,0 +1 @@ +0a4e327aef89c25f8cb474fbd01de834fd2a1b13fdf7db11ab72072082e45881cd16060673b59d02054b1711ae69c6e2395f6ae9214225ee7153939efcd2fa5d pixman-0.42.2.tar.gz diff --git a/thirdparty/pixman/docs/hap_integrate.md b/thirdparty/pixman/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..c17ea670711812c44297168ee2289c0a032574c3 --- /dev/null +++ b/thirdparty/pixman/docs/hap_integrate.md @@ -0,0 +1,71 @@ +# pixman集成到应用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/pixman #三方库pixman的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将pixman拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/pixman tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh pixman + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + pixman/arm64-v8a pixman/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/pixman_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libpixman-1.so.0) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/include/pixman/${OHOS_ARCH}) + + ``` + ![pixman_usage](pic/pixman_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![pixman_test](pic/pixman_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/pixman/docs/pic/pixman_install_dir.png b/thirdparty/pixman/docs/pic/pixman_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..316fd0607ed1e75713d0de3751604637c1bcd207 Binary files /dev/null and b/thirdparty/pixman/docs/pic/pixman_install_dir.png differ diff --git a/thirdparty/pixman/docs/pic/pixman_test.png b/thirdparty/pixman/docs/pic/pixman_test.png new file mode 100644 index 0000000000000000000000000000000000000000..740ad4bce6c876a20afc2c92cd4d46c383df44f1 Binary files /dev/null and b/thirdparty/pixman/docs/pic/pixman_test.png differ diff --git a/thirdparty/pixman/docs/pic/pixman_usage.png b/thirdparty/pixman/docs/pic/pixman_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..ebbbb47d6c7b95c36577386ef9ad5b0285a7f335 Binary files /dev/null and b/thirdparty/pixman/docs/pic/pixman_usage.png differ