You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

process_options.sh 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. set -e
  17. # check and set options
  18. process_options()
  19. {
  20. # Process the options
  21. while getopts 'drvj:c:t:hb:s:a:g:p:ie:l:I:RP:D:zM:V:K:B:En:A:S:k:W:F:H:L:y' opt
  22. do
  23. CASE_SENSIVE_ARG=${OPTARG}
  24. OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')
  25. case "${opt}" in
  26. d)
  27. DEBUG_MODE="on" ;;
  28. n)
  29. build_option_proc_n ;;
  30. y)
  31. export ENABLE_SYM_FILE="on" ;;
  32. r)
  33. export DEBUG_MODE="off" ;;
  34. v)
  35. build_option_proc_v ;;
  36. j)
  37. export THREAD_NUM=$OPTARG ;;
  38. c)
  39. build_option_proc_c ;;
  40. t)
  41. build_option_proc_t ;;
  42. g)
  43. build_option_proc_g ;;
  44. h)
  45. build_option_proc_h ;;
  46. b)
  47. build_option_proc_b ;;
  48. a)
  49. build_option_proc_a ;;
  50. p)
  51. build_option_proc_p ;;
  52. l)
  53. build_option_proc_l ;;
  54. i)
  55. export INC_BUILD="on" ;;
  56. s)
  57. build_option_proc_s ;;
  58. R)
  59. export ENABLE_TIMELINE="on"
  60. echo "enable time_line record" ;;
  61. S)
  62. build_option_proc_upper_s ;;
  63. k)
  64. check_on_off $OPTARG k
  65. export ENABLE_MAKE_CLEAN="$OPTARG"
  66. echo "enable make clean" ;;
  67. e)
  68. export DEVICE=$OPTARG ;;
  69. M)
  70. check_on_off $OPTARG M
  71. export ENABLE_MPI="$OPTARG" ;;
  72. V)
  73. export DEVICE_VERSION=$OPTARG ;;
  74. P)
  75. check_on_off $OPTARG p
  76. export ENABLE_DUMP2PROTO="$OPTARG"
  77. echo "enable dump anf graph to proto file" ;;
  78. D)
  79. build_option_proc_upper_d ;;
  80. z)
  81. build_option_proc_z ;;
  82. I)
  83. build_option_proc_upper_i ;;
  84. K)
  85. export ENABLE_AKG="on"
  86. echo "enable compile with akg" ;;
  87. B)
  88. build_option_proc_upper_b ;;
  89. E)
  90. export ENABLE_IBVERBS="on"
  91. echo "enable IBVERBS for parameter server" ;;
  92. A)
  93. build_option_proc_upper_a ;;
  94. W)
  95. build_option_proc_upper_w ;;
  96. F)
  97. build_option_proc_upper_f ;;
  98. H)
  99. check_on_off $OPTARG H
  100. export ENABLE_HIDDEN="$OPTARG"
  101. echo "${OPTARG} hidden" ;;
  102. L)
  103. export ENABLE_TRT="on"
  104. export TENSORRT_HOME="$CASE_SENSIVE_ARG"
  105. echo "Link Tensor-RT library. Path: ${CASE_SENSIVE_ARG}" ;;
  106. *)
  107. echo "Unknown option ${opt}!"
  108. usage
  109. exit 1
  110. esac
  111. done
  112. }