@@ -82,7 +82,8 @@ The following steps show how to configure and modify the toolchains for cross-co
...
@@ -82,7 +82,8 @@ The following steps show how to configure and modify the toolchains for cross-co
**OHOS\_SYSROOT\_PATH** specifies the absolute path where **sysroot** is located. For OpenHarmony, set **OHOS\_SYSROOT\_PATH** to the absolute path of the **out/hispark\__xxx_/ipcamera\_hispark\__xxx_/sysroot** directory. This directory is generated after full compilation is complete. Therefore, complete full compilation before porting.
**OHOS\_SYSROOT\_PATH** specifies the absolute path where **sysroot** is located. For OpenHarmony, set **OHOS\_SYSROOT\_PATH** to the absolute path of the **out/hispark\__xxx_/ipcamera\_hispark\__xxx_/sysroot** directory. This directory is generated after full compilation is complete. Therefore, complete full compilation before porting.
3. View the result.
3. View the result.
After step 2 is complete, a static library file and test cases are generated in the **build** directory.
After step 2 is complete, a static library file and test cases are generated in the **build** directory.
**Table 2** Directory structure of compiled files
**Table 2** Directory structure of compiled files
...
@@ -109,7 +110,7 @@ The following steps show how to configure and modify the toolchains for cross-co
...
@@ -109,7 +110,7 @@ The following steps show how to configure and modify the toolchains for cross-co
The following screen is displayed after a successful login to the OS.
The following screen is displayed after a successful login to the OS.
**Figure 1** Successful startup of OpenHarmony<a name="fig13279524162418"></a>
2. Mount the **nfs** directory and put the executable file **cctest** into the **test** directory \(listed in [Table 2](#table1452412391911)\) to the **nfs** directory.
2. Mount the **nfs** directory and put the executable file **cctest** into the **test** directory \(listed in [Table 2](#table1452412391911)\) to the **nfs** directory.
...
@@ -213,9 +214,9 @@ The following steps show how to configure and modify the toolchains for cross-co
...
@@ -213,9 +214,9 @@ The following steps show how to configure and modify the toolchains for cross-co
Acquire the source code of yxml from [the open-source repository](https://github.com/getdnsapi/yxml). The following table lists the directory structure.
Acquire the source code of yxml from [the open-source repository](https://github.com/getdnsapi/yxml). The following table lists the directory structure.
**Table 1** Directory structure of the source code
**Table 1** Directory structure of the source code
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p2040355219237"><aname="p2040355219237"></a><aname="p2040355219237"></a>Input and output files as well as scripts of the test cases</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p7522041131814"><aname="p7522041131814"></a><aname="p7522041131814"></a>File for organizing compilation</p>
The following steps show how to configure and modify the toolchains for cross-compiling the libraries built using CMake to compile executable files for the OpenHarmony platform.
The following steps show how to configure and modify the toolchains for cross-compiling the libraries built using CMake to compile executable files for the OpenHarmony platform.
1. Configure the toolchains.
1. Configure the toolchains.
Replace the original configuration of MakeFile \(listed in [Table 1](#table16520154171813)\) in the root directory of the yxml library with the following clang toolchains configuration.
Replace the original configuration of MakeFile \(listed in Table 1) in the root directory of the yxml library with the following clang toolchains configuration.
clang toolchains configuration:
clang toolchains configuration:
...
@@ -98,6 +44,7 @@ The following steps show how to configure and modify the toolchains for cross-co
...
@@ -98,6 +44,7 @@ The following steps show how to configure and modify the toolchains for cross-co
Original configuration:
Original configuration:
```
```
CC:=gcc
CC:=gcc
AR:=ar
AR:=ar
...
@@ -106,7 +53,7 @@ The following steps show how to configure and modify the toolchains for cross-co
...
@@ -106,7 +53,7 @@ The following steps show how to configure and modify the toolchains for cross-co
2. Perform the compilation.
2. Perform the compilation.
Run a Linux command to enter the directory \(listed in [Table 1](#table16520154171813)\) for storing yxml source files and then run the following command:
Run a Linux command to enter the directory \(listed in Table 1) for storing yxml source files and then run the following command:
```
```
make test OHOS_SYSROOT_PATH=...
make test OHOS_SYSROOT_PATH=...
...
@@ -120,62 +67,27 @@ The following steps show how to configure and modify the toolchains for cross-co
...
@@ -120,62 +67,27 @@ The following steps show how to configure and modify the toolchains for cross-co
The test procedure for the yxml library is similar to that for the double-conversion library. For details, see the procedure described in [Porting a Library Built Using CMake](../porting/porting-thirdparty-cmake.md). The following describes how to use the test cases of the yxml library.
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p152741354135614"><a name="p152741354135614"></a><a name="p152741354135614"></a>Test cases as well as the input and output files</p>
The test procedure for the yxml library is similar to that for the double-conversion library. For details, see the procedure described in [Porting a Library Built Using CMake](porting-thirdparty-cmake.md#section6686144293611). The following describes how to use the test cases of the yxml library.
**Table 3** Directory structure of the test directory
**Table 3** Directory structure of the test directory
| OpenHarmony/third_party/yxml/yxml/out/test/test.sh | Automatic test script, which cannot be used because OpenHarmony does not support automatic script execution. However, you can refer to this script to conduct a manual test. |
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p25956235437"><aname="p25956235437"></a><aname="p25956235437"></a>Automatic test script, which cannot be used because <spanid="text625264318457"><aname="text625264318457"></a><aname="text625264318457"></a>OpenHarmony</span> does not support automatic script execution. However, you can refer to this script to conduct a manual test.</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p7595102314319"><aname="p7595102314319"></a><aname="p7595102314319"></a>Executable file for testing.</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p559662344315"><aname="p559662344315"></a><aname="p559662344315"></a>Input test file.</p>
The content of the **test.sh** file is as follows:
The content of the **test.sh** file is as follows:
...
@@ -226,10 +138,10 @@ The following operations are performed based on the assumption that the OpenHarm
...
@@ -226,10 +138,10 @@ The following operations are performed based on the assumption that the OpenHarm
ok
ok
```
```
The output is the same as the **pi01.out** file in the [test](#table115941423164318) directory. The test is passed.
The output is the same as the **pi01.out** file in the **test** directory listed in Table 3. In this case, the test is passed.
## Adding the Compiled yxml Library to the OpenHarmony Project<a name="section1898016213406"></a>
## Adding the Compiled yxml Library to the OpenHarmony Project
The procedure for adding the yxml library is almost the same as that for adding the double-conversion library, except that the implementation of **build.gn** and **config.gni** files. For details, see the procedure described in [Porting a Library Built Using CMake](porting-thirdparty-cmake.md#section1651053153715).
The procedure for adding the yxml library is almost the same as that for adding the double-conversion library, except that the implementation of **build.gn** and **config.gni** files. For details, see the procedure described in [Porting a Library Built Using CMake](porting-thirdparty-cmake.md#section1651053153715).
...
@@ -272,33 +184,11 @@ if (TEST_ENABLE == "YES") {
...
@@ -272,33 +184,11 @@ if (TEST_ENABLE == "YES") {
**Table 4** Directory structure of the ported library
**Table 4** Directory structure of the ported library
| OpenHarmony/third_party/yxml/build_thirdparty.py | Script file for GN to call the **shell** command to convert compilation from GN to Makefile. |
</th>
| OpenHarmony/third_party/yxml/config.gni | Third-party library compilation configuration file, which can be modified to determine whether the test cases will be used during the building. |
</tr>
| OpenHarmony/third_party/yxml/yxml/ | Directory of the third-party library to be ported. |
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p1626675812177"><aname="p1626675812177"></a><aname="p1626675812177"></a>GN file for adding the third-party library to the <spanid="text1699851716117"><aname="text1699851716117"></a><aname="text1699851716117"></a>OpenHarmony</span> project</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p122661958201719"><aname="p122661958201719"></a><aname="p122661958201719"></a>Script file for GN to call the <strongid="b8482154111113"><aname="b8482154111113"></a><aname="b8482154111113"></a>shell</strong> command to convert compilation from GN to Makefile.</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p626712588175"><aname="p626712588175"></a><aname="p626712588175"></a>Third-party library compilation configuration file, which can be modified to determine whether the test cases will be used during the building</p>
<tdclass="cellrowborder"valign="top"width="50%"headers="mcps1.2.3.1.2 "><pid="p87252109205"><aname="p87252109205"></a><aname="p87252109205"></a>Directory of the third-party library to be ported</p>