build-m3axpi.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # This script is exclusively for building sherpa-ncnn
  3. # on MAIX-III AXera-Pi
  4. # (https://wiki.sipeed.com/hardware/en/maixIII/ax-pi/axpi.html)
  5. #
  6. # It is not for cross-compiling.
  7. #
  8. # Before running this script, please make sure you have the following
  9. # files:
  10. #
  11. # root@AXERA:~/asr# pwd
  12. # /root/asr
  13. #
  14. # root@AXERA:~/asr# ls -lh
  15. # total 25M
  16. # -rw-r--r-- 1 501 staff 59K Feb 2 17:01 kaldi-native-fbank-1.11.tar.gz
  17. # -rw-r--r-- 1 501 staff 12M Feb 2 17:01 ncnn-sherpa-0.8.tar.gz
  18. # drwxr-xr-x 15 501 staff 4.0K Feb 2 21:04 sherpa-ncnn-1.4.0
  19. #
  20. #
  21. # Note: It is OK if the versions of the above files are different.
  22. # The two `.tar.gz` files must be placed in $HOME/asr
  23. mkdir -p build
  24. cd build
  25. cmake \
  26. -DCMAKE_BUILD_TYPE=Release \
  27. -DCMAKE_INSTALL_PREFIX=./install \
  28. -DBUILD_SHARED_LIBS=OFF \
  29. -DSHERPA_NCNN_ENABLE_PYTHON=OFF \
  30. -DSHERPA_NCNN_ENABLE_PORTAUDIO=OFF \
  31. -DSHERPA_NCNN_ENABLE_JNI=OFF \
  32. -DSHERPA_NCNN_ENABLE_BINARY=ON \
  33. -DSHERPA_NCNN_ENABLE_TEST=OFF \
  34. -DSHERPA_NCNN_ENABLE_C_API=OFF \
  35. -DSHERPA_NCNN_ENABLE_GENERATE_INT8_SCALE_TABLE=OFF \
  36. -DCMAKE_C_FLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=neon" \
  37. -DCMAKE_CXX_FLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=neon" \
  38. ..
  39. make -j 4
  40. cd ..
  41. echo
  42. echo "ls -lh ./build/bin"
  43. # You will find two statically-linked executables in ./build/bin
  44. ls -lh ./build/bin
  45. echo
  46. echo "Please refer to"
  47. echo "https://k2-fsa.github.io/sherpa/ncnn/pretrained_models/index.html"
  48. echo "to download pre-trained models"