diff --git a/thirdparty/rapidjson/BUILD.gn b/thirdparty/rapidjson/BUILD.gn deleted file mode 100644 index 8ffd0218e5c634d6110cc8bc2ba0bf1f6096c9a0..0000000000000000000000000000000000000000 --- a/thirdparty/rapidjson/BUILD.gn +++ /dev/null @@ -1,271 +0,0 @@ -# Copyright (c) 2021 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. - -import("//build/ohos.gni") - -declare_args() { - enable_rapidjson_test = false -} - -config("rapidjson-config") { - cflags_cc = [ - "-Wno-incompatible-pointer-types", - "-Werror", - "-Wno-strict-prototypes", - "-Wimplicit-function-declaration", - "-fexceptions" - ] - - cflags = [ - "-Wno-incompatible-pointer-types", - "-Werror", - "-Wno-strict-prototypes", - "-Wimplicit-function-declaration", - "-fexceptions" - ] -} - -config("gtest_private_config") { - visibility = [ ":*" ] - include_dirs = [ "./thirdparty/gtest/googletest" ] -} - -config("gtest_config") { - include_dirs = [ "./thirdparty/gtest/googletest/include" ] - if (is_mingw) { - cflags_cc = [ - "-Wno-unused-const-variable", - "-Wno-unused-private-field", - ] - } -} -if(enable_rapidjson_test){ -static_library("rapidjson_gtest") { - public = [ - "googletest/include/gtest/gtest-spi.h", - "googletest/include/gtest/gtest.h", - ] - sources = [ - "./thirdparty/gtest/googletest/include/gtest/gtest-death-test.h", - "./thirdparty/gtest/googletest/include/gtest/gtest-message.h", - "./thirdparty/gtest/googletest/include/gtest/gtest-param-test.h", - "./thirdparty/gtest/googletest/include/gtest/gtest-printers.h", - "./thirdparty/gtest//include/gtest/gtest-test-part.h", - "./thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h", - "./thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h", - "./thirdparty/gtest/googletest/include/gtest/gtest_prod.h", - "./thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h", - "./thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h", - "./thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h", - "./thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h", - "./thirdparty/gtest/googletest/src/gtest-all.cc", - "./thirdparty/gtest/googletest/src/gtest-death-test.cc", - "./thirdparty/gtest/googletest/src/gtest-filepath.cc", - "./thirdparty/gtest/googletest/src/gtest-internal-inl.h", - "./thirdparty/gtest/googletest/src/gtest-port.cc", - "./thirdparty/gtest/googletest/src/gtest-printers.cc", - "./thirdparty/gtest/googletest/src/gtest-test-part.cc", - "./thirdparty/gtest/googletest/src/gtest-typed-test.cc", - "./thirdparty/gtest/googletest/src/gtest.cc", - ] - sources -= [ "./thirdparty/gtest/googletest/src/gtest-all.cc" ] - public_configs = [ ":gtest_config" ] - configs += [ ":gtest_private_config" ] - configs -= [ "//build/config/coverage:default_coverage" ] -} -} - -if(enable_rapidjson_test){ -static_library("rapidjson_gtest_main") { - sources = [ "./thirdparty/gtest/googletest/src/gtest_main.cc" ] - public_deps = [ ":rapidjson_gtest" ] - configs -= [ "//build/config/coverage:default_coverage" ] -} -} - -config("gmock_private_config") { - visibility = [ ":*" ] - include_dirs = [ "./thirdparty/gtest/googlemock" ] -} - -config("gmock_config") { - include_dirs = [ "./thirdparty/gtest/googlemock/include" ] - - cflags_cc = [ - # The MOCK_METHODn() macros do not specify "override", which triggers this - # warning in users: "error: 'Method' overrides a member function but is not - # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress - # these warnings until https://github.com/google/googletest/issues/533 is - # fixed. - "-Wno-inconsistent-missing-override", - ] -} - -if(enable_rapidjson_test){ -static_library("rapidjson_gmock") { - public = [ "./thirdparty/gtest/googlemock/include/gmock/gmock.h" ] - sources = [ - "./thirdparty/gtest/googlemock/include/gmock/gmock-actions.h", - "./thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h", - "./thirdparty/gtest/googlemock/include/gmock/gmock-function-mocker.h", - "./thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h", - "./thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h", - "./thirdparty/gtest/googlemock/include/gmock/gmock-nice-strict.h", - "./thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h", - "./thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h", - "./thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h", - "./thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h", - "./thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h", - "./thirdparty/gtest/googlemock/include/gmock/internal/gmock-pp.h", - "./thirdparty/gtest/googlemock/src/gmock-all.cc", - "./thirdparty/gtest/googlemock/src/gmock-cardinalities.cc", - "./thirdparty/gtest/googlemock/src/gmock-internal-utils.cc", - "./thirdparty/gtest/googlemock/src/gmock-spec-builders.cc", - "./thirdparty/gtest/googlemock/src/gmock.cc", - ] - sources -= [ "./thirdparty/gtest/googlemock/src/gmock-all.cc" ] - public_configs = [ ":gmock_config" ] - configs += [ ":gmock_private_config" ] - configs -= [ "//build/config/coverage:default_coverage" ] - deps = [ ":rapidjson_gtest" ] -} -} - -if(enable_rapidjson_test){ -static_library("rapidjson_gmock_main") { - sources = [ "./thirdparty/gtest/googlemock/src/gmock_main.cc" ] - public_deps = [ - ":rapidjson_gmock", - ":rapidjson_gtest", - ] - configs -= [ "//build/config/coverage:default_coverage" ] -} -} - -if(enable_rapidjson_test){ -ohos_static_library("namespacetest"){ - sources = ["./test/unittest/namespacetest.cpp"] - include_dirs = [ - "./include", - ".", - "./test", - "./thirdparty/gtest/googletest/include" - ] - - deps = [ - ":rapidjson_gtest", - ":rapidjson_gtest_main", - ] - - configs = [":rapidjson-config"] - part_name = "rapidjson" -} -} - -if(enable_rapidjson_test){ -ohos_static_library("archivertest"){ - sources = ["./example/archiver/archiver.cpp", - "./example/archiver/archivertest.cpp"] - include_dirs = [ - "./include", - "./include/rapidjson", - ] - - deps = [ - ":rapidjson_gtest", - ":rapidjson_gtest_main", - ] - - configs = [":rapidjson-config"] - part_name = "rapidjson" -} -} - - -if(enable_rapidjson_test){ -list = ["capitalize", "condense", "filterkey", "filterkeydom", "jsonx", - "lookaheadparser","messagereader","parsebyparts","pretty", - "prettyauto","schemavalidator","serialize","simpledom", - "simplereader","simplepullreader","simplewriter","sortkeys","tutorial"] - foreach(i, list){ - ohos_executable(i){ - sources = [ - "./example/" + i + "/" + i + ".cpp" - ] - - include_dirs = [ - "./include" - ] - - configs = [":rapidjson-config"] - part_name = "rapidjson" -} -} -} - - -if(enable_rapidjson_test){ -ohos_executable("unittest"){ - sources = [ - "./test/unittest/allocatorstest.cpp", - "./test/unittest/bigintegertest.cpp", - "./test/unittest/clzlltest.cpp", - "./test/unittest/cursorstreamwrappertest.cpp", - "./test/unittest/dtoatest.cpp", - "./test/unittest/writertest.cpp", - "./test/unittest/encodingstest.cpp", - "./test/unittest/filestreamtest.cpp", - "./test/unittest/fwdtest.cpp", - "./test/unittest/istreamwrappertest.cpp", - "./test/unittest/namespacetest.cpp", - "./test/unittest/ostreamwrappertest.cpp", - "./test/unittest/platformtest.cpp", - "./test/unittest/pointertest.cpp", - "./test/unittest/prettywritertest.cpp", - "./test/unittest/readertest.cpp", - "./test/unittest/regextest.cpp", - "./test/unittest/schematest.cpp", - "./test/unittest/simdtest.cpp", - "./test/unittest/strfunctest.cpp", - "./test/unittest/stringbuffertest.cpp", - "./test/unittest/strtodtest.cpp", - "./test/unittest/unittest.cpp", - "./test/unittest/uritest.cpp", - "./test/unittest/valuetest.cpp", - "./test/unittest/documenttest.cpp", - "./test/unittest/encodedstreamtest.cpp" - ] - - include_dirs = [ - "./include", - ".", - "./test", - "./thirdparty/gtest/googletest/include" - ] - - deps = [ - ":rapidjson_gtest", - ":rapidjson_gtest_main" - ] - - configs = [":rapidjson-config"] - part_name = "rapidjson" -} -} diff --git a/thirdparty/rapidjson/HPKBUILD b/thirdparty/rapidjson/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..da07456b9833eabe48dae3c18aa602140f77d5cf --- /dev/null +++ b/thirdparty/rapidjson/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: maoshanshan5@h-partners.com +# Maintainer: huangminzhong2@huawei.com +pkgname=rapidjson # 库名 +pkgver=1.1.0 # 库版本 +pkgrel=0 # 发布号 +pkgdesc="A fast JSON parser" # 库描述 +url="https://rapidjson.org/" # 官网链接 +archs=("armeabi-v7a" "arm64-v8a") # cpu 架构 +license=() +depends=() # 依赖库的目录名 必须保证被依赖的库的archs是当前库的archs的超集 +makedepends=() # 构建库时的依赖工具->需要用户安装的工具 +#官网下载链接 + +#source=https://github.com/Tencent/$pkgname/archive/refs/heads/master.zip #库源码下载链接 网络原因使用下面下载链接 +source=https://bj.bcebos.com/v1/ai-studio-online/6d23b4be9dbd469c91c11b6f324c31adfb399cd6b8ce45858f695594c72217de?responseContentDisposition=attachment%3B%20filename%3Drapidjson-master.zip +buildtools="cmake" + +builddir=$pkgname-master +packagename=${pkgname}-master.zip + + +prepare() { + mkdir -p $builddir/$ARCH-build +} +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_CXX_FLAGS=-Wno-unused-command-line-argument -B${ARCH}-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE 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/rapidjson/HPKCHECK b/thirdparty/rapidjson/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..aa23527f908b9f9104f2138eb2718ea6f58541b5 --- /dev/null +++ b/thirdparty/rapidjson/HPKCHECK @@ -0,0 +1,31 @@ +# 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: maoshanshan5@h-partners.com +# Maintainer: huangminzhong2@huawei.com + + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log +# 测试前的准备, 如果不需要可以不写。 +checkprepare(){ + return 0 +} +openharmonycheck() { + res=0 + cd $builddir/$ARCH-build + ctest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + return $resll +} diff --git a/thirdparty/rapidjson/OAT.xml b/thirdparty/rapidjson/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..03ee5a760a1f17e2e86907647046114696ade760 --- /dev/null +++ b/thirdparty/rapidjson/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/rapidjson/README.OpenSource b/thirdparty/rapidjson/README.OpenSource index 5f57c7a49df002036fd527133a3a89adadcc874e..8455d701bb6697735b9fb5d169623f2e017518f9 100644 --- a/thirdparty/rapidjson/README.OpenSource +++ b/thirdparty/rapidjson/README.OpenSource @@ -1,11 +1,11 @@ -[ - { - "Name": "rapidjson", - "License": "MIT license", - "License File": "LICENSE", - "Version Number": "v1.1.0", - "Owner": "Tencent", - "Upstream URL": "https://github.com/Tencent/rapidjson.git", - "Description": "A fast JSON parser/generator for C++ with both SAX/DOM style API" - } -] +[ + { + "Name": "cups", + "License": "Apache License", + "License File": "LICENSE", + "Version Number": "cups-2.3.6", + "Owner": "zhangxin546@h-partners.com", + "Upstream URL": "https://github.com/apple/cups/releases/tag/v2.3.6", + "Description": "CUPS is a standards-based, open source printing system developed by Apple Inc.for macOS® and other UNIX®-like operating systems." + } +] \ No newline at end of file diff --git a/thirdparty/rapidjson/README_zh.md b/thirdparty/rapidjson/README_zh.md index 901a9a72764e4c14b1df766a24e283cf8bb47110..62eeadf7b7ae739496b34bd5dfbe32dc11b8b429 100644 --- a/thirdparty/rapidjson/README_zh.md +++ b/thirdparty/rapidjson/README_zh.md @@ -1,9 +1,19 @@ -# rapidjson三方库说明 -## 功能简介 -RapidJson是一个跨平台的c++的json的解析器和生成器。 -## 使用约束 -- ROM版本:OpenHarmony-v3.2-Beta1 -- 三方库版本:v1.1.0 -- 当前适配的功能:支持json数据的解析和生成。 -## 集成方式 -+ [系统Rom包集成](docs/rom_integrate.md) +# rapidjson三方库说明 + +## 功能简介 + +RapidJson是一个跨平台的c++的json的解析器和生成器。 + +## 使用约束 + +- ROM版本:OpenHarmony-v3.2-Beta1 +- 三方库版本:v1.1.0 +- 当前适配的功能:支持json数据的解析和生成。 + +## 集成方式 + +- [系统Rom包集成](/docs/rom_integrate.md) + +- [应用包hap集成](docs\hap_integrate.md) + + diff --git a/thirdparty/rapidjson/SHA512SUM b/thirdparty/rapidjson/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0ff200d6239232ee281726753ca14dac0ae5a361 --- /dev/null +++ b/thirdparty/rapidjson/SHA512SUM @@ -0,0 +1 @@ +6c10e510a0a7a1ed59edbbd19344115634da968858e64f1ab323df82021161b229e7f6aa33e9212923a865201516d463bae87d21716ba1ccc0d3540d123a2dfd rapidjson-master.zip diff --git a/thirdparty/rapidjson/bundle.json b/thirdparty/rapidjson/bundle.json deleted file mode 100644 index 25df091ccf9b6151fa31b9c736c882f4895e73cc..0000000000000000000000000000000000000000 --- a/thirdparty/rapidjson/bundle.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@ohos/rapidjson", - "description": "A fast JSON parser/generator for C++ with both SAX/DOM style API", - "version": "v1.1.0", - "license": "MIT license", - "publishAs": "", - "segment": { - "destPath": "third_party/rapidjson" - }, - "dirs": {}, - "scripts": {}, - "readmePath": { - "en": "README" - }, - "component": { - "name": "rapidjson", - "subsystem": "thirdparty", - "syscap": [], - "features": [], - "adapted_system_type": ["standard"], - "rom": "", - "ram": "", - "deps": { - "components": [], - "third_party": [] - }, - "build": { - "sub_component": ["//third_party/rapidjson:rapidjson_gtest", - "//third_party/rapidjson:rapidjson_gtest_main", - "//third_party/rapidjson:rapidjson_gmock", - "//third_party/rapidjson:rapidjson_gmock_main", - "//third_party/rapidjson:namespacetest", - "//third_party/rapidjson:archivertest", - "//third_party/rapidjson:capitalize", - "//third_party/rapidjson:condense", - "//third_party/rapidjson:filterkey", - "//third_party/rapidjson:filterkeydom", - "//third_party/rapidjson:jsonx", - "//third_party/rapidjson:lookaheadparser", - "//third_party/rapidjson:messagereader", - "//third_party/rapidjson:parsebyparts", - "//third_party/rapidjson:pretty", - "//third_party/rapidjson:prettyauto", - "//third_party/rapidjson:schemavalidator", - "//third_party/rapidjson:serialize", - "//third_party/rapidjson:simpledom", - "//third_party/rapidjson:simplereader", - "//third_party/rapidjson:simplepullreader", - "//third_party/rapidjson:simplewriter", - "//third_party/rapidjson:sortkeys", - "//third_party/rapidjson:tutorial", - "//third_party/rapidjson:unittest"], - "inner_kits": [], - "test": [] - } - } -} diff --git a/thirdparty/rapidjson/docs/hap_integrate.md b/thirdparty/rapidjson/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..aa0512757456c68adff28d5e2a96b0a22a9dd56d --- /dev/null +++ b/thirdparty/rapidjson/docs/hap_integrate.md @@ -0,0 +1,102 @@ +# rapidjson集成到应用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 + git submodule update --init #更新依赖的三方库代码 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/rapidjson #三方库rapidjson的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── README.OpenSource #说明三方库源码的下载地址,版本、license等信息 + ├── README_zh.md + ├── SHA512SUM + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh rapidjson + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + rapidjson/arm64-v8a rapidjson/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的arm64-v8a和armeabi-v7a库拷贝到该目录下, 如下图所示,由于rapidjson是头文件库,所以并不会生成.a和.so文件,特此说明 + + ![3](.\pic\3.PNG) + + + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ![image-20231228202528676](..\docs\pic\1.png) + + ```cmake + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/rapidjson/${OHOS_ARCH}/include) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +测试三方库需要依赖gtest架构,在测试前需要运行下面命令安装gtest架构 + +``` +sudo aptitude install libgtest-dev #安装gtest第三方包 +cd /usr/src/gtest/ #进入gtest目录 +sudo cmake CMakeLists.txt #执行cmake +sudo make #执行make +sudo cp *.a /usr/lib/ #安装gtest +``` + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](https://gitee.com/openharmony-sig/tpc_c_cplusplus/blob/master/lycium/README.md#3ci环境准备) + +进入到构建目录,执行如下命令 + +``` +ctest -v +``` + +(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +![](..\docs\pic\2.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/rapidjson/docs/pic/1.png b/thirdparty/rapidjson/docs/pic/1.png new file mode 100644 index 0000000000000000000000000000000000000000..02529097cded9bde936a2e35c3c5ccd48d22d3ce Binary files /dev/null and b/thirdparty/rapidjson/docs/pic/1.png differ diff --git a/thirdparty/rapidjson/docs/pic/2.png b/thirdparty/rapidjson/docs/pic/2.png new file mode 100644 index 0000000000000000000000000000000000000000..c4670ebfd2dea5db40f5960f6b228df0ef90e4c9 Binary files /dev/null and b/thirdparty/rapidjson/docs/pic/2.png differ diff --git a/thirdparty/rapidjson/docs/pic/3.PNG b/thirdparty/rapidjson/docs/pic/3.PNG new file mode 100644 index 0000000000000000000000000000000000000000..5e6b6e6eb9284ff4a1044ea1d7042b39198ebcc3 Binary files /dev/null and b/thirdparty/rapidjson/docs/pic/3.PNG differ diff --git a/thirdparty/rapidjson/docs/pic/result.png b/thirdparty/rapidjson/docs/pic/result.png deleted file mode 100644 index beb5898ab532d621290f844e999d87bd692ff1b9..0000000000000000000000000000000000000000 Binary files a/thirdparty/rapidjson/docs/pic/result.png and /dev/null differ diff --git a/thirdparty/rapidjson/docs/rom_integrate.md b/thirdparty/rapidjson/docs/rom_integrate.md deleted file mode 100644 index 1fc3dba58dd418a5b45e93f611421c77605671ac..0000000000000000000000000000000000000000 --- a/thirdparty/rapidjson/docs/rom_integrate.md +++ /dev/null @@ -1,112 +0,0 @@ -# rapidjson如何集成到系统Rom -## 准备源码工程 -本库是基于OpenHarmony-v3.2-Beta1版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 -### 准备系统Rom源码 -系统源码获取请参考:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta2/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md) -### 增加构建脚本及配置文件 -- 下载本仓库代码 - ``` - cd ~ - git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 - ``` -- 三方库目录结构 - ``` - tpc_c_cplusplus/thirdparty/rapidjson #三方库rapidjson的目录结构如下 - ├── adapted #存放三方库适配需要的代码文件 - ├── docs #存放三方库相关文档的文件夹 - ├── BUILD.gn #构建脚本,支持rom包集成 - ├── bundle.json #三方库组件定义文件 - ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 - ├── README_zh.md - ``` -- 将三方库拷贝到OpenHarmony源码的third_party目录下 - ``` - cp ~/tpc_c_cplusplus/thirdparty/rapidjson ~/openharmony/third_party -rf - ``` -### 准备三方库源码 -``` -cd ~/openharmony/third_party/rapidjson #进入三方库目录 -git clone https://github.com/Tencent/rapidjson.git #下载三方库源码 -git submodule update --init #更新依赖的三方库代码 -``` -## 系统Rom中引入三方库 -准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) -我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) -新增需要编译的组件,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增rapidjson组件,由于rapidjson是头文件库,所以并不会生成.a和.so文件,特此说明。 - -``` - { - "subsystem": "thirdparty", - "components": [ - { - "component": "musl", - "features": [] - }, - { - "component": "rapidjson", - "features": [] - } - ] - } - -``` -## 系统Rom中引入三方库测试程序 -如果需要编译测试用例,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项,如下 -``` - { - "subsystem": "thirdparty", - "components": [ - { - "component": "musl", - "features": [] - }, - { - "component": "rapidjson", - "features": ["enable_rapidjson_test=true"] - } - ] - } -``` -## 编译工程 -在OpenHarmony源码根目录下 -``` -cd ~/openharmony -``` -- 选择平台 - ``` - hb set #hb set 命令会列出所有可选平台,这里我们选择rk3568 - ``` -- 执行编译 - ``` - hb build --target-cpu arm #编译32位系统 - hb build --target-cpu arm64 #编译64位系统 - ``` -- 生成文件的路径,可执行文件和库文件都在out/rk3568/thirdparty/rapidjson 目录下,同时也打包到了镜像中 -## 运行效果 -将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 -- 首先将hdc_std工具编译出来 - 工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe - - ``` - hb set #源码根目录下使用hb set 选择产品ohos-sdk - hb build #然后编译 - ``` -- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 -- 将原生库测试需要的所有文件打包成rapidjson.tar,并拷贝到windows下 -- 将文件推送到开发板,在windows命令行进行如下操作 - ``` - hdc_std shell mount -oremount,rw / #修改系统权限为可读写 - hdc_std file send rapidjson.tar / #将文件包推入开发板 - hdc_std shell #进入开发板 - tar xvf rapidjson.tar #解压 - #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 - ``` -- 运行测试程序 - 测试用例非常多,这里演示其中几个用例,如下图 - ![result](pic/result.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) -- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) -- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) \ No newline at end of file