Skip to content

Commit

Permalink
support SDK installed from DevEco Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Nov 19, 2024
1 parent 5e096b3 commit 25b154b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 18 deletions.
28 changes: 22 additions & 6 deletions build-ohos-arm64-v8a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cd $dir
# rm commandline-tools-linux-x64-5.0.5.200.zip
if [ -z $OHOS_SDK_NATIVE_DIR ]; then
OHOS_SDK_NATIVE_DIR=/star-fj/fangjun/software/huawei/command-line-tools/sdk/default/openharmony/native/
export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
# You can find the following content inside OHOS_SDK_NATIVE_DIR
# ls -lh /star-fj/fangjun/software/huawei/command-line-tools/sdk/default/openharmony/native/
# total 524K
Expand All @@ -34,18 +35,32 @@ if [ -z $OHOS_SDK_NATIVE_DIR ]; then
# drwxr-xr-x 3 kuangfangjun root 0 Nov 6 22:36 sysroot
fi

# If you don't want to install commandline tools, you can install the SDK
# using DevEco Studio. The following uses API version 10 as an example and
# it has installed the SDK to
# /Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native
#
# Remember to select ``native`` when you install the SDK
if [ ! -d $OHOS_SDK_NATIVE_DIR ]; then
echo "Please first download Command Line Tools for HarmonyOS"
exit 1
OHOS_SDK_NATIVE_DIR=/Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native
# export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
# ls -lh /Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native/
# total 1560
# -rw-r--r-- 1 fangjun staff 764K Jan 1 2001 NOTICE.txt
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 build
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 build-tools
# drwxr-xr-x 10 fangjun staff 320B Nov 19 22:42 llvm
# -rw-r--r-- 1 fangjun staff 4.0K Jan 1 2001 nativeapi_syscap_config.json
# -rw-r--r-- 1 fangjun staff 1.9K Jan 1 2001 ndk_system_capability.json
# -rw-r--r-- 1 fangjun staff 169B Jan 1 2001 oh-uni-package.json
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 sysroot
fi

if [ ! -f $OHOS_SDK_NATIVE_DIR/llvm/bin/aarch64-unknown-linux-ohos-clang ]; then
echo "$OHOS_SDK_NATIVE_DIR/llvm/bin/aarch64-unknown-linux-ohos-clang does not exist"
if [ ! -d $OHOS_SDK_NATIVE_DIR ]; then
echo "Please first download Command Line Tools for HarmonyOS"
exit 1
fi

export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
export PATH=$OHOS_SDK_NATIVE_DIR/llvm/bin:$PATH

OHOS_TOOLCHAIN_FILE=$OHOS_SDK_NATIVE_DIR/build/cmake/ohos.toolchain.cmake
Expand All @@ -62,7 +77,8 @@ onnxruntime_version=1.16.3
onnxruntime_dir=onnxruntime-ohos-arm64-v8a-$onnxruntime_version

if [ ! -f $onnxruntime_dir/lib/libonnxruntime.so ]; then
wget -c -q https://github.com/csukuangfj/onnxruntime-libs/releases/download/v${onnxruntime_version}/$onnxruntime_dir.zip
# wget -c https://github.com/csukuangfj/onnxruntime-libs/releases/download/v${onnxruntime_version}/$onnxruntime_dir.zip
wget -c https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/$onnxruntime_dir.zip
unzip $onnxruntime_dir.zip
rm $onnxruntime_dir.zip
fi
Expand Down
28 changes: 22 additions & 6 deletions build-ohos-armeabi-v7a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cd $dir
# rm commandline-tools-linux-x64-5.0.5.200.zip
if [ -z $OHOS_SDK_NATIVE_DIR ]; then
OHOS_SDK_NATIVE_DIR=/star-fj/fangjun/software/huawei/command-line-tools/sdk/default/openharmony/native/
export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
# You can find the following content inside OHOS_SDK_NATIVE_DIR
# ls -lh /star-fj/fangjun/software/huawei/command-line-tools/sdk/default/openharmony/native/
# total 524K
Expand All @@ -34,18 +35,32 @@ if [ -z $OHOS_SDK_NATIVE_DIR ]; then
# drwxr-xr-x 3 kuangfangjun root 0 Nov 6 22:36 sysroot
fi

# If you don't want to install commandline tools, you can install the SDK
# using DevEco Studio. The following uses API version 10 as an example and
# it has installed the SDK to
# /Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native
#
# Remember to select ``native`` when you install the SDK
if [ ! -d $OHOS_SDK_NATIVE_DIR ]; then
echo "Please first download Command Line Tools for HarmonyOS"
exit 1
OHOS_SDK_NATIVE_DIR=/Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native
# export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
# ls -lh /Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native/
# total 1560
# -rw-r--r-- 1 fangjun staff 764K Jan 1 2001 NOTICE.txt
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 build
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 build-tools
# drwxr-xr-x 10 fangjun staff 320B Nov 19 22:42 llvm
# -rw-r--r-- 1 fangjun staff 4.0K Jan 1 2001 nativeapi_syscap_config.json
# -rw-r--r-- 1 fangjun staff 1.9K Jan 1 2001 ndk_system_capability.json
# -rw-r--r-- 1 fangjun staff 169B Jan 1 2001 oh-uni-package.json
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 sysroot
fi

if [ ! -f $OHOS_SDK_NATIVE_DIR/llvm/bin/armv7-unknown-linux-ohos-clang ]; then
echo "$OHOS_SDK_NATIVE_DIR/llvm/bin/armv7-unknown-linux-ohos-clang does not exist"
if [ ! -d $OHOS_SDK_NATIVE_DIR ]; then
echo "Please first download Command Line Tools for HarmonyOS"
exit 1
fi

export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
export PATH=$OHOS_SDK_NATIVE_DIR/llvm/bin:$PATH

OHOS_TOOLCHAIN_FILE=$OHOS_SDK_NATIVE_DIR/build/cmake/ohos.toolchain.cmake
Expand All @@ -62,7 +77,8 @@ onnxruntime_version=1.16.3
onnxruntime_dir=onnxruntime-ohos-armeabi-v7a-$onnxruntime_version

if [ ! -f $onnxruntime_dir/lib/libonnxruntime.so ]; then
wget -c -q https://github.com/csukuangfj/onnxruntime-libs/releases/download/v${onnxruntime_version}/$onnxruntime_dir.zip
# wget -c https://github.com/csukuangfj/onnxruntime-libs/releases/download/v${onnxruntime_version}/$onnxruntime_dir.zip
wget -c https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/$onnxruntime_dir.zip
unzip $onnxruntime_dir.zip
rm $onnxruntime_dir.zip
fi
Expand Down
28 changes: 22 additions & 6 deletions build-ohos-x86-64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cd $dir
# rm commandline-tools-linux-x64-5.0.5.200.zip
if [ -z $OHOS_SDK_NATIVE_DIR ]; then
OHOS_SDK_NATIVE_DIR=/star-fj/fangjun/software/huawei/command-line-tools/sdk/default/openharmony/native/
export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
# You can find the following content inside OHOS_SDK_NATIVE_DIR
# ls -lh /star-fj/fangjun/software/huawei/command-line-tools/sdk/default/openharmony/native/
# total 524K
Expand All @@ -34,18 +35,32 @@ if [ -z $OHOS_SDK_NATIVE_DIR ]; then
# drwxr-xr-x 3 kuangfangjun root 0 Nov 6 22:36 sysroot
fi

# If you don't want to install commandline tools, you can install the SDK
# using DevEco Studio. The following uses API version 10 as an example and
# it has installed the SDK to
# /Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native
#
# Remember to select ``native`` when you install the SDK
if [ ! -d $OHOS_SDK_NATIVE_DIR ]; then
echo "Please first download Command Line Tools for HarmonyOS"
exit 1
OHOS_SDK_NATIVE_DIR=/Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native
# export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
# ls -lh /Users/fangjun/software/huawei/OpenHarmony/Sdk/10/native/
# total 1560
# -rw-r--r-- 1 fangjun staff 764K Jan 1 2001 NOTICE.txt
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 build
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 build-tools
# drwxr-xr-x 10 fangjun staff 320B Nov 19 22:42 llvm
# -rw-r--r-- 1 fangjun staff 4.0K Jan 1 2001 nativeapi_syscap_config.json
# -rw-r--r-- 1 fangjun staff 1.9K Jan 1 2001 ndk_system_capability.json
# -rw-r--r-- 1 fangjun staff 169B Jan 1 2001 oh-uni-package.json
# drwxr-xr-x 3 fangjun staff 96B Nov 19 22:42 sysroot
fi

if [ ! -f $OHOS_SDK_NATIVE_DIR/llvm/bin/x86_64-unknown-linux-ohos-clang ]; then
echo "$OHOS_SDK_NATIVE_DIR/llvm/bin/x86_64-unknown-linux-ohos-clang does not exist"
if [ ! -d $OHOS_SDK_NATIVE_DIR ]; then
echo "Please first download Command Line Tools for HarmonyOS"
exit 1
fi

export PATH=$OHOS_SDK_NATIVE_DIR/build-tools/cmake/bin:$PATH
export PATH=$OHOS_SDK_NATIVE_DIR/llvm/bin:$PATH

OHOS_TOOLCHAIN_FILE=$OHOS_SDK_NATIVE_DIR/build/cmake/ohos.toolchain.cmake
Expand All @@ -62,7 +77,8 @@ onnxruntime_version=1.16.3
onnxruntime_dir=onnxruntime-ohos-x86_64-$onnxruntime_version

if [ ! -f $onnxruntime_dir/lib/libonnxruntime.so ]; then
wget -c -q https://github.com/csukuangfj/onnxruntime-libs/releases/download/v${onnxruntime_version}/$onnxruntime_dir.zip
# wget -c https://github.com/csukuangfj/onnxruntime-libs/releases/download/v${onnxruntime_version}/$onnxruntime_dir.zip
wget -c https://hf-mirror.com/csukuangfj/onnxruntime-libs/resolve/main/$onnxruntime_dir.zip
unzip $onnxruntime_dir.zip
rm $onnxruntime_dir.zip
fi
Expand Down

0 comments on commit 25b154b

Please sign in to comment.