run-decode-file.sh 962 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. set -ex
  3. if [ ! -d ../build-swift-macos ]; then
  4. echo "Please run ../build-swift-macos.sh first!"
  5. exit 1
  6. fi
  7. if [ ! -d ./sherpa-ncnn-conv-emformer-transducer-2022-12-06 ]; then
  8. echo "Please download the pre-trained model for testing."
  9. echo "You can refer to"
  10. echo ""
  11. echo "https://k2-fsa.github.io/sherpa/ncnn/pretrained_models/conv-emformer-transducer-models.html#csukuangfj-sherpa-ncnn-conv-emformer-transducer-2022-12-06-chinese-english"
  12. echo "for help"
  13. exit 1
  14. fi
  15. if [ ! -e ./decode-file ]; then
  16. # Note: We use -lc++ to link against libc++ instead of libstdc++
  17. swiftc \
  18. -lc++ \
  19. -I ../build-swift-macos/sherpa-ncnn.framework/Headers/ \
  20. -import-objc-header ./SherpaNcnn-Bridging-Header.h \
  21. ./decode-file.swift ./SherpaNcnn.swift \
  22. -F ../build-swift-macos/ \
  23. -framework sherpa-ncnn \
  24. -framework openmp \
  25. -o decode-file
  26. else
  27. echo "./decode-file exists - skip building"
  28. fi
  29. ./decode-file