Build sherpa-onnx as a single shared library (#1078)

When `-D BUILD_SHARED_LIBS=ON` is passed to `cmake`, it builds a single shared library.

Specifically, 

- For C APIs, it builds `libsherpa-onnx-c-api.so`
- For Python APIs, it builds `_sherpa_onnx.cpython-xx-xx.so`
- For Kotlin and Java APIs, it builds `libsherpa-onnx-jni.so`

There is no `libsherpa-onnx-core.so` any longer.

Note it affects only shared libraries.
This commit is contained in:
Fangjun Kuang
2024-07-06 16:41:54 +08:00
committed by GitHub
parent 55decb7bee
commit a25075101c
69 changed files with 571 additions and 324 deletions

View File

@@ -93,17 +93,12 @@ jobs:
make install
ls -lh ./install/lib
rm -v ./install/lib/libonnxruntime.so
- name: Copy pre-built libs
shell: bash
run: |
cp -v build/install/lib/lib*.so* flutter/sherpa_onnx_linux/linux/
pushd flutter/sherpa_onnx_linux/linux/
rm libonnxruntime.so
ln -s libonnxruntime.so.* ./libonnxruntime.so
popd
mv -v flutter/sherpa_onnx_linux /tmp/to_be_published
@@ -197,27 +192,19 @@ jobs:
cd build
make -j2 install
ls -lh install/lib/libsherpa-onnx-core.dylib
file install/lib/libsherpa-onnx-core.dylib
ls -lh install/lib/libsherpa-onnx-c-api.dylib
file install/lib/libsherpa-onnx-c-api.dylib
rm -v install/lib/libonnxruntime.dylib
- name: Copy pre-built libs
shell: bash
run: |
cp -v build/install/lib/lib*.dylib* flutter/sherpa_onnx_macos/macos/
mv -v flutter/sherpa_onnx_macos /tmp/to_be_published
ls -lh /tmp/to_be_published/macos
pushd /tmp/to_be_published/macos
rm libonnxruntime.dylib
ls -lh
popd
- name: Release
shell: bash
run: |
@@ -283,7 +270,7 @@ jobs:
shell: bash
run: |
cd build
cmake --build . --target install --config Release
cmake --build . --target install --config Release -- -m:2
ls -lh install/lib/*.dll