Publish pre-built macos xcframework (#1490)
This commit is contained in:
26
.github/workflows/swift.yaml
vendored
26
.github/workflows/swift.yaml
vendored
@@ -4,6 +4,8 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+*'
|
||||
paths:
|
||||
- './build-swift-macos.sh'
|
||||
- '.github/workflows/swift.yaml'
|
||||
@@ -65,6 +67,30 @@ jobs:
|
||||
|
||||
./build-swift-macos.sh
|
||||
|
||||
- name: Copy files
|
||||
if: matrix.os == 'macos-13' && (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||
shell: bash
|
||||
run: |
|
||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||
|
||||
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-macos-xcframework-static
|
||||
mkdir $dst
|
||||
|
||||
mv -v build-swift-macos/sherpa-onnx.xcframework $dst
|
||||
|
||||
brew install tree
|
||||
tree $dst
|
||||
|
||||
tar cjvf ${dst}.tar.bz2 $dst
|
||||
|
||||
- name: Release pre-compiled binaries and libs for macOS
|
||||
if: matrix.os == 'macos-13' && (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
file: sherpa-onnx-*macos-xcframework-static.tar.bz2
|
||||
|
||||
- name: test
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -7,6 +7,9 @@ mkdir -p $dir
|
||||
cd $dir
|
||||
|
||||
cmake \
|
||||
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
||||
-DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_INSTALL_PREFIX=./install \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
@@ -21,6 +24,7 @@ cmake \
|
||||
|
||||
make VERBOSE=1 -j4
|
||||
make install
|
||||
rm -fv ./install/include/cargs.h
|
||||
|
||||
libtool -static -o ./install/lib/libsherpa-onnx.a \
|
||||
./install/lib/libsherpa-onnx-c-api.a \
|
||||
@@ -34,3 +38,8 @@ libtool -static -o ./install/lib/libsherpa-onnx.a \
|
||||
./install/lib/libpiper_phonemize.a \
|
||||
./install/lib/libespeak-ng.a \
|
||||
./install/lib/libssentencepiece_core.a
|
||||
|
||||
xcodebuild -create-xcframework \
|
||||
-library install/lib/libsherpa-onnx.a \
|
||||
-headers install/include \
|
||||
-output sherpa-onnx.xcframework
|
||||
|
||||
@@ -315,4 +315,3 @@ class SHERPA_ONNX_API OfflineRecognizer
|
||||
} // namespace sherpa_onnx::cxx
|
||||
|
||||
#endif // SHERPA_ONNX_C_API_CXX_API_H_
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user