From c2f9903a7c008a367382a647504eabe6b2b6ed7a Mon Sep 17 00:00:00 2001 From: zhongluping <278527840@qq.com> Date: Mon, 8 May 2023 17:29:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9tinyxpath=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=8F=8F=E8=BF=B0=E4=B8=8D=E5=AF=B9=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhongluping <278527840@qq.com> --- thirdparty/tinyxpath/docs/hap_integrate.md | 44 +++++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/thirdparty/tinyxpath/docs/hap_integrate.md b/thirdparty/tinyxpath/docs/hap_integrate.md index a2a7a288..b65e6b7e 100755 --- a/thirdparty/tinyxpath/docs/hap_integrate.md +++ b/thirdparty/tinyxpath/docs/hap_integrate.md @@ -1,19 +1,27 @@ # tinyxpath集成到应用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环境准备) + ## 编译三方库 + - 下载本仓库 - ``` + + ```shell git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 ``` + - 三方库目录结构 - ``` + + ```shell tpc_c_cplusplus/thirdparty/tinyxpath #三方库tinyxpath的目录结构如下 ├── docs #三方库相关文档的文件夹 ├── HPKBUILD #构建脚本 @@ -23,20 +31,27 @@ ``` - 将tinyxpath拷贝至tools/main目录下 - ``` + + ```shell cd tpc_c_cplusplus cp thirdparty/tinyxpath tools/main -rf ``` + - 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) - ``` + + ```shell cd tools ./build.sh tinyxpath ``` + - 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 - ``` - tinyxpath-arm64-v8a-install tinyxpath-armeabi-v7a-install + + ```shell + tinyxpath/arm64-v8a tinyxpath/armeabi-v7a ``` - [测试三方库](#测试三方库) @@ -44,16 +59,24 @@ ## 应用中使用三方库 - 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 - ![thirdparty_install_dir](pic/tinyxpath_install_dir.png) + +  ![thirdparty_install_dir](../../thirdparty_template/pic/xxx_install_dir.png) + + 其中`xxx`代表三方库名,即为`tinyxpath` + - 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 - ``` + + ```shell #将三方库加入工程中 - target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyxpath-${OHOS_ARCH}-install/lib/libtinyxpath.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyxpath/${OHOS_ARCH}/lib/libtinyxpath.a) #将三方库的头文件加入工程中 - target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyxpath-${OHOS_ARCH}-install/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinyxpath/${OHOS_ARCH}/include) ``` + ![tinyxpath_usage](pic/tinyxpath_usage.png) + ## 测试三方库 + 三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) 进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) @@ -61,6 +84,7 @@  ![tinyxpath_test](pic/tinyxpath_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) -- Gitee