run-decode-file.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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.xcframework/Headers/ \
  20. -import-objc-header ./SherpaNcnn-Bridging-Header.h \
  21. ./decode-file.swift ./SherpaNcnn.swift \
  22. -L ../build-swift-macos/openmp.xcframework/macos-x86_64 \
  23. -L ../build-swift-macos/sherpa-ncnn.xcframework/macos-x86_64 \
  24. -l sherpa-ncnn \
  25. -l omp \
  26. -o decode-file
  27. else
  28. echo "./decode-file exists - skip building"
  29. fi
  30. ./decode-file