diff --git a/thirdparty/tinygltf-2.4.0/HPKBUILD b/thirdparty/tinygltf-2.4.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..914398afe1ab11adcf0f816e46e78669cf7d4155 --- /dev/null +++ b/thirdparty/tinygltf-2.4.0/HPKBUILD @@ -0,0 +1,62 @@ +# 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: wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2471389@stu.neu.edu.cn>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=tinygltf-2.4.0 +pkgver=v2.4.0 +pkgrel=0 +pkgdesc="tinygltf is a header only C++ library for processing glTF files to efficiently process and exchange 3D content between different applications and platforms." +url="https://github.com/syoyo/tinygltf/tree/v2.4.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/syoyo/tinygltf/archive/refs/tags/v2.4.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=tinygltf-2.4.0 +packagename=tinygltf-v2.4.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $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 +} \ No newline at end of file diff --git a/thirdparty/tinygltf-2.4.0/HPKCHECK b/thirdparty/tinygltf-2.4.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..ef156906473c43636762756a539682540cd7afcb --- /dev/null +++ b/thirdparty/tinygltf-2.4.0/HPKCHECK @@ -0,0 +1,33 @@ +# 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: wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2471389@stu.neu.edu.cn>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +source HPKBUILD > /dev/null 2>&1 # 导入HPKBUILD文件 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ./loader_example model.gltf > $logfile 2>&1 #执行一个demo,解析modle.gltf文件 + 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 +} \ No newline at end of file diff --git a/thirdparty/tinygltf-2.4.0/README.OpenSource b/thirdparty/tinygltf-2.4.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..37e443be5c3e23bed8b009a067847daed01ae52e --- /dev/null +++ b/thirdparty/tinygltf-2.4.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "tinygltf-2.4.0", + "License": "MIT license", + "License File": "https://github.com/syoyo/tinygltf/blob/release/LICENSE", + "Version Number": "v2.4.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/syoyo/tinygltf", + "Description": "tinygltf is a header only C++ library for processing glTF files to efficiently process and exchange 3D content between different applications and platforms." + } +] \ No newline at end of file diff --git a/thirdparty/tinygltf-2.4.0/README_zh.md b/thirdparty/tinygltf-2.4.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..0ddca99457e2a1f6aa903ebb6973f3e068bffabd --- /dev/null +++ b/thirdparty/tinygltf-2.4.0/README_zh.md @@ -0,0 +1,9 @@ +# tinygltf-2.4.0三方库说明 +## 功能简介 +tinygltf是一个用于处理glTF文件的C++头文件库,用于在不同的应用程序和平台之间高效地处理和交换3D内容。 +## 三方库版本: +- v2.4.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/thirdparty/tinygltf-2.4.0/SHA512SUM b/thirdparty/tinygltf-2.4.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..25cb6c02703e2403d5ab86469716368554915080 --- /dev/null +++ b/thirdparty/tinygltf-2.4.0/SHA512SUM @@ -0,0 +1 @@ +480455e0b0dcbd9e6e5bfd90fa24c3fde09d14ef407df30b9fe57ed190b888d8fdd894630b5ee95c420bcbf349bf0d7f342ec55bde00745844ff336ea4c0c1a0 tinygltf-v2.4.0.zip \ No newline at end of file diff --git a/thirdparty/tinygltf-2.4.0/docs/hap_integrate.md b/thirdparty/tinygltf-2.4.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..4ae786650af64cfae79daa45d5e67a0a25cda907 --- /dev/null +++ b/thirdparty/tinygltf-2.4.0/docs/hap_integrate.md @@ -0,0 +1,76 @@ +# tinygltf集成到应用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/tinygltf-2.4.0 #三方库tinygltf-2.4.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh tinygltf-2.4.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + tinygltf-2.4.0/arm64-v8a tinygltf-2.4.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/tinygltf_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinygltf/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),model.gltf为自行添加的.gltf格式文件用来验证测试。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/tinygltf-2.4.0/tinygltf-2.4.0/arm64-v8a-build/ + ./loader_example model.gltf +``` + ![tinygltf_test](pic/tinygltf_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) \ No newline at end of file diff --git a/thirdparty/tinygltf-2.4.0/docs/pic/tinygltf_install_dir.png b/thirdparty/tinygltf-2.4.0/docs/pic/tinygltf_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..759aab7ba4d9e57ba4b5446763e6e0b8634fd146 Binary files /dev/null and b/thirdparty/tinygltf-2.4.0/docs/pic/tinygltf_install_dir.png differ diff --git a/thirdparty/tinygltf-2.4.0/docs/pic/tinygltf_test.png b/thirdparty/tinygltf-2.4.0/docs/pic/tinygltf_test.png new file mode 100644 index 0000000000000000000000000000000000000000..e5b8ef4cf358693cdf24f2a4d6d068254f3f9c78 Binary files /dev/null and b/thirdparty/tinygltf-2.4.0/docs/pic/tinygltf_test.png differ