Skip to content

Commit

Permalink
Build MFC examples for Windows x86 (Win32) (#434)
Browse files Browse the repository at this point in the history
Also, strip binaries on Linux before uploading.
  • Loading branch information
csukuangfj authored Nov 18, 2023
1 parent 1a6a41e commit ac00eda
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 31 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/aarch64-linux-gnu-shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ on:
- 'toolchains/aarch64-linux-gnu.toolchain.cmake'

workflow_dispatch:
inputs:
release:
description: "Whether to release"
type: boolean

env:
RELEASE:
|- # Release if there is a release tag name or a release flag in workflow_dispatch
${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }}

concurrency:
group: aarch64-linux-gnu-shared-${{ github.ref }}
Expand Down Expand Up @@ -150,6 +141,9 @@ jobs:
- name: Copy files
shell: bash
run: |
export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
aarch64-none-linux-gnu-strip --version
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64-shared
Expand All @@ -158,6 +152,13 @@ jobs:
cp -a build-aarch64-linux-gnu/install/bin $dst/
cp -a build-aarch64-linux-gnu/install/lib $dst/
ls -lh build-aarch64-linux-gnu/install/lib
ls -lh build-aarch64-linux-gnu/install/bin
ls -lh $dst/bin/
echo "strip"
aarch64-none-linux-gnu-strip $dst/bin/*
tree $dst
tar cjvf ${dst}.tar.bz2 $dst
Expand All @@ -168,7 +169,7 @@ jobs:
path: sherpa-onnx-*linux-aarch64-shared.tar.bz2

- name: Release pre-compiled binaries and libs for aarch64 linux
if: env.RELEASE == 'true'
if: 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
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/aarch64-linux-gnu-static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ on:
- 'toolchains/aarch64-linux-gnu.toolchain.cmake'

workflow_dispatch:
inputs:
release:
description: "Whether to release"
type: boolean

env:
RELEASE:
|- # Release if there is a release tag name or a release flag in workflow_dispatch
${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }}

concurrency:
group: aarch64-linux-gnu-static-${{ github.ref }}
Expand Down Expand Up @@ -151,13 +142,21 @@ jobs:
- name: Copy files
shell: bash
run: |
export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
aarch64-none-linux-gnu-strip --version
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64-static
mkdir $dst
ls -lh build-aarch64-linux-gnu/install/lib
cp -a build-aarch64-linux-gnu/install/bin $dst/
cp -a build-aarch64-linux-gnu/install/lib $dst/
ls -lh $dst/bin/
echo "strip"
aarch64-none-linux-gnu-strip $dst/bin/*
ls -lh $dst/bin/
tree $dst
Expand All @@ -169,7 +168,7 @@ jobs:
path: sherpa-onnx-*linux-aarch64-static.tar.bz2

- name: Release pre-compiled binaries and libs for aarch64 linux
if: env.RELEASE == 'true'
if: 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
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/arm-linux-gnueabihf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,25 @@ jobs:
- name: Copy files
shell: bash
run: |
export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
arm-none-linux-gnueabihf-strip --version
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-arm-gnueabihf-${{ matrix.lib_type }}
mkdir $dst
ls -lh build-arm-linux-gnueabihf/install/lib
cp -a build-arm-linux-gnueabihf/install/bin $dst/
cp -a build-arm-linux-gnueabihf/install/lib $dst/
ls -lh $dst/bin/*
arm-none-linux-gnueabihf-strip $dst/bin/*
ls -lh $dst
lib_type=${{ matrix.lib_type }}
if [[ $lib_type == "shared" ]]; then
cp -a build-arm-linux-gnueabihf/install/lib $dst/
fi
tree $dst
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,25 @@ jobs:
- name: Display dependencies of sherpa-onnx for linux
shell: bash
run: |
ls -lh build/bin
ls -lh build/_deps/onnxruntime-src/lib/
echo "strip"
strip build/bin/*
echo "after strip"
ls -lh build/bin
file build/bin/sherpa-onnx
file build/bin/sherpa-onnx
ls -lh build/bin/sherpa-onnx
readelf -d build/bin/sherpa-onnx
- uses: actions/upload-artifact@v3
if: matrix.shared_lib == 'OFF' && matrix.build_type == 'Release'
with:
name: release-static
path: build/bin/*

- name: Test online CTC
shell: bash
run: |
Expand Down Expand Up @@ -186,3 +202,4 @@ jobs:
with:
name: tts-generated-test-files
path: tts

29 changes: 20 additions & 9 deletions .github/workflows/mfc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
# arch: [x64, Win32]
arch: [x64]
arch: [x64, x86]

steps:
- uses: actions/checkout@v4
Expand All @@ -55,7 +54,11 @@ jobs:
run: |
mkdir build
cd build
cmake -A ${{ matrix.arch }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./install ..
arch=${{ matrix.arch }}
if [[ $arch == "x86" ]]; then
arch=Win32
fi
cmake -A $arch -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./install ..
- name: Build sherpa-onnx for windows
shell: bash
Expand Down Expand Up @@ -83,32 +86,40 @@ jobs:
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
arch=${{ matrix.arch }}
if [[ $arch == "x86" ]]; then
src=mfc-examples/Release
ls -h $src
dst=mfc-examples/$arch/Release
mkdir -p $dst
cp $src/* $dst
fi
cd mfc-examples/$arch/Release
ls -lh
cp -v StreamingSpeechRecognition.exe sherpa-onnx-streaming-${SHERPA_ONNX_VERSION}.exe
cp -v NonStreamingSpeechRecognition.exe sherpa-onnx-non-streaming-${SHERPA_ONNX_VERSION}.exe
cp -v NonStreamingTextToSpeech.exe ../sherpa-onnx-non-streaming-tts-${SHERPA_ONNX_VERSION}.exe
cp -v StreamingSpeechRecognition.exe sherpa-onnx-streaming-asr-$arch-${SHERPA_ONNX_VERSION}.exe
cp -v NonStreamingSpeechRecognition.exe sherpa-onnx-non-streaming-asr-$arch-${SHERPA_ONNX_VERSION}.exe
cp -v NonStreamingTextToSpeech.exe ../sherpa-onnx-non-streaming-tts-$arch-${SHERPA_ONNX_VERSION}.exe
ls -lh
- name: Upload artifact tts
uses: actions/upload-artifact@v3
with:
name: non-streaming-tts-${{ matrix.arch }}
path: ./mfc-examples/${{ matrix.arch }}/Release/NonStreamingTextToSpeech.exe
path: ./mfc-examples/${{ matrix.arch }}/sherpa-onnx-non-streaming-tts-*.exe

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: streaming-speech-recognition-${{ matrix.arch }}
path: ./mfc-examples/${{ matrix.arch }}/Release/StreamingSpeechRecognition.exe
path: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-streaming-asr-*.exe

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: non-streaming-speech-recognition-${{ matrix.arch }}
path: ./mfc-examples/${{ matrix.arch }}/Release/NonStreamingSpeechRecognition.exe
path: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-non-streaming-asr-*.exe

- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
Expand Down

0 comments on commit ac00eda

Please sign in to comment.