diff --git a/thirdparty/darts-clone/HPKBUILD b/thirdparty/darts-clone/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..87e4f475c9af348f38a0006709814e160eef9c45 --- /dev/null +++ b/thirdparty/darts-clone/HPKBUILD @@ -0,0 +1,117 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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: Jeff Han ,duanjf <605126199@qq.com> +# Maintainer: Jeff Han + +pkgname=darts-clone +pkgver=master +pkgrel=0 +pkgdesc="Darts-clone is a clone of Darts (Double-ARray Trie System)." +url="https://github.com/s-yata/darts-clone" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD 2-clause license") +depends=() +makedepends=("automake" "autoconf") + +commitid=e40ce4627526985a7767444b6ed6893ab6ff8983 +source="https://github.com/s-yata/darts-clone/archive/${commitid}.zip" +downloadpackage=true +autounpack=true +buildtools=configure + +builddir=${pkgname}-${commitid} +packagename=$builddir.zip + +source envset.sh +host= +prepare() { + cp -rf $builddir $pkgname-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + fi + cd $pkgname-$ARCH-build + #生成configure文件 + aclocal > $publicbuildlog 2>&1 + if [ $? -ne 0 ] + then + echo "aclocal error." + return -1 + fi + automake --add-missing >> $publicbuildlog 2>&1 + if [ $? -ne 0 ] + then + echo "automake error." + return -2 + fi + autoconf >> $publicbuildlog 2>&1 + if [ $? -ne 0 ] + then + echo "autoconf error." + return -3 + fi + cd ${OLDPWD} +} + +build() { + cd $pkgname-$ARCH-build + ./configure "$@" --host=$host > `pwd`/build.log 2>&1 + ${MAKE} VERBOSE=1 >> `pwd`/build.log 2>&1 + # 对最关键一步的退出码进行判断 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $pkgname-$ARCH-build + ${MAKE} install >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + unset host + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + if [ $ARCH == "armeabi-v7a" ] + then + cp ${OHOS_SDK}/native/llvm/lib/arm-linux-ohos/libc++_shared.so $pkgname-$ARCH-build + elif [ $ARCH == "arm64-v8a" ] + then + cp ${OHOS_SDK}/native/llvm/lib/aarch64-linux-ohos/libc++_shared.so $pkgname-$ARCH-build + else + echo "${ARCH} not support" + fi +} + +cleanbuild() { + rm -rf ${PWD}/$builddir ${PWD}/$pkgname-armeabi-v7a-build ${PWD}/$pkgname-arm64-v8a-build +} diff --git a/thirdparty/darts-clone/HPKCHECK b/thirdparty/darts-clone/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..83f563028aa18d5ff9a41067c667e3628a3b0ae2 --- /dev/null +++ b/thirdparty/darts-clone/HPKCHECK @@ -0,0 +1,36 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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: Jeff Han ,duanjf <605126199@qq.com> +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log +OLDPATH=$LD_LIBRARY_PATH +checkprepare() { + # 添加动态库libc++_shared.so所在路径到环境变量 + export LD_LIBRARY_PATH=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/$pkgname-$ARCH-build:$LD_LIBRARY_PATH +} + +openharmonycheck() { + res=0 + cd $pkgname-$ARCH-build/test + ./test-darts > ${logfile} 2>&1 + ./test-tools.sh >> ${logfile} 2>&1 + res=$? + cd $OLDPWD + # 恢复环境变量 + export LD_LIBRARY_PATH=$OLDPATH + unset OLDPATH + return $res +} diff --git a/thirdparty/darts-clone/OAT.xml b/thirdparty/darts-clone/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/thirdparty/darts-clone/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/darts-clone/README.OpenSource b/thirdparty/darts-clone/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..b9fd1f139c150b10087510397b0f24445d292827 --- /dev/null +++ b/thirdparty/darts-clone/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "darts-clone", + "License": "BSD 2-clause license", + "License File": "LICENSES", + "Version Number": "darts-clone-e40ce4627526985a7767444b6ed6893ab6ff8983", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/s-yata/darts-clone", + "Description": "Darts-clone is a clone of Darts (Double-ARray Trie System)." + } +] diff --git a/thirdparty/darts-clone/README_zh.md b/thirdparty/darts-clone/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..6b4b70d4346bf7a70feaf508177cc98f4ccdaec0 --- /dev/null +++ b/thirdparty/darts-clone/README_zh.md @@ -0,0 +1,11 @@ +# darts-clone三方库说明 +## 功能简介 +- darts -clone是dart(双阵列Trie系统)的克隆。 + +## 使用约束 +- IDE版本:DevEco Studio 4.1 Release +- SDK版本:ohos_sdk_public 5.0.0.28 (API Version 11 Release) +- 三方库版本:darts-clone-e40ce4627526985a7767444b6ed6893ab6ff8983 + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/darts-clone/SHA512SUM b/thirdparty/darts-clone/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..2044672404fa9b4de6ea2527eb06e36ea436298f --- /dev/null +++ b/thirdparty/darts-clone/SHA512SUM @@ -0,0 +1 @@ +8082848d4bce734799e18f97a87c0fb27685e5f539fa794e540577a7e1be40e471463153dec9a02f5223150887a83273f44ccd2e9dd1a45b6a1852d845f2781f darts-clone-e40ce4627526985a7767444b6ed6893ab6ff8983.zip diff --git a/thirdparty/darts-clone/docs/hap_integrate.md b/thirdparty/darts-clone/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..400048631827c961fc0dbd936235572ec4f6a4f8 --- /dev/null +++ b/thirdparty/darts-clone/docs/hap_integrate.md @@ -0,0 +1,90 @@ +# darts-clone集成到应用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 4.0.8.1 (API Version 10 Release)](http://download.ci.openharmony.cn/version/Master_Version/OpenHarmony_4.0.8.1/20230608_091016/version-Master_Version-OpenHarmony_4.0.8.1-20230608_091016-ohos-sdk-full.tar.gz) +- [DevEco Studio 3.1 Release](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/81/v3/tgRUB84wR72nTfE8Ir_xMw/devecostudio-windows-3.1.0.501.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074329Z&HW-CC-Expire=315360000&HW-CC-Sign=22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/darts-clone #三方库darts-clone的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKBUILD #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ├── OAT.xml + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh darts-clone + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + darts-clone/arm64-v8a darts-clone/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![dartsclone-install_dir](pic/dartsclone-install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/darts-clone/${OHOS_ARCH}/include) + ``` + + +![dartsclone_usage](pic/dartsclone_usage.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +操作如下 + +```shell +cd /data/tpc_c_cplusplus/thirdparty/darts-clone/darts-clone-armeabi-v7a-build/test #进入到构建目录下的test目录 + +./test-darts +``` + +进入到构建目录下的test目录,执行命令./test-darts(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +![darts-clone_test1](pic/darts-clone_test1.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) \ No newline at end of file diff --git a/thirdparty/darts-clone/docs/pic/darts-clone_test1.png b/thirdparty/darts-clone/docs/pic/darts-clone_test1.png new file mode 100644 index 0000000000000000000000000000000000000000..48acc98dd09707f727a877cf3f8e195ff54a97bc Binary files /dev/null and b/thirdparty/darts-clone/docs/pic/darts-clone_test1.png differ diff --git a/thirdparty/darts-clone/docs/pic/dartsclone-install_dir.png b/thirdparty/darts-clone/docs/pic/dartsclone-install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..5664ae0780c22a389f0f17a0d716ce657acdddcc Binary files /dev/null and b/thirdparty/darts-clone/docs/pic/dartsclone-install_dir.png differ diff --git a/thirdparty/darts-clone/docs/pic/dartsclone_usage.png b/thirdparty/darts-clone/docs/pic/dartsclone_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..4c654203b0bb0f6b1ea1a2fdbf27054eb5a829f8 Binary files /dev/null and b/thirdparty/darts-clone/docs/pic/dartsclone_usage.png differ diff --git a/thirdparty/kenlm/HPKBUILD b/thirdparty/kenlm/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..a54e7db7cba7b280e577c8b79ed2a5acca4748ee --- /dev/null +++ b/thirdparty/kenlm/HPKBUILD @@ -0,0 +1,73 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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: Jeff Han ,duanjf <605126199@qq.com> +# Maintainer: Jeff Han + +pkgname=kenlm +pkgver=master +pkgrel=0 +pkgdesc="Language model inference code by Kenneth Heafield (kenlm at kheafield.com)" +url="https://github.com/kpu/kenlm" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL-2.1 license" "GPL-3.0 license") +depends=("boost" "zlib") +makedepends=() + +commitid=e504a4d61c413873e7d5f13d8ac4890bd4dae36c +source="https://github.com/kpu/kenlm/archive/${commitid}.zip" +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=${pkgname}-${commitid} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -DCOMPILE_TESTS=ON -DFORCE_STATIC=ON -B$ARCH-build -S./ -L > `pwd`/build.log 2>&1 + make -j4 -C $ARCH-build >> `pwd`/build.log 2>&1 + # 对最关键一步的退出码进行判断 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + if [ $ARCH == "armeabi-v7a" ] + then + cp ${OHOS_SDK}/native/llvm/lib/arm-linux-ohos/libc++_shared.so $builddir/$ARCH-build + elif [ $ARCH == "arm64-v8a" ] + then + cp ${OHOS_SDK}/native/llvm/lib/aarch64-linux-ohos/libc++_shared.so $builddir/$ARCH-build + else + echo "${ARCH} not support" + fi +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/kenlm/HPKCHECK b/thirdparty/kenlm/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..cbb1a5b87bc0243bf04fe16491814d96fe390798 --- /dev/null +++ b/thirdparty/kenlm/HPKCHECK @@ -0,0 +1,36 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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: Jeff Han ,duanjf <605126199@qq.com> +# Maintainer: Jeff Han + + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log +OLDPATH=$LD_LIBRARY_PATH +checkprepare() { + # 添加动态库libc++_shared.so所在路径到环境变量 + export LD_LIBRARY_PATH=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${builddir}/${ARCH}-build:$LD_LIBRARY_PATH +} + +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + # 恢复环境变量 + export LD_LIBRARY_PATH=$OLDPATH + unset OLDPATH + return $res +} diff --git a/thirdparty/kenlm/OAT.xml b/thirdparty/kenlm/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/thirdparty/kenlm/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/kenlm/README.OpenSource b/thirdparty/kenlm/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..1a977e857e61bc13b068d2d2fe8d14622887ddba --- /dev/null +++ b/thirdparty/kenlm/README.OpenSource @@ -0,0 +1,29 @@ +[ + { + "Name": "kenlm", + "License": "LGPL-2.1 license" "GPL-3.0 license", + "License File": "LICENSES", + "Version Number": "kenlm-e504a4d61c413873e7d5f13d8ac4890bd4dae36c", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/kpu/kenlm", + "Description": "Language model inference code by Kenneth Heafield (kenlm at kheafield.com)" + }, + { + "Name": "boost", + "License": "Boost Software License", + "License File": "COPYING", + "Version Number": "1.81.0", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz", + "Description": "Boost provides free peer-reviewed portable C++ source libraries." + }, + { + "Name": "zlib", + "License": "LGPL-2.1 license", + "License File": "LICENSES", + "Version Number": "v1.2.13", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz", + "Description": "A massively spiffy yet delicately unobtrusive compression library." + } +] diff --git a/thirdparty/kenlm/README_zh.md b/thirdparty/kenlm/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..df7df4fdd57188daad4e8d67f8c05c99f91e217b --- /dev/null +++ b/thirdparty/kenlm/README_zh.md @@ -0,0 +1,11 @@ +# kenlm三方库说明 +## 功能简介 +- Kenlm 是一个用于构建和使用语言模型的工具. + +## 使用约束 +- IDE版本:DevEco Studio 4.1 Release +- SDK版本:ohos_sdk_public 5.0.0.28 (API Version 11 Release) +- 三方库版本:kenlm-e504a4d61c413873e7d5f13d8ac4890bd4dae36c + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/kenlm/SHA512SUM b/thirdparty/kenlm/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..5b758bb81e7b395a5df751fead405f1296a5b18a --- /dev/null +++ b/thirdparty/kenlm/SHA512SUM @@ -0,0 +1 @@ +30f3b0d40206b3bfe94745f93a5a9606c9752b24b42b6e7fca0a4b6bce2fa2fd5f4a92eb8d7cf5af4d155063b553a37ba3d3965270458be2bc1b92e6ffff38b2 kenlm-e504a4d61c413873e7d5f13d8ac4890bd4dae36c.zip diff --git a/thirdparty/kenlm/docs/hap_integrate.md b/thirdparty/kenlm/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..767f732f33f0b84caff2b71d70be72ffc91a662b --- /dev/null +++ b/thirdparty/kenlm/docs/hap_integrate.md @@ -0,0 +1,95 @@ +# kenlm集成到应用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 4.0.8.1 (API Version 10 Release)](http://download.ci.openharmony.cn/version/Master_Version/OpenHarmony_4.0.8.1/20230608_091016/version-Master_Version-OpenHarmony_4.0.8.1-20230608_091016-ohos-sdk-full.tar.gz) +- [DevEco Studio 3.1 Release](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/81/v3/tgRUB84wR72nTfE8Ir_xMw/devecostudio-windows-3.1.0.501.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074329Z&HW-CC-Expire=315360000&HW-CC-Sign=22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/kenlm #三方库kenlm的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKBUILD #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ├── OAT.xml + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh kenlm + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + kenlm/arm64-v8a kenlm/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![kenlm_install_dir](pic/kenlm_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kenlm/${OHOS_ARCH}/lib/libkenlm.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kenlm/${OHOS_ARCH}/lib/libkenlm_builder.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kenlm/${OHOS_ARCH}/lib/libkenlm_filter.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kenlm/${OHOS_ARCH}/lib/libkenlm_util.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kenlm/${OHOS_ARCH}/include) + ``` + + +![kenlm_usage](pic/kenlm_usage.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +先在shell环境中执行 + +```shell +cd /data/tpc_c_cplusplus/thirdparty/kenlm/kenlm-e504a4d61c413873e7d5f13d8ac4890bd4dae36c/armeabi-v7a-build #进入到构建目录 + +ctest +``` + +进入到构建目录,执行命令ctest(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +![kenlm_test](pic/kenlm_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) \ No newline at end of file diff --git a/thirdparty/kenlm/docs/pic/kenlm_install_dir.png b/thirdparty/kenlm/docs/pic/kenlm_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..1298d839aec2b02e0ac1f5e05c57c6a9717a9a2a Binary files /dev/null and b/thirdparty/kenlm/docs/pic/kenlm_install_dir.png differ diff --git a/thirdparty/kenlm/docs/pic/kenlm_test.png b/thirdparty/kenlm/docs/pic/kenlm_test.png new file mode 100644 index 0000000000000000000000000000000000000000..45b2ebd89457a5e22d37576a934db0f3b28ed81c Binary files /dev/null and b/thirdparty/kenlm/docs/pic/kenlm_test.png differ diff --git a/thirdparty/kenlm/docs/pic/kenlm_usage.png b/thirdparty/kenlm/docs/pic/kenlm_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..e268a2a3b9f0adc4283183623f2c1c9f09648a8d Binary files /dev/null and b/thirdparty/kenlm/docs/pic/kenlm_usage.png differ