docs: improve the rendering of the HarmonyOS build instructions

This commit is contained in:
Ralf Gommers
2025-01-04 21:18:07 +01:00
parent eda80f436a
commit f697cfe0d0

View File

@@ -711,25 +711,36 @@ to the minimum iOS version you want to target and execute this file to build the
### HarmonyOS
For this target you will need the cross-compiler toolchain package by Huawei, which contains solutions for both Windows and Linux. Only the Linux-based
toolchain has been tested so far, but the following instructions may apply similarly to Windows:
For this target you will need the cross-compiler toolchain package by Huawei,
which contains solutions for both Windows and Linux. Only the Linux-based
toolchain has been tested so far, but the following instructions may apply
similarly to Windows:
Download https://repo.huaweicloud.com/harmonyos/os/4.1.1-Release/ohos-sdk-windows_linux-public.tar.gz (or whatever newer version may be available in the future). Use tar xvf ohos-sdk-windows_linux_public.tar.gz to unpack it somewhere on your system. This will create a folder named "ohos-sdk" with subfolders "linux" and "windows". In the linux one you will find a ZIP archive named "native-linux-x64-4.1.7.8-Release.zip" - you need to unzip this where you want to
install the cross-compiler, for example in /opt/ohos-sdk.
Download [this HarmonyOS 4.1.1 SDK](https://repo.huaweicloud.com/harmonyos/os/4.1.1-Release/ohos-sdk-windows_linux-public.tar.gz),
or whatever newer version may be available in the future). Use `tar -xvf
ohos-sdk-windows_linux_public.tar.gz` to unpack it somewhere on your system.
This will create a folder named "ohos-sdk" with subfolders "linux" and
"windows". In the linux one you will find a ZIP archive named
`native-linux-x64-4.1.7.8-Release.zip` - you need to unzip this where you want
to install the cross-compiler, for example in `/opt/ohos-sdk`.
In the directory where you unpacked OpenBLAS, create a build directory for cmake, and change into it :
```
```bash
mkdir build
cd build
```
Use the version of `cmake` that came with the SDK, and specify the location of its toolchain file as a cmake option. Also set the build target for OpenBLAS to ARMV8 and specify NOFORTRAN=1 (at least as of version 4.1.1, the SDK contains no Fortran compiler):
```
/opt/ohos-sdk/linux/native/build-tools/cmake/bin/cmake -DCMAKE_TOOLCHAIN_FILE=/opt/ohos-sdk/linux/native/build/cmake/ohos.toolchain.cmake \
Use the version of `cmake` that came with the SDK, and specify the location of
its toolchain file as a cmake option. Also set the build target for OpenBLAS to
`ARMV8` and specify `NOFORTRAN=1` (at least as of version 4.1.1, the SDK
contains no Fortran compiler):
```bash
/opt/ohos-sdk/linux/native/build-tools/cmake/bin/cmake \
-DCMAKE_TOOLCHAIN_FILE=/opt/ohos-sdk/linux/native/build/cmake/ohos.toolchain.cmake \
-DOHOS_ARCH="arm64-v8a" -DTARGET=ARMV8 -DNOFORTRAN=1 ..
```
Additional other OpenBLAS build options like USE_OPENMP=1 or DYNAMIC_ARCH=1 will probably work too.
Finally do the build:
```
Additional other OpenBLAS build options like `USE_OPENMP=1` or `DYNAMIC_ARCH=1`
will probably work too. Finally do the build:
```bash
/opt/ohos-sdk/linux/native/build-tools/cmake/bin/cmake --build .
```