Fix static link without tts (#2328)
This commit is contained in:
31
.github/workflows/pkg-config.yaml
vendored
31
.github/workflows/pkg-config.yaml
vendored
@@ -33,13 +33,14 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
pkg_config:
|
pkg_config:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
|
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }} tts-${{ matrix.tts }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
build_type: [Release, Debug]
|
build_type: [Release, Debug]
|
||||||
lib_type: [shared, static]
|
lib_type: [shared, static]
|
||||||
|
tts: [ON, OFF]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -67,12 +68,12 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
if [[ ${{ matrix.lib_type }} == "shared" ]]; then
|
if [[ ${{ matrix.lib_type }} == "shared" ]]; then
|
||||||
cmake -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON ..
|
cmake -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.tts }} -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON ..
|
||||||
else
|
else
|
||||||
cmake -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=OFF ..
|
cmake -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.tts }} -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=OFF ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build sherpa-onnx for ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
|
- name: Build sherpa-onnx for ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }} tts-${{ matrix.tts }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||||
@@ -104,16 +105,36 @@ jobs:
|
|||||||
|
|
||||||
cat build/install/sherpa-onnx.pc
|
cat build/install/sherpa-onnx.pc
|
||||||
|
|
||||||
|
- name: Show pkg-config
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
|
||||||
|
pkg-config --cflags sherpa-onnx
|
||||||
|
pkg-config --libs sherpa-onnx
|
||||||
|
|
||||||
- name: Build C API example
|
- name: Build C API example
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
|
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
|
||||||
cd c-api-examples
|
cd c-api-examples
|
||||||
|
|
||||||
|
pkg-config --cflags sherpa-onnx
|
||||||
|
|
||||||
gcc -o decode-file-c-api $(pkg-config --cflags sherpa-onnx) ./decode-file-c-api.c $(pkg-config --libs sherpa-onnx)
|
gcc -o decode-file-c-api $(pkg-config --cflags sherpa-onnx) ./decode-file-c-api.c $(pkg-config --libs sherpa-onnx)
|
||||||
|
|
||||||
./decode-file-c-api --help
|
./decode-file-c-api --help
|
||||||
|
|
||||||
|
- name: Build C API example (tts)
|
||||||
|
if: matrix.tts == 'ON'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
|
||||||
|
cd c-api-examples
|
||||||
|
|
||||||
|
pkg-config --cflags sherpa-onnx
|
||||||
|
|
||||||
gcc -o offline-tts-c-api $(pkg-config --cflags sherpa-onnx) ./offline-tts-c-api.c $(pkg-config --libs sherpa-onnx)
|
gcc -o offline-tts-c-api $(pkg-config --cflags sherpa-onnx) ./offline-tts-c-api.c $(pkg-config --libs sherpa-onnx)
|
||||||
|
|
||||||
./offline-tts-c-api --help
|
./offline-tts-c-api --help
|
||||||
|
|
||||||
- name: Test online transducer (C API)
|
- name: Test online transducer (C API)
|
||||||
@@ -126,5 +147,5 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}
|
name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}-tts-${{ matrix.tts }}
|
||||||
path: tts
|
path: tts
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ Cflags: -I"${includedir}"
|
|||||||
# Note: -lcargs is required only for the following file
|
# Note: -lcargs is required only for the following file
|
||||||
# https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c
|
# https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c
|
||||||
# We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c
|
# We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c
|
||||||
Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fst -lkaldi-native-fbank-core -lkissfft-float -lonnxruntime -lssentencepiece_core -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@
|
Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lkaldi-native-fbank-core -lkissfft-float -lonnxruntime -lssentencepiece_core -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@
|
||||||
|
|||||||
Reference in New Issue
Block a user