1#!/bin/bash 2# Copyright 2021 Huawei Technologies Co., Ltd 3# 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 19build_option_proc_n() 20{ 21 if [[ "X$OPTARG" == "Xoff" || "X$OPTARG" == "Xlite" || "X$OPTARG" == "Xfull" || "X$OPTARG" == "Xlite_cv" || "X$OPTARG" == "Xwrapper" ]]; then 22 export COMPILE_MINDDATA_LITE="$OPTARG" 23 else 24 echo "Invalid value ${OPTARG} for option -n" 25 usage 26 exit 1 27 fi 28} 29 30build_option_proc_upper_i() 31{ 32 COMPILE_LITE="on" 33 if [[ "$OPTARG" == "arm64" ]]; then 34 LITE_PLATFORM="arm64" 35 elif [[ "$OPTARG" == "arm32" ]]; then 36 LITE_PLATFORM="arm32" 37 elif [[ "$OPTARG" == "x86_64" ]]; then 38 export LITE_PLATFORM="x86_64" 39 else 40 echo "-I parameter must be arm64、arm32 or x86_64" 41 exit 1 42 fi 43} 44 45build_option_proc_upper_a() 46{ 47 export COMPILE_LITE="on" 48 if [[ "$OPTARG" == "on" ]]; then 49 export LITE_ENABLE_AAR="on" 50 fi 51} 52 53build_option_proc_upper_w() 54{ 55 if [[ "$OPTARG" != "sse" && "$OPTARG" != "off" && "$OPTARG" != "avx" && "$OPTARG" != "avx512" && "$OPTARG" != "neon" ]]; then 56 echo "Invalid value ${OPTARG} for option -W, -W parameter must be sse|neon|avx|avx512|off" 57 usage 58 exit 1 59 fi 60 if [[ "$OPTARG" == "sse" || "$OPTARG" == "avx" || "$OPTARG" == "avx512" ]]; then 61 export X86_64_SIMD="$OPTARG" 62 fi 63 if [[ "$OPTARG" == "neon" ]]; then 64 export ARM_SIMD="$OPTARG" 65 fi 66}