diff --git a/thirdparty/PROJ/HPKBUILD b/thirdparty/PROJ/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..80c559f7d1b1058f763c93a635e59dd82fb3dce5 --- /dev/null +++ b/thirdparty/PROJ/HPKBUILD @@ -0,0 +1,124 @@ +# 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 +# Maintainer: Jeff Han + +pkgname=PROJ +pkgver=9.4.1 +pkgrel=0 +pkgdesc="PROJ is a general purpose coordinate conversion software that can convert coordinates from one coordinate reference system (CRS) to another" +url="https://github.com/OSGeo/PROJ" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License") +depends=("sqlite" "tiff" "curl" "openssl") + +source="https://github.com/OSGeo/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +# 需要依赖sqlite3 linux编译 +# 因为在编译PROJ的过程中会执行sqlite3程序创建proj.db数据库进行使用,而鸿蒙化后的sqlite3程序版本在linux环境不能运行 +sqlitepkgname=sqlite +sqlitebuildhostflag=true +sqlitepkgver=version-3.46.0 +sqlitesource="https://github.com/$sqlitepkgname/$sqlitepkgname/archive/refs/tags/$sqlitepkgver.tar.gz" +sqlitebuilddir=$sqlitepkgname-${sqlitepkgver} +sqlitepackagename=$sqlitebuilddir.tar.gz + +autounpack=true +downloadpackage=true +buildtools="cmake" +buildlinux=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +# 下载sqlite +downloadsqlite() { + if [ ! -s $sqlitepackagename ];then + curl -f -L -- $sqlitesource > $sqlitepackagename + if [ "$?" != "0" ];then + echo "download $sqlitebuilddir fail" + return 1 + fi + fi + echo "a9575b5b545a0fd9261651b862e1f4649da2644492723510aeeb5cfca33a8baad98349f9626dc985b21e2d081149af2f7d8f7421a5a766fd7dae4c24ed544848 sqlite-version-3.46.0.tar.gz" > sqlitesha512sum + sha512sum -c sqlitesha512sum + ret=$? + if [ $ret -ne 0 ];then + echo "请检查$sqlitepackagename文件, 并重新下载压缩包." + return 2 + fi + rm -rf sqlitesha512sum + tar -xvf $sqlitepackagename > /dev/null 2>&1 + return 0 +} + +# 编译sqlite +buildsqlite() { + cd $sqlitebuilddir + ./configure > $buildlog 2>&1 + make >> $buildlog 2>&1 + cd $OLDPWD + return 0 +} + +prepare() { + if $buildlinux + then + downloadsqlite + ret=$? + if [ "$ret" != "0" ];then + return $ret + fi + buildsqlite + ret=$? + if [ "$ret" != "0" ];then + return $ret + fi + buildlinux=false + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DEXE_SQLITE3=$LYCIUM_ROOT/../thirdparty/PROJ/$sqlitebuilddir/sqlite3 \ + -DOPENSSL_INCLUDE_DIR=$LYCIUM_ROOT/usr/openssl/${ARCH}/include \ + -DOPENSSL_SSL_LIBRARY=$LYCIUM_ROOT/usr/openssl/${ARCH}/lib \ + -B$ARCH-build -S./ -L >> $buildlog 2>&1 + ret=$? + if [ $ret -ne 0 ]; then + echo "CMake failed. Check $buildlog for details." >> $buildlog 2>&1 + return 1 + fi + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/thirdparty/PROJ/HPKCHECK b/thirdparty/PROJ/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..8ba53bf227a53bb2ca8a3bc5644733484218e614 --- /dev/null +++ b/thirdparty/PROJ/HPKCHECK @@ -0,0 +1,34 @@ +# 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 +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + cd $builddir/$ARCH-build + echo "total test 61" > $logfile 2>&1 + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/data/tpc_c_cplusplus/thirdparty/PROJ/PROJ-9.4.1/${ARCH}-build/lib/ + export PATH=${PATH}:/data/tpc_c_cplusplus/lycium/usr/sqlite/${ARCH}/bin/ + ctest >> ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ];then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + + cd $OLDPWD + return $res +} diff --git a/thirdparty/PROJ/OAT.xml b/thirdparty/PROJ/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c910b32a0f5cab1461a8807c1f474d998359e04 --- /dev/null +++ b/thirdparty/PROJ/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/thirdparty/PROJ/README.OpenSource b/thirdparty/PROJ/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..ca9da074a8e398a64525a219fc7134ab9b55832a --- /dev/null +++ b/thirdparty/PROJ/README.OpenSource @@ -0,0 +1,38 @@ +[ + { + "Name": "PROJ", + "License": "MIT License", + "License File": "https://github.com/OSGeo/PROJ/blob/master/COPYING", + "Version Number": "9.4.1", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/OSGeo/PROJ", + "Description": "PROJ is the most famous map projection library of open source GIS, which provides the function of coordinate conversion between multiple coordinate systems. " + }, + { + "Name": "sqlite", + "License": "Public Domain", + "License File": "https://www.sqlite.org/copyright.html", + "Version Number": "version-3.42.0", + "Owner": "wupingyuan@huawei.com", + "Upstream URL": "https://github.com/sqlite/sqlite/archive/refs/tags/.tar.gz", + "Description": "This repository contains the complete source code for the SQLite database engine. Some test scripts are also included. However, many other test scripts and most of the documentation are managed separately." + }, + { + "Name": "tiff", + "License": "LibTIFF license", + "License File": "https://gitlab.com/libtiff/libtiff/-/blob/master/LICENSE.md?ref_type=heads", + "Version Number": "4.5.0", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "http://download.osgeo.org/libtiff/tiff-4.5.0.tar.xz", + "Description": "a small collection of tools for doingsimple manipulations of TIFF images, and documentation on the library and tools." + }, + { + "Name": "curl", + "License": "BSD/ISC/curl", + "License File": "https://github.com/curl/curl/blob/master/COPYING", + "Version Number": "curl-8_0_1", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/curl/curl/archive/refs/tags/curl-8_0_1.tar.gz", + "Description": "Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document." + } +] diff --git a/thirdparty/PROJ/README_zh.md b/thirdparty/PROJ/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..5f11019402e3b08db896b33c5980e22a19149195 --- /dev/null +++ b/thirdparty/PROJ/README_zh.md @@ -0,0 +1,15 @@ +# PROJ 三方库说明 + +## 功能简介 + +PROJ 是一个通用的坐标转换软件,它可以将坐标从一种坐标参考系(CRS)转换到另一种坐标参考系(CRS)。 + +## 使用约束 +- IDE版本:DevEco Studio 4.1.3 Release +- SDK版本:ohos_sdk_public 5.0.3.100 (API Version 10 Release) +- 三方库版本:9.4.1 +- 当前适配的功能: + +## 集成方式 + +- [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/PROJ/SHA512SUM b/thirdparty/PROJ/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..c4aad282bfa5be337ab9777090d399d88eb43ad2 --- /dev/null +++ b/thirdparty/PROJ/SHA512SUM @@ -0,0 +1 @@ +4b3ceb9e3b2213b0bb2fc839f4dd70e08ee53323465c7bb473131907e4b66c836623da115c7413dfd8bafd0a992fa173003063e2233ab577139ab8462655b6cc PROJ-9.4.1.tar.gz \ No newline at end of file diff --git a/thirdparty/PROJ/docs/hap_integrate.md b/thirdparty/PROJ/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..46c199fdc42e849cb5efd8e3a2d0e96d0641c960 --- /dev/null +++ b/thirdparty/PROJ/docs/hap_integrate.md @@ -0,0 +1,134 @@ +# PROJ集成到应用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/PROJ #三方库PROJ的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本、license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh PROJ + ``` +- ![thirdparty_install_dir](pic/build_PROJ.PNG) + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + PROJ/arm64-v8a PROJ/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 需要将PROJ生成的so动态库文件以及依赖的库文件拷贝到entry/libs目录下 + +- ![thirdparty_install_dir](pic/PROJ_so_ide.PNG) + +- 在IDE的cpp目录下新增thirdparty目录,将生成的头文件拷贝到该目录下,如下图所示 + +- ![thirdparty_install_dir](pic/PROJ_include_ide.PNG) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + +#将三方库的头文件和库文件加入工程中 +``` +#将三方库加入工程中 +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/sqlite/${OHOS_ARCH}/lib/libsqlite3.so.0 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/lib/libjpeg.so.62 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/lib/libturbojpeg.so.0 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xz/${OHOS_ARCH}/lib/liblzma.so.5 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libdeflate/${OHOS_ARCH}/lib/libdeflate.so.0 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/lib/libjbig.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/lib/libjbig85.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libssl.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libcrypto.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/lib/libpng16.so.16 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/lib/libwebp.so.7 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/lib/libsharpyuv.so.0 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/lib/libwebpdecoder.so.3 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/lib/libwebpdemux.so.2 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/lib/libwebpmux.so.3 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zstd_1_5_6/${OHOS_ARCH}/lib/libzstd.so.1 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tiff/${OHOS_ARCH}/lib/libtiff.so.6 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl_quic/${OHOS_ARCH}/lib/libcrypto.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/CUnit/${OHOS_ARCH}/lib/libcunit.so.1 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp3/${OHOS_ARCH}/lib/libnghttp3.so.5 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libxml2/${OHOS_ARCH}/lib/libxml2.so + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp2/${OHOS_ARCH}/lib/libnghttp2.so.14 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/lib/libcurl.so.4 + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/PROJ/${OHOS_ARCH}/lib/libproj.so.25) + +#将三方库的头文件加入工程中 +target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/sqlite/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xz/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libdeflate/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zstd_1_5_6/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tiff/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl_quic/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/CUnit/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp3/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libxml2/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp2/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/PROJ/${OHOS_ARCH}/include) +``` + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行ctest前,需要导入环境变量 +```shell + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/data/tpc_c_cplusplus/thirdparty/PROJ/PROJ-9.4.1/armeabi-v7a-build/lib/:/data/tpc_c_cplusplus/lycium/usr/sqlite/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/tiff/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/curl/armeabi-v7a/lib/:/data/lycium-citools/armeabi-v7a-gdb/lib/:/data/tpc_c_cplusplus/lycium/usr/libdeflate/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/libjpeg-turbo/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/xz/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/zstd_1_5_6/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/libwebp/armeabi-v7a/lib/:/data/tpc_c_cplusplus/lycium/usr/nghttp2/armeabi-v7a/lib/ + (或者export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/data/tpc_c_cplusplus/thirdparty/PROJ/PROJ-9.4.1/arm64-v8a-build/lib/:/data/tpc_c_cplusplus/lycium/usr/sqlite/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/tiff/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/curl/arm64-v8a/lib/:/data/lycium-citools/arm64-v8a-gdb/lib/:/data/tpc_c_cplusplus/lycium/usr/libdeflate/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/libjpeg-turbo/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/xz/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/zstd_1_5_6/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/libwebp/arm64-v8a/lib/:/data/tpc_c_cplusplus/lycium/usr/nghttp2/arm64-v8a/lib/) + + export PATH=${PATH}:/data/tpc_c_cplusplus/lycium/usr/sqlite/armeabi-v7a/bin/ + (或者export PATH=${PATH}:/data/tpc_c_cplusplus/lycium/usr/sqlite/arm64-v8a/bin/) +``` +执行ctest及结果如图所示 +```shell + cd /data/tpc_c_cplusplus/thirdparty/PROJ/PROJ-4.9.2/armeabi-v7a-build(或者cd /data/tpc_c_cplusplus/thirdparty/PROJ/PROJ-4.9.2/arm64-v8a-build) + ctest +``` + +- 测试结果如图所示: +- ![thirdparty_install_dir](pic/ctest.PNG) + +## 参考资料 + +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [PROJ三方库地址](https://github.com/OSGeo/PROJ) diff --git a/thirdparty/PROJ/docs/pic/PROJ_include_ide.PNG b/thirdparty/PROJ/docs/pic/PROJ_include_ide.PNG new file mode 100644 index 0000000000000000000000000000000000000000..2c150be177bdedefad0343db66d8ffb6ee99b0bc Binary files /dev/null and b/thirdparty/PROJ/docs/pic/PROJ_include_ide.PNG differ diff --git a/thirdparty/PROJ/docs/pic/PROJ_so_ide.PNG b/thirdparty/PROJ/docs/pic/PROJ_so_ide.PNG new file mode 100644 index 0000000000000000000000000000000000000000..416d1227e75803ed255a7a63f8be636cd9987d1b Binary files /dev/null and b/thirdparty/PROJ/docs/pic/PROJ_so_ide.PNG differ diff --git a/thirdparty/PROJ/docs/pic/build_PROJ.PNG b/thirdparty/PROJ/docs/pic/build_PROJ.PNG new file mode 100644 index 0000000000000000000000000000000000000000..74c5906f73f0ef605bbf5091cccc59ce590ab7ee Binary files /dev/null and b/thirdparty/PROJ/docs/pic/build_PROJ.PNG differ diff --git a/thirdparty/PROJ/docs/pic/ctest.PNG b/thirdparty/PROJ/docs/pic/ctest.PNG new file mode 100644 index 0000000000000000000000000000000000000000..58eaa42b6ce78fc9e7a2a99e00f051c00e0c7204 Binary files /dev/null and b/thirdparty/PROJ/docs/pic/ctest.PNG differ