Skip to content

Commit 2d950e1

Browse files
authored
Update build-ohos.sh and README.md for compiling OHOS with OpenHarmony build project (#189)
1 parent b88f870 commit 2d950e1

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ compile_commands.json
55
libsimple.*
66
build/
77
build-ios/
8+
build-ohos/
89
*.gch
910
bin/
1011
output/
@@ -20,4 +21,4 @@ examples/go/libsimple-osx-x64/
2021
cmake-build-debug/
2122

2223

23-
.vscode/
24+
.vscode/

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ make install
8383
./build-ios.sh
8484
```
8585

86+
支持 ohos 编译:
87+
88+
[官方发布渠道](https://gitcode.com/openharmony/docs/blob/master/en/release-notes/OpenHarmony-v5.0.1-release.md#acquiring-source-code-from-mirrors)下载适用于目标平台的SDK.
89+
```
90+
tar -zxvf ohos-sdk.tar.gz
91+
cd $OHOS_SDK/Linux
92+
for i in *.zip;do unzip ${i};done
93+
```
94+
开始编译
95+
```
96+
./build-ohos.sh
97+
```
98+
8699
### 代码
87100
- `src/entry` 入口文件,注册 sqlite tokenizer 和函数
88101
- `src/simple_tokenizer` 分词器实现

build-ohos.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
current_dir=$(pwd)/$(dirname "$0")
4+
build_dir="${current_dir}/build-ohos"
5+
lib_prefix="${current_dir}/output"
6+
CMAKE="${OHOS_SDK}/native/build-tools/cmake/bin/cmake"
7+
TOOLCHAIN_FILE="${OHOS_SDK}/native/build/cmake/ohos.toolchain.cmake"
8+
OHOS_ARCH="arm64-v8a"
9+
10+
mkdir -p "$build_dir" && cd "$build_dir" || exit
11+
12+
"$CMAKE" \
13+
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
14+
-DCMAKE_INSTALL_PREFIX="$lib_prefix" \
15+
-DOHOS_ARCH="$OHOS_ARCH" \
16+
-DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" \
17+
-DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \
18+
"$current_dir"
19+
20+
make
21+
make install

0 commit comments

Comments
 (0)