diff --git a/thirdparty/libqrencode/HPKBUILD b/thirdparty/libqrencode/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..e5cf1634f3c072b1c88c7ceed3a30aa3410ec339 --- /dev/null +++ b/thirdparty/libqrencode/HPKBUILD @@ -0,0 +1,46 @@ +# Contributor: liulihong +# Maintainer: liulihong + +pkgname=libqrencode +pkgver=v4.1.1 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL-2.1 license") +depends=("libpng") +makedepends=() + +source="https://github.com/fukuchi/$pkgname/archive/refs/tags/$pkgver.tar.gz" +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz +autounpack=true +downloadpackage=true + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L -DWITH_TESTS=ON > `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!" +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/libqrencode/README.OpenSource b/thirdparty/libqrencode/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..f9bba8c12834a1f61b7f10d02f75866b5c0451dd --- /dev/null +++ b/thirdparty/libqrencode/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libqrencode", + "License": "LGPL-2.1 license", + "License File": "LICENSE.txt", + "Version Number": "v4.1.1", + "Owner": "llh_01129@163.com", + "Upstream URL": "https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz", + "Description": "Libqrencode is a fast and compact library for encoding data in a QR Code, a 2D symbology that can be scanned by handy terminals such as a smartphone. " + } +] diff --git a/thirdparty/libqrencode/README_zh.md b/thirdparty/libqrencode/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..9526be824462aaf58975e703bf02f2506cdaafdb --- /dev/null +++ b/thirdparty/libqrencode/README_zh.md @@ -0,0 +1,12 @@ +# libqrencode三方库说明 +## 功能简介 +Libqrencode是一个快速紧凑的库,用于将数据编码为二维码,二维码是一种二维符号,可以通过智能手机等方便的终端进行扫描。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:v4.1.1 +- 将数据编码为二维码 +- [ MIT license](https://github.com/fukuchi/libqrencode/) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/libqrencode/SHA512SUM b/thirdparty/libqrencode/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..5b6b90133bf8897a4914c5539ca0070fb9ea8b46 --- /dev/null +++ b/thirdparty/libqrencode/SHA512SUM @@ -0,0 +1 @@ +584106e7bcaaa1ef2efe63d653daad38d4ff436eb4b185a1db3c747169c1ffa74149c3b1329bb0b8ae007903db0a7034aabf135cc196d91a37b5c61348154a65 libqrencode-4.1.1.tar.gz diff --git a/thirdparty/libqrencode/docs/hap_integrate.md b/thirdparty/libqrencode/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..d8a05a9621953eb4afdb828c8df076c0c37999d6 --- /dev/null +++ b/thirdparty/libqrencode/docs/hap_integrate.md @@ -0,0 +1,74 @@ +# libqrencode集成到应用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/libqrencode #三方库libqrencode的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将libqrencode和libpng拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/libqrencode tools/main -rf + cp thirdparty/libpng tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh libqrencode libpng + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + libqrencode/arm64-v8a libqrencode/armeabi-v7a + libpng/arm64-v8a libpng/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/libqrencode_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libqrencode/${OHOS_ARCH}/lib/libqrencode.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/lib/libpng16.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libqrencode/${OHOS_ARCH}/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/include/libpng16) + + ``` + ![jbigkit_usage](pic/libqrencode_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![jbigkit_test](pic/libqrencode_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/libqrencode/docs/pic/libqrencode_install_dir.png b/thirdparty/libqrencode/docs/pic/libqrencode_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..01dd49f30e3d41f32ecda5fa8b44cd2f5ea98cfc Binary files /dev/null and b/thirdparty/libqrencode/docs/pic/libqrencode_install_dir.png differ diff --git a/thirdparty/libqrencode/docs/pic/libqrencode_test.png b/thirdparty/libqrencode/docs/pic/libqrencode_test.png new file mode 100644 index 0000000000000000000000000000000000000000..464d6d6946db1afe936d5bbcff46e52687244f77 Binary files /dev/null and b/thirdparty/libqrencode/docs/pic/libqrencode_test.png differ diff --git a/thirdparty/libqrencode/docs/pic/libqrencode_usage.png b/thirdparty/libqrencode/docs/pic/libqrencode_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..7c76dbe7d08f4ae2182c0b2bf282e455a847c1b3 Binary files /dev/null and b/thirdparty/libqrencode/docs/pic/libqrencode_usage.png differ