diff --git a/thirdparty/ImageMagick/HPKBUILD b/thirdparty/ImageMagick/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..27d1c3712d5e0e4ee024e292d94e53469bc005b8 --- /dev/null +++ b/thirdparty/ImageMagick/HPKBUILD @@ -0,0 +1,94 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the ImageMagick License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://imagemagick.org/script/license.php +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Contributor: Jiang Xu +# Maintainer: Jiang Xu + + +pkgname=ImageMagick +pkgver=7.1.1-15 +pkgrel=0 +pkgdesc="ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files." +url="https://imagemagick.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("ImageMagick license") +depends=("libzip" "zstd" "zlib" "zstd" "djvulibre" "fontconfig" "freetype2" "libheif" "lcms2" "openjpeg" "libpng" "tiff" "libwebp" "libxml2" "icu") +makedepends=() + +source="https://archive.nuaa.cf/ImageMagick/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz +buildtools="configure" + +source envset.sh +host= + +prepare() { + cp -arf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir-$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --host=$host >> $buildlog 2>&1 + $MAKE VERBOSE=1 -j8 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE install >> $buildlog 2>&1 + $MAKE check >> $buildlog 2>&1 # 需要编译链接生成测试二进制可执行文件 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # $MAKE check >> $buildlog 2>&1 +} + +recoverpkgbuildenv() { + unset host if [ $ARCH == "armeabi-v7a" ] then unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir + rm -rf ${PWD}/$builddir-${archs[0]}-build + rm -rf ${PWD}/$builddir-${archs[1]}-build #${PWD}/$packagename +} diff --git a/thirdparty/ImageMagick/HPKCHECK b/thirdparty/ImageMagick/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..12a4857c0eba08207493566c029a0020e345b331 --- /dev/null +++ b/thirdparty/ImageMagick/HPKCHECK @@ -0,0 +1,30 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the ImageMagick License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://imagemagick.org/script/license.php +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Contributor: Jiang Xu +# Maintainer: Jiang Xu + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + if [ ! -f /usr/bin/sed ] && [ -f /system/bin/sed ]; then + ln -s /system/bin/sed /usr/bin/sed # 测试用例需要sed命令,软链接到搜索路径 + fi + cd $builddir-$ARCH-build + make check > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/thirdparty/ImageMagick/OAT.xml b/thirdparty/ImageMagick/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/thirdparty/ImageMagick/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/ImageMagick/README.OpenSource b/thirdparty/ImageMagick/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..12e3c4aecbf639dcfe6f14023d8e7429262bec7f --- /dev/null +++ b/thirdparty/ImageMagick/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "ImageMagick", + "License": "ImageMagick License", + "License File": "LICENSE", + "Version Number": "ImageMagick-7.1.1-15", + "Owner": "xujiang16@h-partners.com", + "Upstream URL": "https://github.com/ImageMagick/ImageMagick/releases/tag/7.1.1-15", + "Description": "ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files. It can read and write over 200 image file formats, and can support a wide range of image manipulation operations, such as resizing, cropping, and color correction." + } +] diff --git a/thirdparty/ImageMagick/README_zh.md b/thirdparty/ImageMagick/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..332f2fa3f940223b13d916c9d56b849df3e48ff2 --- /dev/null +++ b/thirdparty/ImageMagick/README_zh.md @@ -0,0 +1,13 @@ +# ImageMagick三方库说明 +## 功能简介 + + ImageMagick是一个免费的开源软件套件,用于显示、转换和编辑光栅图像和矢量图像文件。 + + ## 使用约束 +- IDE版本:DevEco Studio 4.1.3.313 +- SDK版本:ohos_sdk_public 4.1.0.53 (API Version 11 Release) +- 三方库版本:ImageMagick-7.1.1-15 +- 当前适配的功能:支持图像格式转换、图像编辑(图像尺寸调整、旋转、锐化和减色)和图像添加水印 + + ## 集成方式 +[应用包hap集成](docs/hap_integrate.md) diff --git a/thirdparty/ImageMagick/SHA512SUM b/thirdparty/ImageMagick/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..bb301d19b8c3b869a7c7152b3c87beefac85e9cd --- /dev/null +++ b/thirdparty/ImageMagick/SHA512SUM @@ -0,0 +1 @@ +de9907916fdee9eae7685aecd167ee24cf43fa13639d2d66eb85dd08ece2e2e9230f9d03717f1a0cba34a61c0a67aa5753c83b21d38937fcaca12e6490d6 ImageMagick-7.1.1-15.tar.gz diff --git a/thirdparty/ImageMagick/docs/hap_integrate.md b/thirdparty/ImageMagick/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..1aead22ff02f2be6472b293981e75ed0e9c26252 --- /dev/null +++ b/thirdparty/ImageMagick/docs/hap_integrate.md @@ -0,0 +1,83 @@ +# ImageMagick集成到应用hap + +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- [开发环境准备](../../../docs/hap_integrate_environment.md) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/ImageMagick #三方库ImageMagick的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本、license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh ImageMagick + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + ImageMagick/arm64-v8a ImageMagick/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 需要将libMagickCore-7.Q16HDRI.so,libMagickWand-7.Q16HDRI.so,libMagick++-7.Q16HDRI.so相关目录拷贝到entry/libs目录下 +- ![thirdparty_install_dir](pic/ImageMagick_so_usage_for_ide.png) + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![thirdparty_install_dir](pic/ImageMagick_usage_for_ide.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库的头文件加入工程中 + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMagickCore-7.Q16HDRI.so) + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMagickWand-7.Q16HDRI.so) + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMagick++-7.Q16HDRI.so) + target_include_directories(entry PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cups/${OHOS_ARCH}/include/ImageMagick-7) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到对应版本目录,执行如下命令make check + + ![ImageMagick-7_test](pic/test.png) + + ![ImageMagick-7_test](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/ImageMagick/docs/pic/ImageMagick_so_usage_for_ide.png b/thirdparty/ImageMagick/docs/pic/ImageMagick_so_usage_for_ide.png new file mode 100644 index 0000000000000000000000000000000000000000..751b371336dc51c7e0cbb7a0dbc6ae34dbca98f1 Binary files /dev/null and b/thirdparty/ImageMagick/docs/pic/ImageMagick_so_usage_for_ide.png differ diff --git a/thirdparty/ImageMagick/docs/pic/ImageMagick_usage_for_ide.png b/thirdparty/ImageMagick/docs/pic/ImageMagick_usage_for_ide.png new file mode 100644 index 0000000000000000000000000000000000000000..21e75d4a13b6ad06427ec2142cda9bf1f77455c7 Binary files /dev/null and b/thirdparty/ImageMagick/docs/pic/ImageMagick_usage_for_ide.png differ diff --git a/thirdparty/ImageMagick/docs/pic/test.png b/thirdparty/ImageMagick/docs/pic/test.png new file mode 100644 index 0000000000000000000000000000000000000000..97503bc21ec5f33307cbca5de6b732b702eed987 Binary files /dev/null and b/thirdparty/ImageMagick/docs/pic/test.png differ diff --git a/thirdparty/ImageMagick/docs/pic/test_result.png b/thirdparty/ImageMagick/docs/pic/test_result.png new file mode 100644 index 0000000000000000000000000000000000000000..669aaa5ac425266ce1283a6acfbc9ea23231af87 Binary files /dev/null and b/thirdparty/ImageMagick/docs/pic/test_result.png differ