1#!/bin/bash 2# 3# Copyright (c) 2022 Huawei Device Co., Ltd. 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17set -e 18 19function help_info() { 20 echo "arm64-v8a(armeabi-v7a) means the CPU architecture is 64-bit(32-bit), the compile command like the following:" 21 echo "bash build_ohos_tflite.sh arm64-v8a" 22} 23 24function build() { 25 echo "$1" 26 ./tool_chain/native/build-tools/cmake/bin/cmake \ 27 -DCMAKE_TOOLCHAIN_FILE=./tool_chain/native/build/cmake/ohos.toolchain.cmake \ 28 -DOHOS_ARCH=$1 \ 29 -DOHOS_PLATFORM=OHOS \ 30 -DCMAKE_BUILD_TYPE=RELEASE \ 31 -DBUILD_SHARED_LIBS=true \ 32 -DOHOS_STL=c++_static \ 33 -DCMAKE_BUILD_TYPE=Debug \ 34 .. 35} 36 37if [ "$#" != 1 ]; then 38 echo "Incorrect command, please pass the correct number of parameters to the compile command." 39 help_info 40 exit 1; 41fi 42 43if [ "$1" == "arm64-v8a" ]; then 44 build arm64-v8a 45elif [ "$1" == "armeabi-v7a" ]; then 46 build armeabi-v7a 47else 48 echo "Incorrect CPU architecture parameter or missing setting it, please pass the correct compile command." 49 help_info 50fi 51 52