Skip to content

Commit 8725b30

Browse files
committed
fix static link without tts
1 parent 046ce01 commit 8725b30

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/pkg-config.yaml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ concurrency:
3333
jobs:
3434
pkg_config:
3535
runs-on: ${{ matrix.os }}
36-
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
36+
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }} tts-${{ matrix.tts }}
3737
strategy:
3838
fail-fast: false
3939
matrix:
4040
os: [ubuntu-latest, macos-latest]
4141
build_type: [Release, Debug]
4242
lib_type: [shared, static]
43+
tts: [ON, OFF]
4344

4445
steps:
4546
- uses: actions/checkout@v4
@@ -67,12 +68,12 @@ jobs:
6768
mkdir build
6869
cd build
6970
if [[ ${{ matrix.lib_type }} == "shared" ]]; then
70-
cmake -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON ..
71+
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 ..
7172
else
72-
cmake -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=OFF ..
73+
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 ..
7374
fi
7475
75-
- name: Build sherpa-onnx for ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
76+
- name: Build sherpa-onnx for ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }} tts-${{ matrix.tts }}
7677
shell: bash
7778
run: |
7879
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
@@ -104,16 +105,36 @@ jobs:
104105
105106
cat build/install/sherpa-onnx.pc
106107
108+
- name: Show pkg-config
109+
shell: bash
110+
run: |
111+
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
112+
pkg-config --cflags sherpa-onnx
113+
pkg-config --libs sherpa-onnx
114+
107115
- name: Build C API example
108116
shell: bash
109117
run: |
110118
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
111119
cd c-api-examples
112120
121+
pkg-config --cflags sherpa-onnx
122+
113123
gcc -o decode-file-c-api $(pkg-config --cflags sherpa-onnx) ./decode-file-c-api.c $(pkg-config --libs sherpa-onnx)
124+
114125
./decode-file-c-api --help
115126
127+
- name: Build C API example (tts)
128+
if: matrix.tts == 'ON'
129+
shell: bash
130+
run: |
131+
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
132+
cd c-api-examples
133+
134+
pkg-config --cflags sherpa-onnx
135+
116136
gcc -o offline-tts-c-api $(pkg-config --cflags sherpa-onnx) ./offline-tts-c-api.c $(pkg-config --libs sherpa-onnx)
137+
117138
./offline-tts-c-api --help
118139
119140
- name: Test online transducer (C API)
@@ -126,5 +147,5 @@ jobs:
126147
127148
- uses: actions/upload-artifact@v4
128149
with:
129-
name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}
150+
name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}-tts-${{ matrix.tts }}
130151
path: tts

cmake/sherpa-onnx-static-no-tts.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Cflags: -I"${includedir}"
2222
# Note: -lcargs is required only for the following file
2323
# https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c
2424
# We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c
25-
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@
25+
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@

0 commit comments

Comments
 (0)