diff --git a/thirdparty/shapelib/HPKBUILD b/thirdparty/shapelib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..f1cafe5b00c9a73545af8203a36d59f77cbaddea --- /dev/null +++ b/thirdparty/shapelib/HPKBUILD @@ -0,0 +1,63 @@ +# This is an example HPKBUILD file. Use this as a start to creating your own, +# and remove these comments. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Contributor: Your Name +# Maintainer: Your Name + +pkgname=shapelib # 库名 +pkgver=1.5.0 # 库版本 +pkgrel=0 # 发布号 +pkgdesc="Mainly used for reading, writing, and manipulating ESRI Shapefile file formats, including .shp (spatial geometry information) and .dbf (attribute information) files" # 库描述 +archs=("armeabi-v7a" "arm64-v8a") # cpu 架构 +url="https://github.com/OSGeo/shapelib" +license=( "LICENSE-LGPL,LICENSE-MIT") +depends=() # 依赖库的目录名 必须保证被依赖的库的archs是当前库的archs的超集 +makedepends=() # 构建库时的依赖工具->需要用户安装的工具 +source="https://download.osgeo.org/shapelib/shapelib-1.5.0.zip" + +downloadpackage=true # 是否自动下载压缩包,如若不写默认 true. (应对一些特殊情况,代码只能 git clone (项目中依赖 submoudle )) +autounpack=true # 是否自动解压,如若不写默认 true, 如果为 false 则需要用户在 prepare 函数中自行解压 +buildtools= cmake # 编译方法, 暂时支持cmake, configure, make等, 是什么就填写什么. 如若不写默认为cmake. + +builddir=$pkgname-${pkgver} # 源码压缩包解压后目录名 编译目录名 +packagename=$builddir.zip # 压缩包名 + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +# ${OHOS_SDK} oh sdk安装路径 +# $ARCH 编译的架构是 archs 的遍历 +# $LYCIUM_ROOT/usr/$pkgname/$ARCH 安装到顶层目录的usr/$pkgname/$ARCH +# 执行编译构建的命令 +build() { + # 如果是cmake构建 "$@"=-DCMAKE_FIND_ROOT_PATH="..." -DCMAKE_TOOLCHAIN_FILE="..." -DCMAKE_INSTALL_PREFIX="..." 依赖库的搜索路径,toolchain file 路径,安装路径 + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L + make -j4 -C $ARCH-build + # 对最关键一步的退出码进行判断 + ret=$? + cd $OLDPWD + return $ret +} + +# 打包安装 +package() { + cd $builddir + make -C $ARCH-build install + cd $OLDPWD +} + +# 进行测试的准备和说明 +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} + diff --git a/thirdparty/shapelib/HPKCHECK b/thirdparty/shapelib/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..355294e7972c7ce9d7281cad52b26ff5a3e2b1a1 --- /dev/null +++ b/thirdparty/shapelib/HPKCHECK @@ -0,0 +1,45 @@ +# 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: zhangxin +# Maintainer: zhangxin + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + cd $builddir/${ARCH}-build + mount -o remount,rw / + + chmod 777 -R /tmp + + touch Enter.txt + echo " " > Enter.txt >${logfile} 2>&1 + + + +#./test1.sh < Enter.txt > ${logfile} 2>&1 + ./test2.sh < Enter.txt >>${logfile} 2>&1 + ./test3.sh < Enter.txt >>${logfile} 2>&1 + res=$? + + rm Enter.txt + + chmod 771 -R /tmp + + + + cd $OLDPWD + return $res +} + diff --git a/thirdparty/shapelib/OAT.xml b/thirdparty/shapelib/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..03ee5a760a1f17e2e86907647046114696ade760 --- /dev/null +++ b/thirdparty/shapelib/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/shapelib/README.OpenSource b/thirdparty/shapelib/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..971dae65c8ffb0603c1673c41a0b462b00b10855 --- /dev/null +++ b/thirdparty/shapelib/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "shapelib", + "License": "LICENSE-LGPL,LICENSE-MIT" + "License File": "LICENSE-LGPL","LICENSE-MIT" + "Version Number": "shapelib-1.5.0", + "Owner": "chenyajie5@huawei-partners.com", + "Upstream URL": "https://download.osgeo.org/shapelib/shapelib-1.5.0.zip", + "Description": "Mainly used for reading, writing, and manipulating ESRI Shapefile file formats, including .shp (spatial geometry information) and .dbf (attribute information) files." + } +] \ No newline at end of file diff --git a/thirdparty/shapelib/README_zh.md b/thirdparty/shapelib/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..33cd981bf3ab9940ff854138658f57b2cb0793a0 --- /dev/null +++ b/thirdparty/shapelib/README_zh.md @@ -0,0 +1,19 @@ +# shapelib三方库说明 + +## 功能简介 + + shapelib是一个主要用于读写和操作ESRI Shapefile文件格式,包括.shp(空间几何信息)和.dbf(属性信息)文件。 + + ## 使用约束 +- IDE版本:DevEco Studio 4.1.3.313 +- SDK版本:ohos_sdk_public 4.0.10.5 (API Version 10 Release) +- 三方库版本:shapelib-1.5.0 +- 当前适配的功能:用于读取.shp文件的空间几何信息和.dbf文件的属性信息。 + + ## 集成方式 + [应用包hap集成](docs/hap_integrate.md) + + + + + diff --git a/thirdparty/shapelib/SHA512SUM.md b/thirdparty/shapelib/SHA512SUM.md new file mode 100644 index 0000000000000000000000000000000000000000..420c20f4f2771691b10c443b78d1706151e7cb8e --- /dev/null +++ b/thirdparty/shapelib/SHA512SUM.md @@ -0,0 +1 @@ +230939afb33aee042808a32b38ee9dfc7ec1f39432e5a4ebe3fda99c2f87bfbebc91830d4e21691c51aae3f4bb65d7e71e7061472bb08124dcd3402c46800d6c shapelib-1.5.0.zip \ No newline at end of file diff --git a/thirdparty/shapelib/docs/hap_integrate.md b/thirdparty/shapelib/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..5f2c98aa908f984e7f6c8a2b1d0e611f27131143 --- /dev/null +++ b/thirdparty/shapelib/docs/hap_integrate.md @@ -0,0 +1,78 @@ +# shapelib集成到应用hap + +本库是在华为mate60上进行测试的 + +## 开发环境 + +- [开发环境准备](../../../docs/hap_integrate_environment.md) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/opus #三方库shapelib的目录结构如下 + ├── docs #三方库相关文档的文件 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本、license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh shapelib + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + shapelib/arm64-v8a shapelib/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![Snipaste_2023-12-25_17-45-11](pic/Snipaste_2023-12-25_17-45-11.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/shapelib/${OHOS_ARCH}/include) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/lib/libshp.so) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +不过官网版本没有测试资源,需要进入github自己拉取测试资源 + +若是进行单元测试需要设置环境变量链接库,将tests目录下的test1.sh,test2.sh,test3.sh拉入构建目录下,进入到对应版本build构建目录下的test目录执行如下命令./test1.sh ,./test2.sh,./test3.sh,如下图所示 + +![Snipaste_2023-12-25_18-22-22](pic/Snipaste_2023-12-25_18-22-22.png) + + + +## 参考资料 + +- [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/shapelib/docs/pic/Snipaste_2023-12-25_17-45-11.png b/thirdparty/shapelib/docs/pic/Snipaste_2023-12-25_17-45-11.png new file mode 100644 index 0000000000000000000000000000000000000000..da2256b8a6e7c788cc77930d28c64408190c003f Binary files /dev/null and b/thirdparty/shapelib/docs/pic/Snipaste_2023-12-25_17-45-11.png differ diff --git a/thirdparty/shapelib/docs/pic/Snipaste_2023-12-25_18-22-22.png b/thirdparty/shapelib/docs/pic/Snipaste_2023-12-25_18-22-22.png new file mode 100644 index 0000000000000000000000000000000000000000..84b90e57f134de776afb74b7ff269ffcd6ccc7f4 Binary files /dev/null and b/thirdparty/shapelib/docs/pic/Snipaste_2023-12-25_18-22-22.png differ