• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_v()
20{
21  export ENABLE_VERBOSE="on"
22  export VERBOSE="VERBOSE=1"
23}
24
25build_option_proc_c()
26{
27  check_on_off $OPTARG c
28  export ENABLE_COVERAGE="$OPTARG"
29}
30
31build_option_proc_t()
32{
33  if [[ "X$OPTARG" == "Xon" || "X$OPTARG" == "Xut" ]]; then
34    export RUN_TESTCASES="on"
35  elif [[ "X$OPTARG" == "Xoff" ]]; then
36    export RUN_TESTCASES="off"
37  elif [[ "X$OPTARG" == "Xst" ]]; then
38    export RUN_CPP_ST_TESTS="on"
39  else
40    echo "Invalid value ${OPTARG} for option -t"
41    usage
42    exit 1
43  fi
44}
45
46build_option_proc_g()
47{
48  check_on_off $OPTARG g
49  export USE_GLOG="$OPTARG"
50}
51
52build_option_proc_h()
53{
54  usage
55  exit 0
56}
57
58build_option_proc_a()
59{
60  check_on_off $OPTARG a
61  export ENABLE_ASAN="$OPTARG"
62}
63
64build_option_proc_p()
65{
66  check_on_off $OPTARG p
67  export ENABLE_PROFILE="$OPTARG"
68}
69
70build_option_proc_upper_d()
71{
72  check_on_off $OPTARG D
73  if [[ "X$OPTARG" == "Xon" ]]; then
74    if [[ "X$ENABLE_SECURITY" == "Xon" ]]; then
75      echo "enable security, the dump ir is not available"
76      usage
77      exit 1
78    fi
79    export USER_ENABLE_DUMP_IR=true
80  fi
81  export ENABLE_DUMP_IR="$OPTARG"
82  echo "enable dump function graph ir"
83}
84
85build_option_proc_upper_b()
86{
87  check_on_off $OPTARG B
88  if [[ "X$OPTARG" == "Xon" ]]; then
89    if [[ "X$ENABLE_SECURITY" == "Xon" ]]; then
90      echo "enable security, the debugger is not available"
91      usage
92      exit 1
93    fi
94    export USER_ENABLE_DEBUGGER=true
95  fi
96  export ENABLE_DEBUGGER="$OPTARG"
97}