From a15f33c74064e5df679ae247e4b516ad16672ab4 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 14:26:00 +0800 Subject: [PATCH 01/54] Hide as many symbols as possible. --- CMakeLists.txt | 24 ++++++++++++ build-android-arm64-v8a.sh | 5 +++ build-android-armv7-eabi.sh | 5 +++ build-android-x86-64.sh | 5 +++ build-android-x86.sh | 5 +++ cmake/cmake_extension.py | 14 +------ cmake/espeak-ng-for-piper.cmake | 56 ++++++++++++++++++---------- cmake/kaldi-decoder.cmake | 63 +++++++++++++++++++++----------- cmake/kaldi-native-fbank.cmake | 32 ++++++++++++---- cmake/kaldifst.cmake | 15 ++++++++ cmake/openfst.cmake | 17 +++++++++ cmake/piper-phonemize.cmake | 43 +++++++++++++++------- cmake/simple-sentencepiece.cmake | 32 ++++++++++++---- sherpa-onnx/csrc/CMakeLists.txt | 18 ++++++++- sherpa-onnx/jni/CMakeLists.txt | 3 ++ sherpa-onnx/jni/common.h | 22 ++++++++++- 16 files changed, 277 insertions(+), 82 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66284fd92..03ec4712d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version. Used only for macOS") +set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) + project(sherpa-onnx) # Remember to update @@ -18,6 +21,21 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") cmake_policy(SET CMP0135 NEW) endif() + +include(CheckIPOSupported) +check_ipo_supported(RESULT ipo) + +if(ipo) + message(STATUS "IPO is enabled") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) +else() + message(STATUS "IPO is not available") +endif() + +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + option(SHERPA_ONNX_ENABLE_PYTHON "Whether to build Python" OFF) option(SHERPA_ONNX_ENABLE_TESTS "Whether to build tests" OFF) option(SHERPA_ONNX_ENABLE_CHECK "Whether to build with assert" OFF) @@ -38,6 +56,7 @@ option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. option(SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE "True to use pre-installed onnxruntime if available" ON) option(SHERPA_ONNX_ENABLE_SANITIZER "Whether to enable ubsan and asan" OFF) option(SHERPA_ONNX_BUILD_C_API_EXAMPLES "Whether to enable C API examples" ON) +option(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB "Whether to build a single shared lib. Used only when BUILD_SHARED_LIBS is ON" OFF) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") @@ -129,6 +148,11 @@ message(STATUS "SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY ${SHERPA_ONNX_LINK_LIBSTDC message(STATUS "SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE ${SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE}") message(STATUS "SHERPA_ONNX_ENABLE_SANITIZER: ${SHERPA_ONNX_ENABLE_SANITIZER}") message(STATUS "SHERPA_ONNX_BUILD_C_API_EXAMPLES: ${SHERPA_ONNX_BUILD_C_API_EXAMPLES}") +message(STATUS "SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB: ${SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB}") + +if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND NOT BUILD_SHARED_LIBS) + message(FATAL_ERROR "Please set BUILD_SHARED_LIBS to ON if you set SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB") +endif() if(SHERPA_ONNX_ENABLE_TTS) message(STATUS "TTS is enabled") diff --git a/build-android-arm64-v8a.sh b/build-android-arm64-v8a.sh index b48b5b246..e60cddd07 100755 --- a/build-android-arm64-v8a.sh +++ b/build-android-arm64-v8a.sh @@ -75,7 +75,12 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi +if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON +fi + cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-android-armv7-eabi.sh b/build-android-armv7-eabi.sh index b9f28b195..1cda3527c 100755 --- a/build-android-armv7-eabi.sh +++ b/build-android-armv7-eabi.sh @@ -76,7 +76,12 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi +if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON +fi + cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-android-x86-64.sh b/build-android-x86-64.sh index b88836749..ccfcb1942 100755 --- a/build-android-x86-64.sh +++ b/build-android-x86-64.sh @@ -76,7 +76,12 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi +if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON +fi + cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-android-x86.sh b/build-android-x86.sh index 657ae9a42..0831199bd 100755 --- a/build-android-x86.sh +++ b/build-android-x86.sh @@ -76,7 +76,12 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi +if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON +fi + cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index c9303c688..56202e162 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -76,19 +76,7 @@ def get_binaries(): if is_windows(): binaries += [ - "espeak-ng.dll", - "kaldi-decoder-core.dll", - "kaldi-native-fbank-core.dll", "onnxruntime.dll", - "ssentencepiece_core.dll", - "piper_phonemize.dll", - "sherpa-onnx-c-api.dll", - "sherpa-onnx-core.dll", - "sherpa-onnx-fstfar.dll", - "sherpa-onnx-fst.dll", - "sherpa-onnx-kaldifst-core.dll", - "sherpa-onnx-portaudio.dll", - "ucd.dll", ] return binaries @@ -141,10 +129,12 @@ def build_extension(self, ext: setuptools.extension.Extension): extra_cmake_args = f" -DCMAKE_INSTALL_PREFIX={install_dir} " extra_cmake_args += " -DBUILD_SHARED_LIBS=ON " + extra_cmake_args += " -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON " extra_cmake_args += " -DBUILD_PIPER_PHONMIZE_EXE=OFF " extra_cmake_args += " -DBUILD_PIPER_PHONMIZE_TESTS=OFF " extra_cmake_args += " -DBUILD_ESPEAK_NG_EXE=OFF " extra_cmake_args += " -DBUILD_ESPEAK_NG_TESTS=OFF " + extra_cmake_args += " -DSHERPA_ONNX_ENABLE_C_API=ON " extra_cmake_args += " -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF " extra_cmake_args += " -DSHERPA_ONNX_ENABLE_CHECK=OFF " diff --git a/cmake/espeak-ng-for-piper.cmake b/cmake/espeak-ng-for-piper.cmake index 8601ab2d4..ce8aaf6ac 100644 --- a/cmake/espeak-ng-for-piper.cmake +++ b/cmake/espeak-ng-for-piper.cmake @@ -53,7 +53,23 @@ function(download_espeak_ng_for_piper) message(STATUS "espeak-ng is downloaded to ${espeak_ng_SOURCE_DIR}") message(STATUS "espeak-ng binary dir is ${espeak_ng_BINARY_DIR}") + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${espeak_ng_SOURCE_DIR} ${espeak_ng_BINARY_DIR}) + + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties(espeak-ng + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + set(espeak_ng_SOURCE_DIR ${espeak_ng_SOURCE_DIR} PARENT_SCOPE) if(WIN32 AND MSVC) @@ -107,27 +123,29 @@ function(download_espeak_ng_for_piper) ${espeak_ng_SOURCE_DIR}/src/ucd-tools/src/include ) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS - espeak-ng - ucd - DESTINATION ..) - else() - install(TARGETS - espeak-ng - ucd - DESTINATION lib) - endif() + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS + espeak-ng + ucd + DESTINATION ..) + else() + install(TARGETS + espeak-ng + ucd + DESTINATION lib) + endif() - if(NOT BUILD_SHARED_LIBS) - install(TARGETS ucd DESTINATION lib) - endif() + if(NOT BUILD_SHARED_LIBS) + install(TARGETS ucd DESTINATION lib) + endif() - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS - espeak-ng - ucd - DESTINATION bin) + if(WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS + espeak-ng + ucd + DESTINATION bin) + endif() endif() endfunction() diff --git a/cmake/kaldi-decoder.cmake b/cmake/kaldi-decoder.cmake index 02e62e44f..b97d7abb1 100644 --- a/cmake/kaldi-decoder.cmake +++ b/cmake/kaldi-decoder.cmake @@ -45,8 +45,25 @@ function(download_kaldi_decoder) message(STATUS "kaldi-decoder's binary dir is ${kaldi_decoder_BINARY_DIR}") include_directories(${kaldi_decoder_SOURCE_DIR}) + + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${kaldi_decoder_SOURCE_DIR} ${kaldi_decoder_BINARY_DIR} EXCLUDE_FROM_ALL) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties( + kaldi-decoder-core + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + if(WIN32 AND MSVC) target_compile_options(kaldi-decoder-core PUBLIC /wd4018 @@ -58,29 +75,31 @@ function(download_kaldi_decoder) INTERFACE ${kaldi-decoder_SOURCE_DIR}/ ) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS - kaldi-decoder-core - kaldifst_core - fst - fstfar - DESTINATION ..) - else() - install(TARGETS - kaldi-decoder-core - kaldifst_core - fst - fstfar - DESTINATION lib) - endif() + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS + kaldi-decoder-core + kaldifst_core + fst + fstfar + DESTINATION ..) + else() + install(TARGETS + kaldi-decoder-core + kaldifst_core + fst + fstfar + DESTINATION lib) + endif() - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS - kaldi-decoder-core - kaldifst_core - fst - fstfar - DESTINATION bin) + if(WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS + kaldi-decoder-core + kaldifst_core + fst + fstfar + DESTINATION bin) + endif() endif() endfunction() diff --git a/cmake/kaldi-native-fbank.cmake b/cmake/kaldi-native-fbank.cmake index 1d10a01e6..21fdd99b2 100644 --- a/cmake/kaldi-native-fbank.cmake +++ b/cmake/kaldi-native-fbank.cmake @@ -44,20 +44,38 @@ function(download_kaldi_native_fbank) message(STATUS "kaldi-native-fbank is downloaded to ${kaldi_native_fbank_SOURCE_DIR}") message(STATUS "kaldi-native-fbank's binary dir is ${kaldi_native_fbank_BINARY_DIR}") + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${kaldi_native_fbank_SOURCE_DIR} ${kaldi_native_fbank_BINARY_DIR} EXCLUDE_FROM_ALL) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties(kaldi-native-fbank-core + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + target_include_directories(kaldi-native-fbank-core INTERFACE ${kaldi_native_fbank_SOURCE_DIR}/ ) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS kaldi-native-fbank-core DESTINATION ..) - else() - install(TARGETS kaldi-native-fbank-core DESTINATION lib) - endif() - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS kaldi-native-fbank-core DESTINATION bin) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS kaldi-native-fbank-core DESTINATION ..) + else() + install(TARGETS kaldi-native-fbank-core DESTINATION lib) + endif() + + if(WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS kaldi-native-fbank-core DESTINATION bin) + endif() endif() endfunction() diff --git a/cmake/kaldifst.cmake b/cmake/kaldifst.cmake index 5e2130dbe..9daf05584 100644 --- a/cmake/kaldifst.cmake +++ b/cmake/kaldifst.cmake @@ -43,8 +43,23 @@ function(download_kaldifst) list(APPEND CMAKE_MODULE_PATH ${kaldifst_SOURCE_DIR}/cmake) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${kaldifst_SOURCE_DIR} ${kaldifst_BINARY_DIR} EXCLUDE_FROM_ALL) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties(kaldifst_core + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + target_include_directories(kaldifst_core PUBLIC ${kaldifst_SOURCE_DIR}/ diff --git a/cmake/openfst.cmake b/cmake/openfst.cmake index 77e4c157d..ffeb1fd36 100644 --- a/cmake/openfst.cmake +++ b/cmake/openfst.cmake @@ -67,7 +67,24 @@ function(download_openfst) FetchContent_Populate(openfst) endif() message(STATUS "openfst is downloaded to ${openfst_SOURCE_DIR}") + + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${openfst_SOURCE_DIR} ${openfst_BINARY_DIR} EXCLUDE_FROM_ALL) + + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties(fst fstfar + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + set(openfst_SOURCE_DIR ${openfst_SOURCE_DIR} PARENT_SCOPE) set_target_properties(fst PROPERTIES OUTPUT_NAME "sherpa-onnx-fst") diff --git a/cmake/piper-phonemize.cmake b/cmake/piper-phonemize.cmake index 4facf7e17..103d28392 100644 --- a/cmake/piper-phonemize.cmake +++ b/cmake/piper-phonemize.cmake @@ -40,8 +40,23 @@ function(download_piper_phonemize) message(STATUS "piper-phonemize is downloaded to ${piper_phonemize_SOURCE_DIR}") message(STATUS "piper-phonemize binary dir is ${piper_phonemize_BINARY_DIR}") + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${piper_phonemize_SOURCE_DIR} ${piper_phonemize_BINARY_DIR} EXCLUDE_FROM_ALL) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties(piper_phonemize + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + if(WIN32 AND MSVC) target_compile_options(piper_phonemize PUBLIC /wd4309 @@ -53,20 +68,22 @@ function(download_piper_phonemize) ${piper_phonemize_SOURCE_DIR}/src/include ) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS - piper_phonemize - DESTINATION ..) - else() - install(TARGETS - piper_phonemize - DESTINATION lib) - endif() + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS + piper_phonemize + DESTINATION ..) + else() + install(TARGETS + piper_phonemize + DESTINATION lib) + endif() - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS - piper_phonemize - DESTINATION bin) + if(WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS + piper_phonemize + DESTINATION bin) + endif() endif() endfunction() diff --git a/cmake/simple-sentencepiece.cmake b/cmake/simple-sentencepiece.cmake index fcdd44425..8db411192 100644 --- a/cmake/simple-sentencepiece.cmake +++ b/cmake/simple-sentencepiece.cmake @@ -42,21 +42,39 @@ function(download_simple_sentencepiece) FetchContent_Populate(simple-sentencepiece) endif() message(STATUS "simple-sentencepiece is downloaded to ${simple-sentencepiece_SOURCE_DIR}") + + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + endif() + add_subdirectory(${simple-sentencepiece_SOURCE_DIR} ${simple-sentencepiece_BINARY_DIR} EXCLUDE_FROM_ALL) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + set_target_properties(ssentencepiece_core + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) + set(BUILD_SHARED_LIBS ON) + endif() + target_include_directories(ssentencepiece_core PUBLIC ${simple-sentencepiece_SOURCE_DIR}/ ) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS ssentencepiece_core DESTINATION ..) - else() - install(TARGETS ssentencepiece_core DESTINATION lib) - endif() + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS ssentencepiece_core DESTINATION ..) + else() + install(TARGETS ssentencepiece_core DESTINATION lib) + endif() - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS ssentencepiece_core DESTINATION bin) + if(WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS ssentencepiece_core DESTINATION bin) + endif() endif() endfunction() diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index 29d789552..6b7397c99 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -154,7 +154,23 @@ endif() if(SHERPA_ONNX_ENABLE_CHECK) list(APPEND sources log.cc) endif() -add_library(sherpa-onnx-core ${sources}) + +if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + add_library(sherpa-onnx-core STATIC ${sources}) +else() + add_library(sherpa-onnx-core ${sources}) +endif() + +if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + set_target_properties( + sherpa-onnx-core + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + ) +endif() + if(APPLE) target_compile_options(sherpa-onnx-core PRIVATE -Wno-deprecated-declarations diff --git a/sherpa-onnx/jni/CMakeLists.txt b/sherpa-onnx/jni/CMakeLists.txt index 64944b4a9..998379084 100644 --- a/sherpa-onnx/jni/CMakeLists.txt +++ b/sherpa-onnx/jni/CMakeLists.txt @@ -35,5 +35,8 @@ endif() add_library(sherpa-onnx-jni ${sources}) +target_compile_definitions(sherpa-onnx-jni PRIVATE SHERPA_ONNX_BUILD_SHARED_LIBS=1) +target_compile_definitions(sherpa-onnx-jni PRIVATE SHERPA_ONNX_BUILD_MAIN_LIB=1) + target_link_libraries(sherpa-onnx-jni sherpa-onnx-core) install(TARGETS sherpa-onnx-jni DESTINATION lib) diff --git a/sherpa-onnx/jni/common.h b/sherpa-onnx/jni/common.h index fede5421c..cb7dabe74 100644 --- a/sherpa-onnx/jni/common.h +++ b/sherpa-onnx/jni/common.h @@ -12,11 +12,31 @@ #include "android/asset_manager_jni.h" #endif +#if defined(_WIN32) +#if defined(SHERPA_ONNX_BUILD_SHARED_LIBS) +#define SHERPA_ONNX_EXPORT __declspec(dllexport) +#define SHERPA_ONNX_IMPORT __declspec(dllimport) +#else +#define SHERPA_ONNX_EXPORT +#define SHERPA_ONNX_IMPORT +#endif +#else // WIN32 +#define SHERPA_ONNX_EXPORT __attribute__((visibility("default"))) + +#define SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT +#endif // WIN32 + +#if defined(SHERPA_ONNX_BUILD_MAIN_LIB) +#define SHERPA_ONNX_API SHERPA_ONNX_EXPORT +#else +#define SHERPA_ONNX_API SHERPA_ONNX_IMPORT +#endif + // If you use ndk, you can find "jni.h" inside // android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include #include "jni.h" // NOLINT -#define SHERPA_ONNX_EXTERN_C extern "C" +#define SHERPA_ONNX_EXTERN_C extern "C" SHERPA_ONNX_API // defined in jni.cc jobject NewInteger(JNIEnv *env, int32_t value); From 757b9092b158a66358eef9c8c9a3082b79316333 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 14:51:09 +0800 Subject: [PATCH 02/54] Fix for windows --- cmake/espeak-ng-for-piper.cmake | 2 +- cmake/kaldi-decoder.cmake | 2 +- cmake/kaldi-native-fbank.cmake | 2 +- cmake/piper-phonemize.cmake | 2 +- cmake/simple-sentencepiece.cmake | 2 +- sherpa-onnx/csrc/CMakeLists.txt | 38 +++++++++++++++++++++++--------- 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/cmake/espeak-ng-for-piper.cmake b/cmake/espeak-ng-for-piper.cmake index ce8aaf6ac..f85342f67 100644 --- a/cmake/espeak-ng-for-piper.cmake +++ b/cmake/espeak-ng-for-piper.cmake @@ -123,7 +123,7 @@ function(download_espeak_ng_for_piper) ${espeak_ng_SOURCE_DIR}/src/ucd-tools/src/include ) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) install(TARGETS espeak-ng diff --git a/cmake/kaldi-decoder.cmake b/cmake/kaldi-decoder.cmake index b97d7abb1..db2a3107e 100644 --- a/cmake/kaldi-decoder.cmake +++ b/cmake/kaldi-decoder.cmake @@ -75,7 +75,7 @@ function(download_kaldi_decoder) INTERFACE ${kaldi-decoder_SOURCE_DIR}/ ) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) install(TARGETS kaldi-decoder-core diff --git a/cmake/kaldi-native-fbank.cmake b/cmake/kaldi-native-fbank.cmake index 21fdd99b2..cdf88ffc5 100644 --- a/cmake/kaldi-native-fbank.cmake +++ b/cmake/kaldi-native-fbank.cmake @@ -66,7 +66,7 @@ function(download_kaldi_native_fbank) ${kaldi_native_fbank_SOURCE_DIR}/ ) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) install(TARGETS kaldi-native-fbank-core DESTINATION ..) else() diff --git a/cmake/piper-phonemize.cmake b/cmake/piper-phonemize.cmake index 103d28392..0facbbbc0 100644 --- a/cmake/piper-phonemize.cmake +++ b/cmake/piper-phonemize.cmake @@ -68,7 +68,7 @@ function(download_piper_phonemize) ${piper_phonemize_SOURCE_DIR}/src/include ) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) install(TARGETS piper_phonemize diff --git a/cmake/simple-sentencepiece.cmake b/cmake/simple-sentencepiece.cmake index 8db411192..dacdb11f0 100644 --- a/cmake/simple-sentencepiece.cmake +++ b/cmake/simple-sentencepiece.cmake @@ -65,7 +65,7 @@ function(download_simple_sentencepiece) ${simple-sentencepiece_SOURCE_DIR}/ ) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) install(TARGETS ssentencepiece_core DESTINATION ..) else() diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index 6b7397c99..fa50304b1 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -157,6 +157,12 @@ endif() if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) add_library(sherpa-onnx-core STATIC ${sources}) + # if(MSVC) + # # To fix the following error for Windows when building exe + # # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_Dynamic Release' + # add_library(sherpa-onnx-core-shared ${sources}) + # set(sherpa-onnx-core-lib sherpa-onnx-core-shared) + # endif() else() add_library(sherpa-onnx-core ${sources}) endif() @@ -279,14 +285,16 @@ if(SHERPA_ONNX_ENABLE_BINARY) endif() endif() -if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS sherpa-onnx-core DESTINATION ..) -else() - install(TARGETS sherpa-onnx-core DESTINATION lib) -endif() +if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS sherpa-onnx-core DESTINATION ..) + else() + install(TARGETS sherpa-onnx-core DESTINATION lib) + endif() -if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS sherpa-onnx-core DESTINATION bin) + if(WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS sherpa-onnx-core DESTINATION bin) + endif() endif() if(SHERPA_ONNX_ENABLE_BINARY) @@ -326,9 +334,19 @@ if(SHERPA_ONNX_HAS_ALSA AND SHERPA_ONNX_ENABLE_BINARY) ) endif() - foreach(exe IN LISTS exes) - target_link_libraries(${exe} sherpa-onnx-core) - endforeach() + # # To fix the following error for Windows when building exe + # # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_Dynamic Release' + if(MSVC AND SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + add_library(sherpa-onnx-core-shared SHARED) + target_link_libraries(sherpa-onnx-core-shared sherpa-onnx-core) + foreach(exe IN LISTS exes) + target_link_libraries(${exe} sherpa-onnx-core-shared) + endforeach() + else() + foreach(exe IN LISTS exes) + target_link_libraries(${exe} sherpa-onnx-core) + endforeach() + endif foreach(exe IN LISTS exes) if(DEFINED ENV{SHERPA_ONNX_ALSA_LIB_DIR}) From 66959bdc025922fe0c333480953cf053c9ffa1d5 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 15:25:08 +0800 Subject: [PATCH 03/54] Fix windows building --- CMakeLists.txt | 2 +- cmake/portaudio.cmake | 4 ++++ sherpa-onnx/csrc/CMakeLists.txt | 35 ++++++++++++--------------------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03ec4712d..2f6686e64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,7 @@ if(BUILD_SHARED_LIBS AND MSVC) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -if(NOT BUILD_SHARED_LIBS AND MSVC) +if((NOT BUILD_SHARED_LIBS OR SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) AND MSVC) # see https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html # https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake if(MSVC) diff --git a/cmake/portaudio.cmake b/cmake/portaudio.cmake index 4f176594f..8ef9b0a1d 100644 --- a/cmake/portaudio.cmake +++ b/cmake/portaudio.cmake @@ -26,6 +26,10 @@ function(download_portaudio) endif() endforeach() + if(MSVC AND SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + set(BUILD_SHARED_LIBS OFF) + endif() + if(BUILD_SHARED_LIBS) set(PA_BUILD_SHARED ON CACHE BOOL "" FORCE) set(PA_BUILD_STATIC OFF CACHE BOOL "" FORCE) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index fa50304b1..e7c5fc173 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -155,19 +155,17 @@ if(SHERPA_ONNX_ENABLE_CHECK) list(APPEND sources log.cc) endif() -if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) - add_library(sherpa-onnx-core STATIC ${sources}) - # if(MSVC) - # # To fix the following error for Windows when building exe - # # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_Dynamic Release' - # add_library(sherpa-onnx-core-shared ${sources}) - # set(sherpa-onnx-core-lib sherpa-onnx-core-shared) - # endif() -else() - add_library(sherpa-onnx-core ${sources}) +if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + # We set BUILD_SHARED_LIBS to OFF only in this file so that + # building EXEs won't throw the following error + # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't + # match value 'MD_Dynamic Release' + set(BUILD_SHARED_LIBS OFF) endif() -if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) +add_library(sherpa-onnx-core ${sources}) + +if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) set_target_properties( sherpa-onnx-core PROPERTIES @@ -336,17 +334,10 @@ if(SHERPA_ONNX_HAS_ALSA AND SHERPA_ONNX_ENABLE_BINARY) # # To fix the following error for Windows when building exe # # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_Dynamic Release' - if(MSVC AND SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - add_library(sherpa-onnx-core-shared SHARED) - target_link_libraries(sherpa-onnx-core-shared sherpa-onnx-core) - foreach(exe IN LISTS exes) - target_link_libraries(${exe} sherpa-onnx-core-shared) - endforeach() - else() - foreach(exe IN LISTS exes) - target_link_libraries(${exe} sherpa-onnx-core) - endforeach() - endif + + foreach(exe IN LISTS exes) + target_link_libraries(${exe} sherpa-onnx-core) + endforeach() foreach(exe IN LISTS exes) if(DEFINED ENV{SHERPA_ONNX_ALSA_LIB_DIR}) From 3cc019cafd9cf16d40908e3c815435b69bddfd11 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 15:32:20 +0800 Subject: [PATCH 04/54] Fix warnings on windows --- sherpa-onnx/csrc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index e7c5fc173..b4e5abf86 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -497,7 +497,7 @@ if(SHERPA_ONNX_ENABLE_WEBSOCKET AND SHERPA_ONNX_ENABLE_BINARY) target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - if(SHERPA_ONNX_ENABLE_PYTHON) + if(SHERPA_ONNX_ENABLE_PYTHON AND NOT WIN32) target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") From 8107d1b5a9adfc1e7a5460ad7155d1981a2730e3 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 15:35:08 +0800 Subject: [PATCH 05/54] restore BUILD_SHARED_LIBS --- sherpa-onnx/csrc/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index b4e5abf86..0a26b5fb9 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -155,6 +155,7 @@ if(SHERPA_ONNX_ENABLE_CHECK) list(APPEND sources log.cc) endif() +set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) # We set BUILD_SHARED_LIBS to OFF only in this file so that # building EXEs won't throw the following error @@ -575,3 +576,4 @@ add_custom_target( add_custom_target(check DEPENDS clang-tidy-check) +set(BUILD_SHARED_LIBS ${_build_shared_libs_bak}) From 5329a80ad80efb87cd76f39ff832f4f3fb058372 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 15:39:13 +0800 Subject: [PATCH 06/54] minor fixes --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f6686e64..5f4db20b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. option(SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE "True to use pre-installed onnxruntime if available" ON) option(SHERPA_ONNX_ENABLE_SANITIZER "Whether to enable ubsan and asan" OFF) option(SHERPA_ONNX_BUILD_C_API_EXAMPLES "Whether to enable C API examples" ON) -option(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB "Whether to build a single shared lib. Used only when BUILD_SHARED_LIBS is ON" OFF) +option(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB "Whether to build a single shared lib." OFF) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") @@ -151,7 +151,8 @@ message(STATUS "SHERPA_ONNX_BUILD_C_API_EXAMPLES: ${SHERPA_ONNX_BUILD_C_API_EXAM message(STATUS "SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB: ${SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB}") if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "Please set BUILD_SHARED_LIBS to ON if you set SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB") + message(STATUS "Set BUILD_SHARED_LIBS to ON since SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB is ON") + set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) endif() if(SHERPA_ONNX_ENABLE_TTS) From 66385cb525c76407aa0bf67ad9a310207901ee6b Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 16:07:40 +0800 Subject: [PATCH 07/54] Fix ci --- .github/workflows/dot-net.yaml | 1 + .github/workflows/linux-gpu.yaml | 14 +++++++++++++- .github/workflows/linux-jni.yaml | 15 ++++++++++++++- .github/workflows/linux.yaml | 14 +++++++++++++- .github/workflows/macos-jni.yaml | 5 +++-- .github/workflows/macos.yaml | 9 ++++++++- .github/workflows/npm-addon-linux-aarch64.yaml | 1 + .github/workflows/npm-addon-linux-x64.yaml | 1 + .github/workflows/npm-addon-macos.yaml | 1 + .github/workflows/npm-addon-win-x64.yaml | 1 + .github/workflows/release-dart-package.yaml | 3 +++ .github/workflows/riscv64-linux.yaml | 8 ++++++++ .github/workflows/run-java-test.yaml | 1 + .github/workflows/test-dart.yaml | 3 ++- .github/workflows/test-dot-net.yaml | 1 + .github/workflows/test-go.yaml | 10 +++++++++- .github/workflows/test-nodejs-addon-api.yaml | 2 ++ .github/workflows/windows-arm64.yaml | 10 +++++++++- .github/workflows/windows-x64-cuda.yaml | 9 ++++++++- .github/workflows/windows-x64-debug.yaml | 8 +++++++- .github/workflows/windows-x64-jni.yaml | 9 ++++++++- .github/workflows/windows-x64.yaml | 9 ++++++++- .github/workflows/windows-x86-debug.yaml | 7 ++++++- .github/workflows/windows-x86.yaml | 9 ++++++++- java-api-examples/run-add-punctuation-zh-en.sh | 1 + .../run-audio-tagging-ced-from-file.sh | 1 + .../run-audio-tagging-zipformer-from-file.sh | 1 + .../run-inverse-text-normalization-paraformer.sh | 1 + .../run-inverse-text-normalization-transducer.sh | 1 + java-api-examples/run-kws-from-file.sh | 1 + .../run-non-streaming-decode-file-nemo.sh | 1 + .../run-non-streaming-decode-file-paraformer.sh | 1 + ...n-non-streaming-decode-file-tele-speech-ctc.sh | 1 + .../run-non-streaming-decode-file-transducer.sh | 1 + .../run-non-streaming-decode-file-whisper.sh | 1 + .../run-non-streaming-tts-coqui-de.sh | 1 + .../run-non-streaming-tts-piper-en.sh | 1 + .../run-non-streaming-tts-vits-zh.sh | 1 + java-api-examples/run-speaker-identification.sh | 1 + .../run-spoken-language-identification-whisper.sh | 1 + .../run-streaming-asr-from-mic-transducer.sh | 1 + .../run-streaming-decode-file-ctc-hlg.sh | 1 + .../run-streaming-decode-file-ctc.sh | 1 + .../run-streaming-decode-file-paraformer.sh | 1 + .../run-streaming-decode-file-transducer.sh | 1 + .../run-vad-from-mic-non-streaming-paraformer.sh | 1 + .../run-vad-from-mic-non-streaming-whisper.sh | 1 + java-api-examples/run-vad-from-mic.sh | 1 + .../run-vad-non-streaming-paraformer.sh | 1 + java-api-examples/run-vad-remove-slience.sh | 1 + scripts/go/_internal/build_darwin_amd64.go | 2 +- scripts/go/_internal/build_darwin_arm64.go | 2 +- 52 files changed, 164 insertions(+), 17 deletions(-) diff --git a/.github/workflows/dot-net.yaml b/.github/workflows/dot-net.yaml index 917e85b95..a5aedbeaf 100644 --- a/.github/workflows/dot-net.yaml +++ b/.github/workflows/dot-net.yaml @@ -41,6 +41,7 @@ jobs: cmake \ $opts \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ diff --git a/.github/workflows/linux-gpu.yaml b/.github/workflows/linux-gpu.yaml index 3f6052e63..ad5b95a47 100644 --- a/.github/workflows/linux-gpu.yaml +++ b/.github/workflows/linux-gpu.yaml @@ -72,7 +72,13 @@ jobs: mkdir build cd build - cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON -DSHERPA_ONNX_ENABLE_GPU=ON .. + cmake \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D CMAKE_INSTALL_PREFIX=./install \ + -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ + -D SHERPA_ONNX_ENABLE_GPU=ON \ + .. - name: Build sherpa-onnx for ubuntu shell: bash @@ -86,6 +92,12 @@ jobs: ls -lh lib ls -lh bin + echo "----" + ls -lh install/lib + + echo "----" + ls -lh install/bin + - name: Display dependencies of sherpa-onnx for linux shell: bash run: | diff --git a/.github/workflows/linux-jni.yaml b/.github/workflows/linux-jni.yaml index 4bea999d8..0d9b44f17 100644 --- a/.github/workflows/linux-jni.yaml +++ b/.github/workflows/linux-jni.yaml @@ -95,7 +95,14 @@ jobs: mkdir build cd build - cmake -DSHERPA_ONNX_ENABLE_TTS=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./install -DSHERPA_ONNX_ENABLE_JNI=ON .. + cmake \ + -D SHERPA_ONNX_ENABLE_TTS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ + -D CMAKE_INSTALL_PREFIX=./install \ + -D SHERPA_ONNX_ENABLE_JNI=ON \ + .. make -j2 make install @@ -105,6 +112,12 @@ jobs: rm -rf ./install/pkgconfig rm -rf ./install/share + echo "----" + ls -lh install/lib + + echo "----" + ls -lh install/bin + - name: Display dependencies of sherpa-onnx for linux shell: bash run: | diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 2be4db5b0..1fdc8e6f4 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -99,7 +99,13 @@ jobs: mkdir build cd build - cmake -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. + cmake \ + -D SHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ + -D CMAKE_INSTALL_PREFIX=./install \ + .. make -j2 make install @@ -107,6 +113,12 @@ jobs: ls -lh lib ls -lh bin + echo "----" + ls -lh install/lib + + echo "----" + ls -lh install/bin + - name: Display dependencies of sherpa-onnx for linux shell: bash run: | diff --git a/.github/workflows/macos-jni.yaml b/.github/workflows/macos-jni.yaml index 57ac69681..2514466c5 100644 --- a/.github/workflows/macos-jni.yaml +++ b/.github/workflows/macos-jni.yaml @@ -52,8 +52,9 @@ jobs: cmake \ -D BUILD_SHARED_LIBS=ON \ -D CMAKE_BUILD_TYPE=Release \ - -DCMAKE_OSX_ARCHITECTURES=$arch \ - -DSHERPA_ONNX_ENABLE_JNI=ON \ + -D CMAKE_OSX_ARCHITECTURES=$arch \ + -D SHERPA_ONNX_ENABLE_JNI=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DCMAKE_INSTALL_PREFIX=./install \ .. diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index cb88c8534..221e9f5b1 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -84,7 +84,14 @@ jobs: BUILD_SHARED_LIBS=ON fi - cmake -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_INSTALL_PREFIX=./install .. + cmake \ + -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ + -D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D CMAKE_OSX_ARCHITECTURES='arm64;x86_64' \ + -D CMAKE_INSTALL_PREFIX=./install \ + .. - name: Build sherpa-onnx for macos shell: bash diff --git a/.github/workflows/npm-addon-linux-aarch64.yaml b/.github/workflows/npm-addon-linux-aarch64.yaml index d72e760c3..8067550fa 100644 --- a/.github/workflows/npm-addon-linux-aarch64.yaml +++ b/.github/workflows/npm-addon-linux-aarch64.yaml @@ -92,6 +92,7 @@ jobs: cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/npm-addon-linux-x64.yaml b/.github/workflows/npm-addon-linux-x64.yaml index b60853b04..b85e0fb64 100644 --- a/.github/workflows/npm-addon-linux-x64.yaml +++ b/.github/workflows/npm-addon-linux-x64.yaml @@ -60,6 +60,7 @@ jobs: cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/npm-addon-macos.yaml b/.github/workflows/npm-addon-macos.yaml index eb3ded547..7c8ce75cc 100644 --- a/.github/workflows/npm-addon-macos.yaml +++ b/.github/workflows/npm-addon-macos.yaml @@ -63,6 +63,7 @@ jobs: cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/npm-addon-win-x64.yaml b/.github/workflows/npm-addon-win-x64.yaml index 53c0cfd77..24b6d0316 100644 --- a/.github/workflows/npm-addon-win-x64.yaml +++ b/.github/workflows/npm-addon-win-x64.yaml @@ -51,6 +51,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/release-dart-package.yaml b/.github/workflows/release-dart-package.yaml index 8271954a6..e7581bf7e 100644 --- a/.github/workflows/release-dart-package.yaml +++ b/.github/workflows/release-dart-package.yaml @@ -84,6 +84,7 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=OFF \ -D SHERPA_ONNX_ENABLE_BINARY=OFF \ @@ -181,6 +182,7 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=OFF \ -D SHERPA_ONNX_ENABLE_BINARY=OFF \ @@ -274,6 +276,7 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=OFF \ -D SHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/riscv64-linux.yaml b/.github/workflows/riscv64-linux.yaml index acae80e41..e3e5e8b19 100644 --- a/.github/workflows/riscv64-linux.yaml +++ b/.github/workflows/riscv64-linux.yaml @@ -123,8 +123,16 @@ jobs: ls -lh build-riscv64-linux-gnu/bin ls -lh build-riscv64-linux-gnu/lib + echo "---install/lib---" + ls -lh build-riscv64-linux-gnu/install/lib + + echo "---install/bin---" + ls -lh build-riscv64-linux-gnu/install/bin + file build-riscv64-linux-gnu/bin/sherpa-onnx + readelf -d build-riscv64-linux-gnu/bin/sherpa-onnx + - name: Test sherpa-onnx shell: bash run: | diff --git a/.github/workflows/run-java-test.yaml b/.github/workflows/run-java-test.yaml index 14d22bd2e..ec9bd9ae8 100644 --- a/.github/workflows/run-java-test.yaml +++ b/.github/workflows/run-java-test.yaml @@ -98,6 +98,7 @@ jobs: -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ -DBUILD_ESPEAK_NG_EXE=OFF \ diff --git a/.github/workflows/test-dart.yaml b/.github/workflows/test-dart.yaml index 1803af9c4..5beb00758 100644 --- a/.github/workflows/test-dart.yaml +++ b/.github/workflows/test-dart.yaml @@ -70,7 +70,8 @@ jobs: cd build cmake \ - -D BUILD_SHARED_LIBS=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DBUILD_ESPEAK_NG_EXE=OFF \ diff --git a/.github/workflows/test-dot-net.yaml b/.github/workflows/test-dot-net.yaml index ffab91f1b..39aea4324 100644 --- a/.github/workflows/test-dot-net.yaml +++ b/.github/workflows/test-dot-net.yaml @@ -63,6 +63,7 @@ jobs: cd build cmake \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 6f25a0139..78dd35c6f 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -70,7 +70,15 @@ jobs: export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" mkdir build cd build - cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_SHARED_LIBS=ON -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF .. + cmake \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ + -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ + .. + make -j1 cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ diff --git a/.github/workflows/test-nodejs-addon-api.yaml b/.github/workflows/test-nodejs-addon-api.yaml index 224fc0f0b..4827ba6c6 100644 --- a/.github/workflows/test-nodejs-addon-api.yaml +++ b/.github/workflows/test-nodejs-addon-api.yaml @@ -96,6 +96,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ @@ -129,6 +130,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/windows-arm64.yaml b/.github/workflows/windows-arm64.yaml index 9b56c7b22..91334ce85 100644 --- a/.github/workflows/windows-arm64.yaml +++ b/.github/workflows/windows-arm64.yaml @@ -47,7 +47,15 @@ jobs: run: | mkdir build cd build - cmake -A ARM64 -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_ESPEAK_NG_EXE=OFF .. + cmake \ + -A ARM64 \ + -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ + -D CMAKE_INSTALL_PREFIX=./install \ + -D BUILD_ESPEAK_NG_EXE=OFF \ + .. - name: Build sherpa-onnx for windows shell: bash diff --git a/.github/workflows/windows-x64-cuda.yaml b/.github/workflows/windows-x64-cuda.yaml index 557d1d34e..55084ec9f 100644 --- a/.github/workflows/windows-x64-cuda.yaml +++ b/.github/workflows/windows-x64-cuda.yaml @@ -57,7 +57,14 @@ jobs: run: | mkdir build cd build - cmake -A x64 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./install -DSHERPA_ONNX_ENABLE_GPU=ON .. + cmake \ + -A x64 \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ + -D CMAKE_INSTALL_PREFIX=./install \ + -D SHERPA_ONNX_ENABLE_GPU=ON \ + .. - name: Build sherpa-onnx for windows shell: bash diff --git a/.github/workflows/windows-x64-debug.yaml b/.github/workflows/windows-x64-debug.yaml index 501763248..fddd63230 100644 --- a/.github/workflows/windows-x64-debug.yaml +++ b/.github/workflows/windows-x64-debug.yaml @@ -59,7 +59,13 @@ jobs: run: | mkdir build cd build - cmake -A x64 -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. + cmake \ + -A x64 \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ + -D CMAKE_INSTALL_PREFIX=./install \ + .. - name: Build sherpa-onnx for windows shell: bash diff --git a/.github/workflows/windows-x64-jni.yaml b/.github/workflows/windows-x64-jni.yaml index 64164332d..5e77781a0 100644 --- a/.github/workflows/windows-x64-jni.yaml +++ b/.github/workflows/windows-x64-jni.yaml @@ -37,7 +37,14 @@ jobs: run: | mkdir build cd build - cmake -A x64 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -DSHERPA_ONNX_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX=./install .. + cmake \ + -A x64 \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=ON \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ + -D SHERPA_ONNX_ENABLE_JNI=ON \ + -D CMAKE_INSTALL_PREFIX=./install \ + .. - name: Build sherpa-onnx for windows shell: bash diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index 8cfc1af1f..4f17a5a04 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -63,7 +63,14 @@ jobs: run: | mkdir build cd build - cmake -A x64 -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. + cmake \ + -A x64 \ + -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ + -DCMAKE_INSTALL_PREFIX=./install \ + .. - name: Build sherpa-onnx for windows shell: bash diff --git a/.github/workflows/windows-x86-debug.yaml b/.github/workflows/windows-x86-debug.yaml index 03dce165a..390109e18 100644 --- a/.github/workflows/windows-x86-debug.yaml +++ b/.github/workflows/windows-x86-debug.yaml @@ -59,7 +59,12 @@ jobs: run: | mkdir build cd build - cmake -A Win32 -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -D CMAKE_INSTALL_PREFIX=./install .. + cmake \ + -A Win32 \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ + -D CMAKE_INSTALL_PREFIX=./install .. - name: Build sherpa-onnx for windows shell: bash diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index a445f7518..b24000239 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -63,7 +63,14 @@ jobs: run: | mkdir build cd build - cmake -A Win32 -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -D CMAKE_INSTALL_PREFIX=./install .. + cmake \ + -A Win32 \ + -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ + -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ + -D CMAKE_INSTALL_PREFIX=./install \ + .. - name: Build sherpa-onnx for windows shell: bash diff --git a/java-api-examples/run-add-punctuation-zh-en.sh b/java-api-examples/run-add-punctuation-zh-en.sh index 5d707ea87..067e4231c 100755 --- a/java-api-examples/run-add-punctuation-zh-en.sh +++ b/java-api-examples/run-add-punctuation-zh-en.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-audio-tagging-ced-from-file.sh b/java-api-examples/run-audio-tagging-ced-from-file.sh index 35098901c..7ecf1f2a6 100755 --- a/java-api-examples/run-audio-tagging-ced-from-file.sh +++ b/java-api-examples/run-audio-tagging-ced-from-file.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-audio-tagging-zipformer-from-file.sh b/java-api-examples/run-audio-tagging-zipformer-from-file.sh index 36d07dbab..3add61169 100755 --- a/java-api-examples/run-audio-tagging-zipformer-from-file.sh +++ b/java-api-examples/run-audio-tagging-zipformer-from-file.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-inverse-text-normalization-paraformer.sh b/java-api-examples/run-inverse-text-normalization-paraformer.sh index 606dba6f7..79cce4b33 100755 --- a/java-api-examples/run-inverse-text-normalization-paraformer.sh +++ b/java-api-examples/run-inverse-text-normalization-paraformer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-inverse-text-normalization-transducer.sh b/java-api-examples/run-inverse-text-normalization-transducer.sh index 509d71f07..202b878a7 100755 --- a/java-api-examples/run-inverse-text-normalization-transducer.sh +++ b/java-api-examples/run-inverse-text-normalization-transducer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-kws-from-file.sh b/java-api-examples/run-kws-from-file.sh index 0a60dcb0d..a849419ca 100755 --- a/java-api-examples/run-kws-from-file.sh +++ b/java-api-examples/run-kws-from-file.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-nemo.sh b/java-api-examples/run-non-streaming-decode-file-nemo.sh index 057852a07..0b1595fad 100755 --- a/java-api-examples/run-non-streaming-decode-file-nemo.sh +++ b/java-api-examples/run-non-streaming-decode-file-nemo.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-paraformer.sh b/java-api-examples/run-non-streaming-decode-file-paraformer.sh index 28592e54b..3f3e43b5a 100755 --- a/java-api-examples/run-non-streaming-decode-file-paraformer.sh +++ b/java-api-examples/run-non-streaming-decode-file-paraformer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh b/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh index 075f1e2e3..04de2a22c 100755 --- a/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh +++ b/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-transducer.sh b/java-api-examples/run-non-streaming-decode-file-transducer.sh index b244d30b7..e2c2bdd31 100755 --- a/java-api-examples/run-non-streaming-decode-file-transducer.sh +++ b/java-api-examples/run-non-streaming-decode-file-transducer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-whisper.sh b/java-api-examples/run-non-streaming-decode-file-whisper.sh index 317e90ae1..367a8e8e9 100755 --- a/java-api-examples/run-non-streaming-decode-file-whisper.sh +++ b/java-api-examples/run-non-streaming-decode-file-whisper.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-tts-coqui-de.sh b/java-api-examples/run-non-streaming-tts-coqui-de.sh index 308d3e931..b0af20882 100755 --- a/java-api-examples/run-non-streaming-tts-coqui-de.sh +++ b/java-api-examples/run-non-streaming-tts-coqui-de.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-tts-piper-en.sh b/java-api-examples/run-non-streaming-tts-piper-en.sh index 61465faa7..0a3f15065 100755 --- a/java-api-examples/run-non-streaming-tts-piper-en.sh +++ b/java-api-examples/run-non-streaming-tts-piper-en.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-tts-vits-zh.sh b/java-api-examples/run-non-streaming-tts-vits-zh.sh index 5be38680b..3801383ce 100755 --- a/java-api-examples/run-non-streaming-tts-vits-zh.sh +++ b/java-api-examples/run-non-streaming-tts-vits-zh.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-speaker-identification.sh b/java-api-examples/run-speaker-identification.sh index 0bfd46e20..bc7253b2e 100755 --- a/java-api-examples/run-speaker-identification.sh +++ b/java-api-examples/run-speaker-identification.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-spoken-language-identification-whisper.sh b/java-api-examples/run-spoken-language-identification-whisper.sh index bf2b3cb20..625bc69ca 100755 --- a/java-api-examples/run-spoken-language-identification-whisper.sh +++ b/java-api-examples/run-spoken-language-identification-whisper.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-asr-from-mic-transducer.sh b/java-api-examples/run-streaming-asr-from-mic-transducer.sh index 900ef4f1d..dc32b58f5 100755 --- a/java-api-examples/run-streaming-asr-from-mic-transducer.sh +++ b/java-api-examples/run-streaming-asr-from-mic-transducer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-ctc-hlg.sh b/java-api-examples/run-streaming-decode-file-ctc-hlg.sh index 5400f11b7..19fc593a1 100755 --- a/java-api-examples/run-streaming-decode-file-ctc-hlg.sh +++ b/java-api-examples/run-streaming-decode-file-ctc-hlg.sh @@ -9,6 +9,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-ctc.sh b/java-api-examples/run-streaming-decode-file-ctc.sh index d029e1662..7c38fce82 100755 --- a/java-api-examples/run-streaming-decode-file-ctc.sh +++ b/java-api-examples/run-streaming-decode-file-ctc.sh @@ -9,6 +9,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-paraformer.sh b/java-api-examples/run-streaming-decode-file-paraformer.sh index 435f80503..8a1fe9057 100755 --- a/java-api-examples/run-streaming-decode-file-paraformer.sh +++ b/java-api-examples/run-streaming-decode-file-paraformer.sh @@ -9,6 +9,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-transducer.sh b/java-api-examples/run-streaming-decode-file-transducer.sh index 79a20ea1c..902c5a6a7 100755 --- a/java-api-examples/run-streaming-decode-file-transducer.sh +++ b/java-api-examples/run-streaming-decode-file-transducer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh b/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh index edb973794..a2fcbe455 100755 --- a/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh +++ b/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh b/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh index 63c661d1f..424becfd2 100755 --- a/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh +++ b/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-from-mic.sh b/java-api-examples/run-vad-from-mic.sh index 320e97cbd..3e66571a9 100755 --- a/java-api-examples/run-vad-from-mic.sh +++ b/java-api-examples/run-vad-from-mic.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-non-streaming-paraformer.sh b/java-api-examples/run-vad-non-streaming-paraformer.sh index b3a04f0b5..09a629eed 100755 --- a/java-api-examples/run-vad-non-streaming-paraformer.sh +++ b/java-api-examples/run-vad-non-streaming-paraformer.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-remove-slience.sh b/java-api-examples/run-vad-remove-slience.sh index 0fd08ca6f..c15e26f7b 100755 --- a/java-api-examples/run-vad-remove-slience.sh +++ b/java-api-examples/run-vad-remove-slience.sh @@ -10,6 +10,7 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/scripts/go/_internal/build_darwin_amd64.go b/scripts/go/_internal/build_darwin_amd64.go index 4e55c0111..3fbb0e72a 100644 --- a/scripts/go/_internal/build_darwin_amd64.go +++ b/scripts/go/_internal/build_darwin_amd64.go @@ -2,5 +2,5 @@ package sherpa_onnx -// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-apple-darwin -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-native-fbank-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -lssentencepiece_core -Wl,-rpath,${SRCDIR}/lib/x86_64-apple-darwin +// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-apple-darwin -lsherpa-onnx-c-api-lonnxruntime -Wl,-rpath,${SRCDIR}/lib/x86_64-apple-darwin import "C" diff --git a/scripts/go/_internal/build_darwin_arm64.go b/scripts/go/_internal/build_darwin_arm64.go index 46aa58326..1420d59d2 100644 --- a/scripts/go/_internal/build_darwin_arm64.go +++ b/scripts/go/_internal/build_darwin_arm64.go @@ -2,5 +2,5 @@ package sherpa_onnx -// #cgo LDFLAGS: -L ${SRCDIR}/lib/aarch64-apple-darwin -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-native-fbank-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -lssentencepiece_core -Wl,-rpath,${SRCDIR}/lib/aarch64-apple-darwin +// #cgo LDFLAGS: -L ${SRCDIR}/lib/aarch64-apple-darwin -lsherpa-onnx-c-api -lonnxruntime -lssentencepiece_core -Wl,-rpath,${SRCDIR}/lib/aarch64-apple-darwin import "C" From e08595d762855b9863960c2ba49c8a194c3b7908 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 16:10:19 +0800 Subject: [PATCH 08/54] Fix dart package --- flutter/sherpa_onnx_linux/linux/CMakeLists.txt | 10 ---------- flutter/sherpa_onnx_windows/windows/CMakeLists.txt | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/flutter/sherpa_onnx_linux/linux/CMakeLists.txt b/flutter/sherpa_onnx_linux/linux/CMakeLists.txt index 5b3cc73b7..2fb8814bd 100644 --- a/flutter/sherpa_onnx_linux/linux/CMakeLists.txt +++ b/flutter/sherpa_onnx_linux/linux/CMakeLists.txt @@ -12,16 +12,6 @@ project(${PROJECT_NAME} LANGUAGES CXX) # external build triggered from this build file. set(sherpa_onnx_linux_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/libsherpa-onnx-c-api.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libsherpa-onnx-core.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libkaldi-decoder-core.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libsherpa-onnx-kaldifst-core.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libsherpa-onnx-fstfar.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libsherpa-onnx-fst.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libkaldi-native-fbank-core.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libpiper_phonemize.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libespeak-ng.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libucd.so" "${CMAKE_CURRENT_SOURCE_DIR}/libonnxruntime.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libssentencepiece_core.so" PARENT_SCOPE ) diff --git a/flutter/sherpa_onnx_windows/windows/CMakeLists.txt b/flutter/sherpa_onnx_windows/windows/CMakeLists.txt index 811931ed1..ecb0ae705 100644 --- a/flutter/sherpa_onnx_windows/windows/CMakeLists.txt +++ b/flutter/sherpa_onnx_windows/windows/CMakeLists.txt @@ -13,16 +13,6 @@ project(${PROJECT_NAME} LANGUAGES CXX) # external build triggered from this build file. set(sherpa_onnx_windows_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/sherpa-onnx-c-api.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/sherpa-onnx-core.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/kaldi-decoder-core.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/sherpa-onnx-kaldifst-core.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/sherpa-onnx-fstfar.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/sherpa-onnx-fst.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/kaldi-native-fbank-core.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/piper_phonemize.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/espeak-ng.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/ucd.dll" "${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/ssentencepiece_core.dll" PARENT_SCOPE ) From 838116b7e6f1bc5b98259534b97b423c281e95f0 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 16:27:00 +0800 Subject: [PATCH 09/54] fix portaudio --- build-aarch64-linux-gnu.sh | 5 +++++ build-arm-linux-gnueabihf.sh | 5 +++++ build-riscv64-linux-gnu.sh | 5 +++++ cmake/portaudio.cmake | 13 ++++++++----- kotlin-api-examples/run.sh | 2 ++ scripts/node-addon-api/run.sh | 7 ++++++- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/build-aarch64-linux-gnu.sh b/build-aarch64-linux-gnu.sh index a957d888a..dd9df3648 100755 --- a/build-aarch64-linux-gnu.sh +++ b/build-aarch64-linux-gnu.sh @@ -44,6 +44,10 @@ if [[ x"$BUILD_SHARED_LIBS" == x"" ]]; then BUILD_SHARED_LIBS=OFF fi +if [[ -n $BUILD_SHARED_LIBS && -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS +fi + cmake \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ @@ -52,6 +56,7 @@ cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ diff --git a/build-arm-linux-gnueabihf.sh b/build-arm-linux-gnueabihf.sh index 0c70f483c..0f91bdd29 100755 --- a/build-arm-linux-gnueabihf.sh +++ b/build-arm-linux-gnueabihf.sh @@ -39,6 +39,10 @@ if [[ x"$BUILD_SHARED_LIBS" == x"" ]]; then BUILD_SHARED_LIBS=OFF fi +if [[ -n $BUILD_SHARED_LIBS && -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS +fi + cmake \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ @@ -47,6 +51,7 @@ cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ diff --git a/build-riscv64-linux-gnu.sh b/build-riscv64-linux-gnu.sh index 0e7efdab5..7dde0f400 100755 --- a/build-riscv64-linux-gnu.sh +++ b/build-riscv64-linux-gnu.sh @@ -47,6 +47,10 @@ if [[ x"$BUILD_SHARED_LIBS" == x"" ]]; then BUILD_SHARED_LIBS=ON fi +if [[ -n $BUILD_SHARED_LIBS && -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]]; then + SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS +fi + cmake \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ @@ -55,6 +59,7 @@ cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ diff --git a/cmake/portaudio.cmake b/cmake/portaudio.cmake index 8ef9b0a1d..0ad2f47cf 100644 --- a/cmake/portaudio.cmake +++ b/cmake/portaudio.cmake @@ -26,7 +26,7 @@ function(download_portaudio) endif() endforeach() - if(MSVC AND SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) set(BUILD_SHARED_LIBS OFF) endif() @@ -75,10 +75,13 @@ function(download_portaudio) if(NOT WIN32) target_compile_options(portaudio_static PRIVATE "-Wno-deprecated-declarations") endif() - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS portaudio_static DESTINATION ..) - else() - install(TARGETS portaudio_static DESTINATION lib) + + if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) + if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) + install(TARGETS portaudio_static DESTINATION ..) + else() + install(TARGETS portaudio_static DESTINATION lib) + endif() endif() endif() endfunction() diff --git a/kotlin-api-examples/run.sh b/kotlin-api-examples/run.sh index 5b58620e1..c11f793b7 100755 --- a/kotlin-api-examples/run.sh +++ b/kotlin-api-examples/run.sh @@ -14,6 +14,8 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ + -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/scripts/node-addon-api/run.sh b/scripts/node-addon-api/run.sh index ef4e80c0d..7b85f8f9a 100755 --- a/scripts/node-addon-api/run.sh +++ b/scripts/node-addon-api/run.sh @@ -6,7 +6,12 @@ if [[ ! -f ../../build/install/lib/libsherpa-onnx-core.dylib && ! -f ../../build pushd ../../ mkdir -p build cd build - cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON .. + + cmake \ + -DCMAKE_INSTALL_PREFIX=./install \ + -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ + .. make install popd fi From 2e248057886169197b4399a6b5e086d1bc728624 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 16:43:50 +0800 Subject: [PATCH 10/54] update espeak-ng --- cmake/espeak-ng-for-piper.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/espeak-ng-for-piper.cmake b/cmake/espeak-ng-for-piper.cmake index f85342f67..7460ebed8 100644 --- a/cmake/espeak-ng-for-piper.cmake +++ b/cmake/espeak-ng-for-piper.cmake @@ -1,9 +1,9 @@ function(download_espeak_ng_for_piper) include(FetchContent) - set(espeak_ng_URL "https://github.com/csukuangfj/espeak-ng/archive/69bf6927964fb042aeb827cfdf6082a30f5802eb.zip") - set(espeak_ng_URL2 "https://hub.nuaa.cf/csukuangfj/espeak-ng/archive/69bf6927964fb042aeb827cfdf6082a30f5802eb.zip") - set(espeak_ng_HASH "SHA256=745e35b21ece6804b4a1839722f9e625ac909380c8f85873ad71bf145877075a") + set(espeak_ng_URL "https://github.com/csukuangfj/espeak-ng/archive/f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip") + set(espeak_ng_URL2 "https://hub.nuaa.cf/csukuangfj/espeak-ng/archive/f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip") + set(espeak_ng_HASH "SHA256=70cbf4050e7a014aae19140b05e57249da4720f56128459fbe3a93beaf971ae6") set(BUILD_ESPEAK_NG_TESTS OFF CACHE BOOL "" FORCE) set(USE_ASYNC OFF CACHE BOOL "" FORCE) @@ -21,11 +21,11 @@ function(download_espeak_ng_for_piper) # If you don't have access to the Internet, # please pre-download kaldi-decoder set(possible_file_locations - $ENV{HOME}/Downloads/espeak-ng-69bf6927964fb042aeb827cfdf6082a30f5802eb.zip - ${CMAKE_SOURCE_DIR}/espeak-ng-69bf6927964fb042aeb827cfdf6082a30f5802eb.zip - ${CMAKE_BINARY_DIR}/espeak-ng-69bf6927964fb042aeb827cfdf6082a30f5802eb.zip - /tmp/espeak-ng-69bf6927964fb042aeb827cfdf6082a30f5802eb.zip - /star-fj/fangjun/download/github/espeak-ng-69bf6927964fb042aeb827cfdf6082a30f5802eb.zip + $ENV{HOME}/Downloads/espeak-ng-f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip + ${CMAKE_SOURCE_DIR}/espeak-ng-f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip + ${CMAKE_BINARY_DIR}/espeak-ng-f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip + /tmp/espeak-ng-f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip + /star-fj/fangjun/download/github/espeak-ng-f6fed6c58b5e0998b8e68c6610125e2d07d595a7.zip ) foreach(f IN LISTS possible_file_locations) From 54b7c6a68b02de0b07c324b899f562c1bb550659 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 16:46:56 +0800 Subject: [PATCH 11/54] remove static libs --- .github/workflows/test-go.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 78dd35c6f..3fad1dcf6 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -81,6 +81,7 @@ jobs: make -j1 cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ + rm ./lib/*.a cd ../scripts/go/_internal/ ls -lh lib From f3e86fa608711f80f627d4f15144fbffa6734316 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 17:00:09 +0800 Subject: [PATCH 12/54] fix building node-addon --- scripts/node-addon-api/CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/node-addon-api/CMakeLists.txt b/scripts/node-addon-api/CMakeLists.txt index a49f9b98d..f21573698 100644 --- a/scripts/node-addon-api/CMakeLists.txt +++ b/scripts/node-addon-api/CMakeLists.txt @@ -67,15 +67,6 @@ target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB}) target_link_libraries(${PROJECT_NAME} sherpa-onnx-c-api - sherpa-onnx-core - kaldi-decoder-core - sherpa-onnx-kaldifst-core - sherpa-onnx-fstfar - sherpa-onnx-fst - kaldi-native-fbank-core - piper_phonemize - espeak-ng - ucd onnxruntime -Wl,-rpath,$ENV{SHERPA_ONNX_INSTALL_DIR}/lib ) From 421517dee00645e7716a6b0f99cafc0d2004604b Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 17:46:12 +0800 Subject: [PATCH 13/54] fix go tests --- scripts/go/_internal/build_darwin_amd64.go | 2 +- scripts/go/_internal/build_darwin_arm64.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/go/_internal/build_darwin_amd64.go b/scripts/go/_internal/build_darwin_amd64.go index 3fbb0e72a..eda1649e3 100644 --- a/scripts/go/_internal/build_darwin_amd64.go +++ b/scripts/go/_internal/build_darwin_amd64.go @@ -2,5 +2,5 @@ package sherpa_onnx -// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-apple-darwin -lsherpa-onnx-c-api-lonnxruntime -Wl,-rpath,${SRCDIR}/lib/x86_64-apple-darwin +// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-apple-darwin -lsherpa-onnx-c-api -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/x86_64-apple-darwin import "C" diff --git a/scripts/go/_internal/build_darwin_arm64.go b/scripts/go/_internal/build_darwin_arm64.go index 1420d59d2..2ca255c8d 100644 --- a/scripts/go/_internal/build_darwin_arm64.go +++ b/scripts/go/_internal/build_darwin_arm64.go @@ -2,5 +2,5 @@ package sherpa_onnx -// #cgo LDFLAGS: -L ${SRCDIR}/lib/aarch64-apple-darwin -lsherpa-onnx-c-api -lonnxruntime -lssentencepiece_core -Wl,-rpath,${SRCDIR}/lib/aarch64-apple-darwin +// #cgo LDFLAGS: -L ${SRCDIR}/lib/aarch64-apple-darwin -lsherpa-onnx-c-api -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/aarch64-apple-darwin import "C" From 0297a20ed9d48f5e3d5528d3dbb38a4f95adf3cb Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 18:38:58 +0800 Subject: [PATCH 14/54] fix node-addon --- scripts/node-addon-api/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/node-addon-api/run.sh b/scripts/node-addon-api/run.sh index 7b85f8f9a..4089f1b72 100755 --- a/scripts/node-addon-api/run.sh +++ b/scripts/node-addon-api/run.sh @@ -2,7 +2,7 @@ set -ex -if [[ ! -f ../../build/install/lib/libsherpa-onnx-core.dylib && ! -f ../../build/install/lib/libsherpa-onnx-core.so ]]; then +if [[ ! -f ../../build/install/lib/libsherpa-onnx-c-api.dylib && ! -f ../../build/install/lib/libsherpa-c-api.so ]]; then pushd ../../ mkdir -p build cd build From 3399085fb998acc7963da3d330312626e58da14f Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 19:16:23 +0800 Subject: [PATCH 15/54] fix dart --- .github/workflows/jni.yaml | 2 +- .github/workflows/release-dart-package.yaml | 5 ++--- .github/workflows/swift.yaml | 2 +- .github/workflows/test-dart.yaml | 2 +- flutter/sherpa_onnx_linux/linux/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jni.yaml b/.github/workflows/jni.yaml index fdee728fd..a0f769393 100644 --- a/.github/workflows/jni.yaml +++ b/.github/workflows/jni.yaml @@ -37,7 +37,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, macos-14] + os: [ubuntu-latest, macos-latest, macos-13] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-dart-package.yaml b/.github/workflows/release-dart-package.yaml index e7581bf7e..0cd41255e 100644 --- a/.github/workflows/release-dart-package.yaml +++ b/.github/workflows/release-dart-package.yaml @@ -101,8 +101,8 @@ jobs: 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 + # rm libonnxruntime.so + # ln -s libonnxruntime.so.* ./libonnxruntime.so popd @@ -207,7 +207,6 @@ jobs: 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 diff --git a/.github/workflows/swift.yaml b/.github/workflows/swift.yaml index 6b4ef10df..3176c9b31 100644 --- a/.github/workflows/swift.yaml +++ b/.github/workflows/swift.yaml @@ -39,7 +39,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, macos-14] + os: [macos-latest, macos-13] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-dart.yaml b/.github/workflows/test-dart.yaml index 5beb00758..9fb8c857d 100644 --- a/.github/workflows/test-dart.yaml +++ b/.github/workflows/test-dart.yaml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] #, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 diff --git a/flutter/sherpa_onnx_linux/linux/CMakeLists.txt b/flutter/sherpa_onnx_linux/linux/CMakeLists.txt index 2fb8814bd..946ed597e 100644 --- a/flutter/sherpa_onnx_linux/linux/CMakeLists.txt +++ b/flutter/sherpa_onnx_linux/linux/CMakeLists.txt @@ -12,6 +12,6 @@ project(${PROJECT_NAME} LANGUAGES CXX) # external build triggered from this build file. set(sherpa_onnx_linux_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/libsherpa-onnx-c-api.so" - "${CMAKE_CURRENT_SOURCE_DIR}/libonnxruntime.so" + "${CMAKE_CURRENT_SOURCE_DIR}/libonnxruntime.so.1.17.1" PARENT_SCOPE ) From d0b5be216a5820fad4f5310a4602ece2de0be73e Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 20:07:37 +0800 Subject: [PATCH 16/54] use a single job to build windows wheel --- .github/workflows/flutter-linux.yaml | 3 ++- cmake/cmake_extension.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flutter-linux.yaml b/.github/workflows/flutter-linux.yaml index ca665fd8b..240ab0a6f 100644 --- a/.github/workflows/flutter-linux.yaml +++ b/.github/workflows/flutter-linux.yaml @@ -32,6 +32,7 @@ concurrency: jobs: flutter_linux: + if: false name: linux runs-on: ${{ matrix.os }} container: ubuntu:18.04 @@ -49,7 +50,7 @@ jobs: shell: bash run: | apt-get update -y - apt-get install -y build-essential jq git cmake + apt-get install -y build-essential jq git cmake apt-get install -y curl - name: Setup Flutter SDK diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index 56202e162..ab3e3de0c 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -77,6 +77,7 @@ def get_binaries(): if is_windows(): binaries += [ "onnxruntime.dll", + "sherpa-onnx-c-api.dll", ] return binaries @@ -151,7 +152,7 @@ def build_extension(self, ext: setuptools.extension.Extension): if is_windows(): build_cmd = f""" cmake {cmake_args} -B {self.build_temp} -S {sherpa_onnx_dir} - cmake --build {self.build_temp} --target install --config Release -- -m + cmake --build {self.build_temp} --target install --config Release """ print(f"build command is:\n{build_cmd}") ret = os.system( @@ -161,7 +162,7 @@ def build_extension(self, ext: setuptools.extension.Extension): raise Exception("Failed to configure sherpa") ret = os.system( - f"cmake --build {self.build_temp} --target install --config Release -- -m" # noqa + f"cmake --build {self.build_temp} --target install --config Release" # noqa ) if ret != 0: raise Exception("Failed to build and install sherpa") From 2800ebc0012b4b77598c27725b2e1a754c94ac01 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 20:26:46 +0800 Subject: [PATCH 17/54] fix pkg-config --- .github/workflows/windows-x86.yaml | 4 ++-- CMakeLists.txt | 10 +++++++--- cmake/sherpa-onnx-single.pc.in | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 cmake/sherpa-onnx-single.pc.in diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index b24000239..dfba47644 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -76,8 +76,8 @@ jobs: shell: bash run: | cd build - cmake --build . --config Release -- -m:2 - cmake --build . --config Release --target install -- -m:2 + cmake --build . --config Release + cmake --build . --config Release --target install ls -lh ./bin/Release/sherpa-onnx.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f4db20b8..f65b04276 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -350,11 +350,15 @@ if(NOT BUILD_SHARED_LIBS) endif() endif() +if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) # See https://people.freedesktop.org/~dbn/pkg-config-guide.html -if(SHERPA_ONNX_ENABLE_TTS) - configure_file(cmake/sherpa-onnx.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + if(SHERPA_ONNX_ENABLE_TTS) + configure_file(cmake/sherpa-onnx.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + else() + configure_file(cmake/sherpa-onnx-no-tts.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + endif() else() - configure_file(cmake/sherpa-onnx-no-tts.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + configure_file(cmake/sherpa-onnx-single.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) endif() install( diff --git a/cmake/sherpa-onnx-single.pc.in b/cmake/sherpa-onnx-single.pc.in new file mode 100644 index 000000000..26ba8797f --- /dev/null +++ b/cmake/sherpa-onnx-single.pc.in @@ -0,0 +1,16 @@ +prefix="@CMAKE_INSTALL_PREFIX@" +exec_prefix="${prefix}" +includedir="${prefix}/include" +libdir="${exec_prefix}/lib" + +Name: sherpa-onnx +Description: pkg-config for sherpa-onnx +URL: https://github.com/k2-fsa/sherpa-onnx + +Version: @SHERPA_ONNX_VERSION@ +Cflags: -I"${includedir}" + +# 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 +# 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 -lonnxruntime -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ From 99d82f3cd34c3febaf8236a245b5d680eb2b7a14 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 20:29:01 +0800 Subject: [PATCH 18/54] Fix rpath on Windows --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f65b04276..2f989aa53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,8 +72,10 @@ else() set(SHERPA_ONNX_RPATH_ORIGIN "@loader_path") endif() -set(CMAKE_INSTALL_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) -set(CMAKE_BUILD_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) +if(NOT WIN32) + set(CMAKE_INSTALL_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) + set(CMAKE_BUILD_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) +endif() if(NOT CMAKE_BUILD_TYPE) message(STATUS "No CMAKE_BUILD_TYPE given, default to Release") From c171f88fc342b4274cf372469e60cd98dc2dda9f Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:05:06 +0800 Subject: [PATCH 19/54] always build a single shared lib when BUILD_SHARED_LIBS in ON --- .github/workflows/dot-net.yaml | 1 - .github/workflows/linux-gpu.yaml | 1 - .github/workflows/linux-jni.yaml | 1 - .github/workflows/linux.yaml | 1 - .github/workflows/macos-jni.yaml | 1 - .github/workflows/macos.yaml | 1 - .../workflows/npm-addon-linux-aarch64.yaml | 1 - .github/workflows/npm-addon-linux-x64.yaml | 1 - .github/workflows/npm-addon-macos.yaml | 1 - .github/workflows/npm-addon-win-x64.yaml | 1 - .github/workflows/release-dart-package.yaml | 3 - .github/workflows/run-java-test.yaml | 1 - .github/workflows/test-dart.yaml | 1 - .github/workflows/test-dot-net.yaml | 1 - .github/workflows/test-go.yaml | 1 - .github/workflows/test-nodejs-addon-api.yaml | 2 - .github/workflows/windows-arm64.yaml | 1 - .github/workflows/windows-x64-cuda.yaml | 1 - .github/workflows/windows-x64-debug.yaml | 1 - .github/workflows/windows-x64-jni.yaml | 1 - .github/workflows/windows-x64.yaml | 1 - .github/workflows/windows-x86-debug.yaml | 1 - .github/workflows/windows-x86.yaml | 1 - CMakeLists.txt | 31 ++-------- build-aarch64-linux-gnu.sh | 5 -- build-android-arm64-v8a.sh | 5 -- build-android-armv7-eabi.sh | 5 -- build-android-x86-64.sh | 5 -- build-android-x86.sh | 5 -- build-arm-linux-gnueabihf.sh | 5 -- build-riscv64-linux-gnu.sh | 5 -- cmake/cmake_extension.py | 1 - cmake/espeak-ng-for-piper.cmake | 32 +++-------- cmake/kaldi-decoder.cmake | 36 +++--------- cmake/kaldi-native-fbank.cmake | 16 ++---- cmake/kaldifst.cmake | 4 +- cmake/openfst.cmake | 4 +- cmake/piper-phonemize.cmake | 24 ++------ cmake/portaudio.cmake | 41 ++------------ ...-single.pc.in => sherpa-onnx-shared.pc.in} | 0 ....pc.in => sherpa-onnx-static-no-tts.pc.in} | 0 ...pa-onnx.pc.in => sherpa-onnx-static.pc.in} | 0 cmake/simple-sentencepiece.cmake | 16 ++---- .../run-add-punctuation-zh-en.sh | 1 - .../run-audio-tagging-ced-from-file.sh | 1 - .../run-audio-tagging-zipformer-from-file.sh | 1 - ...n-inverse-text-normalization-paraformer.sh | 1 - ...n-inverse-text-normalization-transducer.sh | 1 - java-api-examples/run-kws-from-file.sh | 1 - .../run-non-streaming-decode-file-nemo.sh | 1 - ...un-non-streaming-decode-file-paraformer.sh | 1 - ...n-streaming-decode-file-tele-speech-ctc.sh | 1 - ...un-non-streaming-decode-file-transducer.sh | 1 - .../run-non-streaming-decode-file-whisper.sh | 1 - .../run-non-streaming-tts-coqui-de.sh | 1 - .../run-non-streaming-tts-piper-en.sh | 1 - .../run-non-streaming-tts-vits-zh.sh | 1 - .../run-speaker-identification.sh | 1 - ...-spoken-language-identification-whisper.sh | 1 - .../run-streaming-asr-from-mic-transducer.sh | 1 - .../run-streaming-decode-file-ctc-hlg.sh | 1 - .../run-streaming-decode-file-ctc.sh | 1 - .../run-streaming-decode-file-paraformer.sh | 1 - .../run-streaming-decode-file-transducer.sh | 1 - ...n-vad-from-mic-non-streaming-paraformer.sh | 1 - .../run-vad-from-mic-non-streaming-whisper.sh | 1 - java-api-examples/run-vad-from-mic.sh | 1 - .../run-vad-non-streaming-paraformer.sh | 1 - java-api-examples/run-vad-remove-slience.sh | 1 - kotlin-api-examples/run.sh | 1 - scripts/node-addon-api/run.sh | 2 +- sherpa-onnx/csrc/CMakeLists.txt | 56 ++++--------------- 72 files changed, 58 insertions(+), 293 deletions(-) rename cmake/{sherpa-onnx-single.pc.in => sherpa-onnx-shared.pc.in} (100%) rename cmake/{sherpa-onnx-no-tts.pc.in => sherpa-onnx-static-no-tts.pc.in} (100%) rename cmake/{sherpa-onnx.pc.in => sherpa-onnx-static.pc.in} (100%) diff --git a/.github/workflows/dot-net.yaml b/.github/workflows/dot-net.yaml index a5aedbeaf..917e85b95 100644 --- a/.github/workflows/dot-net.yaml +++ b/.github/workflows/dot-net.yaml @@ -41,7 +41,6 @@ jobs: cmake \ $opts \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ diff --git a/.github/workflows/linux-gpu.yaml b/.github/workflows/linux-gpu.yaml index ad5b95a47..2a9d0529d 100644 --- a/.github/workflows/linux-gpu.yaml +++ b/.github/workflows/linux-gpu.yaml @@ -76,7 +76,6 @@ jobs: -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D CMAKE_INSTALL_PREFIX=./install \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D SHERPA_ONNX_ENABLE_GPU=ON \ .. diff --git a/.github/workflows/linux-jni.yaml b/.github/workflows/linux-jni.yaml index 0d9b44f17..f50974a67 100644 --- a/.github/workflows/linux-jni.yaml +++ b/.github/workflows/linux-jni.yaml @@ -99,7 +99,6 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 1fdc8e6f4..3d5077312 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -103,7 +103,6 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ -D CMAKE_INSTALL_PREFIX=./install \ .. diff --git a/.github/workflows/macos-jni.yaml b/.github/workflows/macos-jni.yaml index 2514466c5..91c4d0d69 100644 --- a/.github/workflows/macos-jni.yaml +++ b/.github/workflows/macos-jni.yaml @@ -54,7 +54,6 @@ jobs: -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_OSX_ARCHITECTURES=$arch \ -D SHERPA_ONNX_ENABLE_JNI=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DCMAKE_INSTALL_PREFIX=./install \ .. diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 221e9f5b1..29b784ae5 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -87,7 +87,6 @@ jobs: cmake \ -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ -D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS \ -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D CMAKE_OSX_ARCHITECTURES='arm64;x86_64' \ -D CMAKE_INSTALL_PREFIX=./install \ diff --git a/.github/workflows/npm-addon-linux-aarch64.yaml b/.github/workflows/npm-addon-linux-aarch64.yaml index 8067550fa..d72e760c3 100644 --- a/.github/workflows/npm-addon-linux-aarch64.yaml +++ b/.github/workflows/npm-addon-linux-aarch64.yaml @@ -92,7 +92,6 @@ jobs: cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/npm-addon-linux-x64.yaml b/.github/workflows/npm-addon-linux-x64.yaml index b85e0fb64..b60853b04 100644 --- a/.github/workflows/npm-addon-linux-x64.yaml +++ b/.github/workflows/npm-addon-linux-x64.yaml @@ -60,7 +60,6 @@ jobs: cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/npm-addon-macos.yaml b/.github/workflows/npm-addon-macos.yaml index 7c8ce75cc..eb3ded547 100644 --- a/.github/workflows/npm-addon-macos.yaml +++ b/.github/workflows/npm-addon-macos.yaml @@ -63,7 +63,6 @@ jobs: cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/npm-addon-win-x64.yaml b/.github/workflows/npm-addon-win-x64.yaml index 24b6d0316..53c0cfd77 100644 --- a/.github/workflows/npm-addon-win-x64.yaml +++ b/.github/workflows/npm-addon-win-x64.yaml @@ -51,7 +51,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/release-dart-package.yaml b/.github/workflows/release-dart-package.yaml index 0cd41255e..73554d206 100644 --- a/.github/workflows/release-dart-package.yaml +++ b/.github/workflows/release-dart-package.yaml @@ -84,7 +84,6 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=OFF \ -D SHERPA_ONNX_ENABLE_BINARY=OFF \ @@ -182,7 +181,6 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=OFF \ -D SHERPA_ONNX_ENABLE_BINARY=OFF \ @@ -275,7 +273,6 @@ jobs: -D SHERPA_ONNX_ENABLE_TTS=ON \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_JNI=OFF \ -D SHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/run-java-test.yaml b/.github/workflows/run-java-test.yaml index ec9bd9ae8..14d22bd2e 100644 --- a/.github/workflows/run-java-test.yaml +++ b/.github/workflows/run-java-test.yaml @@ -98,7 +98,6 @@ jobs: -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ -DBUILD_ESPEAK_NG_EXE=OFF \ diff --git a/.github/workflows/test-dart.yaml b/.github/workflows/test-dart.yaml index 9fb8c857d..c9b64198d 100644 --- a/.github/workflows/test-dart.yaml +++ b/.github/workflows/test-dart.yaml @@ -71,7 +71,6 @@ jobs: cmake \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DBUILD_ESPEAK_NG_EXE=OFF \ diff --git a/.github/workflows/test-dot-net.yaml b/.github/workflows/test-dot-net.yaml index 39aea4324..ffab91f1b 100644 --- a/.github/workflows/test-dot-net.yaml +++ b/.github/workflows/test-dot-net.yaml @@ -63,7 +63,6 @@ jobs: cd build cmake \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 3fad1dcf6..01927ab0e 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -74,7 +74,6 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ .. diff --git a/.github/workflows/test-nodejs-addon-api.yaml b/.github/workflows/test-nodejs-addon-api.yaml index 4827ba6c6..224fc0f0b 100644 --- a/.github/workflows/test-nodejs-addon-api.yaml +++ b/.github/workflows/test-nodejs-addon-api.yaml @@ -96,7 +96,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ @@ -130,7 +129,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ diff --git a/.github/workflows/windows-arm64.yaml b/.github/workflows/windows-arm64.yaml index 91334ce85..a6d2a96da 100644 --- a/.github/workflows/windows-arm64.yaml +++ b/.github/workflows/windows-arm64.yaml @@ -52,7 +52,6 @@ jobs: -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ -D CMAKE_INSTALL_PREFIX=./install \ -D BUILD_ESPEAK_NG_EXE=OFF \ .. diff --git a/.github/workflows/windows-x64-cuda.yaml b/.github/workflows/windows-x64-cuda.yaml index 55084ec9f..fd4570455 100644 --- a/.github/workflows/windows-x64-cuda.yaml +++ b/.github/workflows/windows-x64-cuda.yaml @@ -61,7 +61,6 @@ jobs: -A x64 \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D CMAKE_INSTALL_PREFIX=./install \ -D SHERPA_ONNX_ENABLE_GPU=ON \ .. diff --git a/.github/workflows/windows-x64-debug.yaml b/.github/workflows/windows-x64-debug.yaml index fddd63230..09f93fd0d 100644 --- a/.github/workflows/windows-x64-debug.yaml +++ b/.github/workflows/windows-x64-debug.yaml @@ -63,7 +63,6 @@ jobs: -A x64 \ -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ -D CMAKE_INSTALL_PREFIX=./install \ .. diff --git a/.github/workflows/windows-x64-jni.yaml b/.github/workflows/windows-x64-jni.yaml index 5e77781a0..28d35367c 100644 --- a/.github/workflows/windows-x64-jni.yaml +++ b/.github/workflows/windows-x64-jni.yaml @@ -41,7 +41,6 @@ jobs: -A x64 \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=ON \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -D SHERPA_ONNX_ENABLE_JNI=ON \ -D CMAKE_INSTALL_PREFIX=./install \ .. diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index 4f17a5a04..a80b0f69d 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -68,7 +68,6 @@ jobs: -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ -DCMAKE_INSTALL_PREFIX=./install \ .. diff --git a/.github/workflows/windows-x86-debug.yaml b/.github/workflows/windows-x86-debug.yaml index 390109e18..f72bf2566 100644 --- a/.github/workflows/windows-x86-debug.yaml +++ b/.github/workflows/windows-x86-debug.yaml @@ -63,7 +63,6 @@ jobs: -A Win32 \ -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ -D CMAKE_INSTALL_PREFIX=./install .. - name: Build sherpa-onnx for windows diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index dfba47644..cfec7a864 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -68,7 +68,6 @@ jobs: -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=${{ matrix.shared_lib }} \ -D CMAKE_INSTALL_PREFIX=./install \ .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f989aa53..54d760429 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,6 @@ option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. option(SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE "True to use pre-installed onnxruntime if available" ON) option(SHERPA_ONNX_ENABLE_SANITIZER "Whether to enable ubsan and asan" OFF) option(SHERPA_ONNX_BUILD_C_API_EXAMPLES "Whether to enable C API examples" ON) -option(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB "Whether to build a single shared lib." OFF) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") @@ -114,20 +113,6 @@ if(BUILD_SHARED_LIBS AND MSVC) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -if((NOT BUILD_SHARED_LIBS OR SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) AND MSVC) - # see https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html - # https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake - if(MSVC) - add_compile_options( - $<$:/MT> #---------| - $<$:/MTd> #---|-- Statically link the runtime libraries - $<$:/MT> #--| - $<$:/MT> - $<$:/MT> - ) - endif() -endif() - message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message(STATUS "BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}") @@ -150,12 +135,6 @@ message(STATUS "SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY ${SHERPA_ONNX_LINK_LIBSTDC message(STATUS "SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE ${SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE}") message(STATUS "SHERPA_ONNX_ENABLE_SANITIZER: ${SHERPA_ONNX_ENABLE_SANITIZER}") message(STATUS "SHERPA_ONNX_BUILD_C_API_EXAMPLES: ${SHERPA_ONNX_BUILD_C_API_EXAMPLES}") -message(STATUS "SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB: ${SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB}") - -if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND NOT BUILD_SHARED_LIBS) - message(STATUS "Set BUILD_SHARED_LIBS to ON since SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB is ON") - set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) -endif() if(SHERPA_ONNX_ENABLE_TTS) message(STATUS "TTS is enabled") @@ -352,21 +331,21 @@ if(NOT BUILD_SHARED_LIBS) endif() endif() -if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) +if(NOT BUILD_SHARED_LIBS) # See https://people.freedesktop.org/~dbn/pkg-config-guide.html if(SHERPA_ONNX_ENABLE_TTS) - configure_file(cmake/sherpa-onnx.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + configure_file(cmake/sherpa-onnx-static.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) else() - configure_file(cmake/sherpa-onnx-no-tts.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + configure_file(cmake/sherpa-onnx-static-no-tts.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) endif() else() - configure_file(cmake/sherpa-onnx-single.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) + configure_file(cmake/sherpa-onnx-shared.pc.in ${PROJECT_BINARY_DIR}/sherpa-onnx.pc @ONLY) endif() install( FILES ${PROJECT_BINARY_DIR}/sherpa-onnx.pc DESTINATION - . + ./ ) message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") diff --git a/build-aarch64-linux-gnu.sh b/build-aarch64-linux-gnu.sh index dd9df3648..a957d888a 100755 --- a/build-aarch64-linux-gnu.sh +++ b/build-aarch64-linux-gnu.sh @@ -44,10 +44,6 @@ if [[ x"$BUILD_SHARED_LIBS" == x"" ]]; then BUILD_SHARED_LIBS=OFF fi -if [[ -n $BUILD_SHARED_LIBS && -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS -fi - cmake \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ @@ -56,7 +52,6 @@ cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ diff --git a/build-android-arm64-v8a.sh b/build-android-arm64-v8a.sh index e60cddd07..b48b5b246 100755 --- a/build-android-arm64-v8a.sh +++ b/build-android-arm64-v8a.sh @@ -75,12 +75,7 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi -if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON -fi - cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-android-armv7-eabi.sh b/build-android-armv7-eabi.sh index 1cda3527c..b9f28b195 100755 --- a/build-android-armv7-eabi.sh +++ b/build-android-armv7-eabi.sh @@ -76,12 +76,7 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi -if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON -fi - cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-android-x86-64.sh b/build-android-x86-64.sh index ccfcb1942..b88836749 100755 --- a/build-android-x86-64.sh +++ b/build-android-x86-64.sh @@ -76,12 +76,7 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi -if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON -fi - cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-android-x86.sh b/build-android-x86.sh index 0831199bd..657ae9a42 100755 --- a/build-android-x86.sh +++ b/build-android-x86.sh @@ -76,12 +76,7 @@ if [ -z $SHERPA_ONNX_ENABLE_JNI ]; then SHERPA_ONNX_ENABLE_JNI=ON fi -if [ -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON -fi - cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TTS=$SHERPA_ONNX_ENABLE_TTS \ -DSHERPA_ONNX_ENABLE_BINARY=$SHERPA_ONNX_ENABLE_BINARY \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ diff --git a/build-arm-linux-gnueabihf.sh b/build-arm-linux-gnueabihf.sh index 0f91bdd29..0c70f483c 100755 --- a/build-arm-linux-gnueabihf.sh +++ b/build-arm-linux-gnueabihf.sh @@ -39,10 +39,6 @@ if [[ x"$BUILD_SHARED_LIBS" == x"" ]]; then BUILD_SHARED_LIBS=OFF fi -if [[ -n $BUILD_SHARED_LIBS && -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS -fi - cmake \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ @@ -51,7 +47,6 @@ cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ diff --git a/build-riscv64-linux-gnu.sh b/build-riscv64-linux-gnu.sh index 7dde0f400..0e7efdab5 100755 --- a/build-riscv64-linux-gnu.sh +++ b/build-riscv64-linux-gnu.sh @@ -47,10 +47,6 @@ if [[ x"$BUILD_SHARED_LIBS" == x"" ]]; then BUILD_SHARED_LIBS=ON fi -if [[ -n $BUILD_SHARED_LIBS && -z $SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB ]]; then - SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$BUILD_SHARED_LIBS -fi - cmake \ -DBUILD_PIPER_PHONMIZE_EXE=OFF \ -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ @@ -59,7 +55,6 @@ cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=$SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB \ -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index ab3e3de0c..28204a5de 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -130,7 +130,6 @@ def build_extension(self, ext: setuptools.extension.Extension): extra_cmake_args = f" -DCMAKE_INSTALL_PREFIX={install_dir} " extra_cmake_args += " -DBUILD_SHARED_LIBS=ON " - extra_cmake_args += " -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON " extra_cmake_args += " -DBUILD_PIPER_PHONMIZE_EXE=OFF " extra_cmake_args += " -DBUILD_PIPER_PHONMIZE_TESTS=OFF " extra_cmake_args += " -DBUILD_ESPEAK_NG_EXE=OFF " diff --git a/cmake/espeak-ng-for-piper.cmake b/cmake/espeak-ng-for-piper.cmake index 7460ebed8..b54a0a6bd 100644 --- a/cmake/espeak-ng-for-piper.cmake +++ b/cmake/espeak-ng-for-piper.cmake @@ -53,14 +53,14 @@ function(download_espeak_ng_for_piper) message(STATUS "espeak-ng is downloaded to ${espeak_ng_SOURCE_DIR}") message(STATUS "espeak-ng binary dir is ${espeak_ng_BINARY_DIR}") - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${espeak_ng_SOURCE_DIR} ${espeak_ng_BINARY_DIR}) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties(espeak-ng PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -123,29 +123,11 @@ function(download_espeak_ng_for_piper) ${espeak_ng_SOURCE_DIR}/src/ucd-tools/src/include ) - if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS - espeak-ng - ucd - DESTINATION ..) - else() - install(TARGETS - espeak-ng - ucd - DESTINATION lib) - endif() - - if(NOT BUILD_SHARED_LIBS) - install(TARGETS ucd DESTINATION lib) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS - espeak-ng - ucd - DESTINATION bin) - endif() + if(NOT BUILD_SHARED_LIBS) + install(TARGETS + espeak-ng + ucd + DESTINATION lib) endif() endfunction() diff --git a/cmake/kaldi-decoder.cmake b/cmake/kaldi-decoder.cmake index db2a3107e..d3d7ec2d5 100644 --- a/cmake/kaldi-decoder.cmake +++ b/cmake/kaldi-decoder.cmake @@ -46,14 +46,14 @@ function(download_kaldi_decoder) include_directories(${kaldi_decoder_SOURCE_DIR}) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${kaldi_decoder_SOURCE_DIR} ${kaldi_decoder_BINARY_DIR} EXCLUDE_FROM_ALL) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties( kaldi-decoder-core PROPERTIES @@ -75,31 +75,13 @@ function(download_kaldi_decoder) INTERFACE ${kaldi-decoder_SOURCE_DIR}/ ) - if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS - kaldi-decoder-core - kaldifst_core - fst - fstfar - DESTINATION ..) - else() - install(TARGETS - kaldi-decoder-core - kaldifst_core - fst - fstfar - DESTINATION lib) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS - kaldi-decoder-core - kaldifst_core - fst - fstfar - DESTINATION bin) - endif() + if(NOT BUILD_SHARED_LIBS) + install(TARGETS + kaldi-decoder-core + kaldifst_core + fst + fstfar + DESTINATION lib) endif() endfunction() diff --git a/cmake/kaldi-native-fbank.cmake b/cmake/kaldi-native-fbank.cmake index cdf88ffc5..ec2add8b1 100644 --- a/cmake/kaldi-native-fbank.cmake +++ b/cmake/kaldi-native-fbank.cmake @@ -44,14 +44,14 @@ function(download_kaldi_native_fbank) message(STATUS "kaldi-native-fbank is downloaded to ${kaldi_native_fbank_SOURCE_DIR}") message(STATUS "kaldi-native-fbank's binary dir is ${kaldi_native_fbank_BINARY_DIR}") - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${kaldi_native_fbank_SOURCE_DIR} ${kaldi_native_fbank_BINARY_DIR} EXCLUDE_FROM_ALL) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties(kaldi-native-fbank-core PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -66,16 +66,8 @@ function(download_kaldi_native_fbank) ${kaldi_native_fbank_SOURCE_DIR}/ ) - if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS kaldi-native-fbank-core DESTINATION ..) - else() - install(TARGETS kaldi-native-fbank-core DESTINATION lib) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS kaldi-native-fbank-core DESTINATION bin) - endif() + if(NOT BUILD_SHARED_LIBS) + install(TARGETS kaldi-native-fbank-core DESTINATION lib) endif() endfunction() diff --git a/cmake/kaldifst.cmake b/cmake/kaldifst.cmake index 9daf05584..765e2571a 100644 --- a/cmake/kaldifst.cmake +++ b/cmake/kaldifst.cmake @@ -43,14 +43,14 @@ function(download_kaldifst) list(APPEND CMAKE_MODULE_PATH ${kaldifst_SOURCE_DIR}/cmake) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${kaldifst_SOURCE_DIR} ${kaldifst_BINARY_DIR} EXCLUDE_FROM_ALL) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties(kaldifst_core PROPERTIES POSITION_INDEPENDENT_CODE ON diff --git a/cmake/openfst.cmake b/cmake/openfst.cmake index ffeb1fd36..0f5863b7c 100644 --- a/cmake/openfst.cmake +++ b/cmake/openfst.cmake @@ -68,14 +68,14 @@ function(download_openfst) endif() message(STATUS "openfst is downloaded to ${openfst_SOURCE_DIR}") - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${openfst_SOURCE_DIR} ${openfst_BINARY_DIR} EXCLUDE_FROM_ALL) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties(fst fstfar PROPERTIES POSITION_INDEPENDENT_CODE ON diff --git a/cmake/piper-phonemize.cmake b/cmake/piper-phonemize.cmake index 0facbbbc0..7ecf1791b 100644 --- a/cmake/piper-phonemize.cmake +++ b/cmake/piper-phonemize.cmake @@ -40,14 +40,14 @@ function(download_piper_phonemize) message(STATUS "piper-phonemize is downloaded to ${piper_phonemize_SOURCE_DIR}") message(STATUS "piper-phonemize binary dir is ${piper_phonemize_BINARY_DIR}") - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${piper_phonemize_SOURCE_DIR} ${piper_phonemize_BINARY_DIR} EXCLUDE_FROM_ALL) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties(piper_phonemize PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -68,22 +68,10 @@ function(download_piper_phonemize) ${piper_phonemize_SOURCE_DIR}/src/include ) - if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS - piper_phonemize - DESTINATION ..) - else() - install(TARGETS - piper_phonemize - DESTINATION lib) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS - piper_phonemize - DESTINATION bin) - endif() + if(NOT BUILD_SHARED_LIBS) + install(TARGETS + piper_phonemize + DESTINATION lib) endif() endfunction() diff --git a/cmake/portaudio.cmake b/cmake/portaudio.cmake index 0ad2f47cf..de05f4a9b 100644 --- a/cmake/portaudio.cmake +++ b/cmake/portaudio.cmake @@ -26,17 +26,9 @@ function(download_portaudio) endif() endforeach() - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - set(BUILD_SHARED_LIBS OFF) - endif() - - if(BUILD_SHARED_LIBS) - set(PA_BUILD_SHARED ON CACHE BOOL "" FORCE) - set(PA_BUILD_STATIC OFF CACHE BOOL "" FORCE) - else() - set(PA_BUILD_SHARED OFF CACHE BOOL "" FORCE) - set(PA_BUILD_STATIC ON CACHE BOOL "" FORCE) - endif() + # Always use static build + set(PA_BUILD_SHARED OFF CACHE BOOL "" FORCE) + set(PA_BUILD_STATIC ON CACHE BOOL "" FORCE) FetchContent_Declare(portaudio URL @@ -59,30 +51,9 @@ function(download_portaudio) add_subdirectory(${portaudio_SOURCE_DIR} ${portaudio_BINARY_DIR} EXCLUDE_FROM_ALL) - if(BUILD_SHARED_LIBS) - set_target_properties(portaudio PROPERTIES OUTPUT_NAME "sherpa-onnx-portaudio") - if(NOT WIN32) - target_compile_options(portaudio PRIVATE "-Wno-deprecated-declarations") - endif() - - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS portaudio DESTINATION ..) - else() - install(TARGETS portaudio DESTINATION lib) - endif() - else() - set_target_properties(portaudio_static PROPERTIES OUTPUT_NAME "sherpa-onnx-portaudio_static") - if(NOT WIN32) - target_compile_options(portaudio_static PRIVATE "-Wno-deprecated-declarations") - endif() - - if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS portaudio_static DESTINATION ..) - else() - install(TARGETS portaudio_static DESTINATION lib) - endif() - endif() + set_target_properties(portaudio_static PROPERTIES OUTPUT_NAME "sherpa-onnx-portaudio_static") + if(NOT WIN32) + target_compile_options(portaudio_static PRIVATE "-Wno-deprecated-declarations") endif() endfunction() diff --git a/cmake/sherpa-onnx-single.pc.in b/cmake/sherpa-onnx-shared.pc.in similarity index 100% rename from cmake/sherpa-onnx-single.pc.in rename to cmake/sherpa-onnx-shared.pc.in diff --git a/cmake/sherpa-onnx-no-tts.pc.in b/cmake/sherpa-onnx-static-no-tts.pc.in similarity index 100% rename from cmake/sherpa-onnx-no-tts.pc.in rename to cmake/sherpa-onnx-static-no-tts.pc.in diff --git a/cmake/sherpa-onnx.pc.in b/cmake/sherpa-onnx-static.pc.in similarity index 100% rename from cmake/sherpa-onnx.pc.in rename to cmake/sherpa-onnx-static.pc.in diff --git a/cmake/simple-sentencepiece.cmake b/cmake/simple-sentencepiece.cmake index dacdb11f0..09a640b11 100644 --- a/cmake/simple-sentencepiece.cmake +++ b/cmake/simple-sentencepiece.cmake @@ -43,14 +43,14 @@ function(download_simple_sentencepiece) endif() message(STATUS "simple-sentencepiece is downloaded to ${simple-sentencepiece_SOURCE_DIR}") - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) endif() add_subdirectory(${simple-sentencepiece_SOURCE_DIR} ${simple-sentencepiece_BINARY_DIR} EXCLUDE_FROM_ALL) - if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB AND _build_shared_libs_bak) + if(_build_shared_libs_bak) set_target_properties(ssentencepiece_core PROPERTIES POSITION_INDEPENDENT_CODE ON @@ -65,16 +65,8 @@ function(download_simple_sentencepiece) ${simple-sentencepiece_SOURCE_DIR}/ ) - if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS ssentencepiece_core DESTINATION ..) - else() - install(TARGETS ssentencepiece_core DESTINATION lib) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS ssentencepiece_core DESTINATION bin) - endif() + if(NOT BUILD_SHARED_LIBS) + install(TARGETS ssentencepiece_core DESTINATION lib) endif() endfunction() diff --git a/java-api-examples/run-add-punctuation-zh-en.sh b/java-api-examples/run-add-punctuation-zh-en.sh index 067e4231c..5d707ea87 100755 --- a/java-api-examples/run-add-punctuation-zh-en.sh +++ b/java-api-examples/run-add-punctuation-zh-en.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-audio-tagging-ced-from-file.sh b/java-api-examples/run-audio-tagging-ced-from-file.sh index 7ecf1f2a6..35098901c 100755 --- a/java-api-examples/run-audio-tagging-ced-from-file.sh +++ b/java-api-examples/run-audio-tagging-ced-from-file.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-audio-tagging-zipformer-from-file.sh b/java-api-examples/run-audio-tagging-zipformer-from-file.sh index 3add61169..36d07dbab 100755 --- a/java-api-examples/run-audio-tagging-zipformer-from-file.sh +++ b/java-api-examples/run-audio-tagging-zipformer-from-file.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-inverse-text-normalization-paraformer.sh b/java-api-examples/run-inverse-text-normalization-paraformer.sh index 79cce4b33..606dba6f7 100755 --- a/java-api-examples/run-inverse-text-normalization-paraformer.sh +++ b/java-api-examples/run-inverse-text-normalization-paraformer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-inverse-text-normalization-transducer.sh b/java-api-examples/run-inverse-text-normalization-transducer.sh index 202b878a7..509d71f07 100755 --- a/java-api-examples/run-inverse-text-normalization-transducer.sh +++ b/java-api-examples/run-inverse-text-normalization-transducer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-kws-from-file.sh b/java-api-examples/run-kws-from-file.sh index a849419ca..0a60dcb0d 100755 --- a/java-api-examples/run-kws-from-file.sh +++ b/java-api-examples/run-kws-from-file.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-nemo.sh b/java-api-examples/run-non-streaming-decode-file-nemo.sh index 0b1595fad..057852a07 100755 --- a/java-api-examples/run-non-streaming-decode-file-nemo.sh +++ b/java-api-examples/run-non-streaming-decode-file-nemo.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-paraformer.sh b/java-api-examples/run-non-streaming-decode-file-paraformer.sh index 3f3e43b5a..28592e54b 100755 --- a/java-api-examples/run-non-streaming-decode-file-paraformer.sh +++ b/java-api-examples/run-non-streaming-decode-file-paraformer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh b/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh index 04de2a22c..075f1e2e3 100755 --- a/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh +++ b/java-api-examples/run-non-streaming-decode-file-tele-speech-ctc.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-transducer.sh b/java-api-examples/run-non-streaming-decode-file-transducer.sh index e2c2bdd31..b244d30b7 100755 --- a/java-api-examples/run-non-streaming-decode-file-transducer.sh +++ b/java-api-examples/run-non-streaming-decode-file-transducer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-decode-file-whisper.sh b/java-api-examples/run-non-streaming-decode-file-whisper.sh index 367a8e8e9..317e90ae1 100755 --- a/java-api-examples/run-non-streaming-decode-file-whisper.sh +++ b/java-api-examples/run-non-streaming-decode-file-whisper.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-tts-coqui-de.sh b/java-api-examples/run-non-streaming-tts-coqui-de.sh index b0af20882..308d3e931 100755 --- a/java-api-examples/run-non-streaming-tts-coqui-de.sh +++ b/java-api-examples/run-non-streaming-tts-coqui-de.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-tts-piper-en.sh b/java-api-examples/run-non-streaming-tts-piper-en.sh index 0a3f15065..61465faa7 100755 --- a/java-api-examples/run-non-streaming-tts-piper-en.sh +++ b/java-api-examples/run-non-streaming-tts-piper-en.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-non-streaming-tts-vits-zh.sh b/java-api-examples/run-non-streaming-tts-vits-zh.sh index 3801383ce..5be38680b 100755 --- a/java-api-examples/run-non-streaming-tts-vits-zh.sh +++ b/java-api-examples/run-non-streaming-tts-vits-zh.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-speaker-identification.sh b/java-api-examples/run-speaker-identification.sh index bc7253b2e..0bfd46e20 100755 --- a/java-api-examples/run-speaker-identification.sh +++ b/java-api-examples/run-speaker-identification.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-spoken-language-identification-whisper.sh b/java-api-examples/run-spoken-language-identification-whisper.sh index 625bc69ca..bf2b3cb20 100755 --- a/java-api-examples/run-spoken-language-identification-whisper.sh +++ b/java-api-examples/run-spoken-language-identification-whisper.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-asr-from-mic-transducer.sh b/java-api-examples/run-streaming-asr-from-mic-transducer.sh index dc32b58f5..900ef4f1d 100755 --- a/java-api-examples/run-streaming-asr-from-mic-transducer.sh +++ b/java-api-examples/run-streaming-asr-from-mic-transducer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-ctc-hlg.sh b/java-api-examples/run-streaming-decode-file-ctc-hlg.sh index 19fc593a1..5400f11b7 100755 --- a/java-api-examples/run-streaming-decode-file-ctc-hlg.sh +++ b/java-api-examples/run-streaming-decode-file-ctc-hlg.sh @@ -9,7 +9,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-ctc.sh b/java-api-examples/run-streaming-decode-file-ctc.sh index 7c38fce82..d029e1662 100755 --- a/java-api-examples/run-streaming-decode-file-ctc.sh +++ b/java-api-examples/run-streaming-decode-file-ctc.sh @@ -9,7 +9,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-paraformer.sh b/java-api-examples/run-streaming-decode-file-paraformer.sh index 8a1fe9057..435f80503 100755 --- a/java-api-examples/run-streaming-decode-file-paraformer.sh +++ b/java-api-examples/run-streaming-decode-file-paraformer.sh @@ -9,7 +9,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-streaming-decode-file-transducer.sh b/java-api-examples/run-streaming-decode-file-transducer.sh index 902c5a6a7..79a20ea1c 100755 --- a/java-api-examples/run-streaming-decode-file-transducer.sh +++ b/java-api-examples/run-streaming-decode-file-transducer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh b/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh index a2fcbe455..edb973794 100755 --- a/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh +++ b/java-api-examples/run-vad-from-mic-non-streaming-paraformer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh b/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh index 424becfd2..63c661d1f 100755 --- a/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh +++ b/java-api-examples/run-vad-from-mic-non-streaming-whisper.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-from-mic.sh b/java-api-examples/run-vad-from-mic.sh index 3e66571a9..320e97cbd 100755 --- a/java-api-examples/run-vad-from-mic.sh +++ b/java-api-examples/run-vad-from-mic.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-non-streaming-paraformer.sh b/java-api-examples/run-vad-non-streaming-paraformer.sh index 09a629eed..b3a04f0b5 100755 --- a/java-api-examples/run-vad-non-streaming-paraformer.sh +++ b/java-api-examples/run-vad-non-streaming-paraformer.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/java-api-examples/run-vad-remove-slience.sh b/java-api-examples/run-vad-remove-slience.sh index c15e26f7b..0fd08ca6f 100755 --- a/java-api-examples/run-vad-remove-slience.sh +++ b/java-api-examples/run-vad-remove-slience.sh @@ -10,7 +10,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_TESTS=OFF \ -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/kotlin-api-examples/run.sh b/kotlin-api-examples/run.sh index c11f793b7..81f1198d3 100755 --- a/kotlin-api-examples/run.sh +++ b/kotlin-api-examples/run.sh @@ -15,7 +15,6 @@ if [[ ! -f ../build/lib/libsherpa-onnx-jni.dylib && ! -f ../build/lib/libsherpa -DSHERPA_ONNX_ENABLE_CHECK=OFF \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_JNI=ON \ .. diff --git a/scripts/node-addon-api/run.sh b/scripts/node-addon-api/run.sh index 4089f1b72..58f3b5c53 100755 --- a/scripts/node-addon-api/run.sh +++ b/scripts/node-addon-api/run.sh @@ -10,8 +10,8 @@ if [[ ! -f ../../build/install/lib/libsherpa-onnx-c-api.dylib && ! -f ../../buil cmake \ -DCMAKE_INSTALL_PREFIX=./install \ -DBUILD_SHARED_LIBS=ON \ - -DSHERPA_ONNX_BUILD_SINGLE_SHARED_LIB=ON \ .. + make install popd fi diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index 0a26b5fb9..7479190e3 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -155,26 +155,16 @@ if(SHERPA_ONNX_ENABLE_CHECK) list(APPEND sources log.cc) endif() -set(_build_shared_libs_bak ${BUILD_SHARED_LIBS}) -if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - # We set BUILD_SHARED_LIBS to OFF only in this file so that - # building EXEs won't throw the following error - # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't - # match value 'MD_Dynamic Release' - set(BUILD_SHARED_LIBS OFF) -endif() - -add_library(sherpa-onnx-core ${sources}) - -if(SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - set_target_properties( - sherpa-onnx-core - PROPERTIES - POSITION_INDEPENDENT_CODE ON - C_VISIBILITY_PRESET hidden - CXX_VISIBILITY_PRESET hidden - ) -endif() +# Always static build +add_library(sherpa-onnx-core STATIC ${sources}) + +set_target_properties( + sherpa-onnx-core + PROPERTIES + POSITION_INDEPENDENT_CODE ON + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden +) if(APPLE) target_compile_options(sherpa-onnx-core PRIVATE @@ -232,10 +222,6 @@ if(SHERPA_ONNX_ENABLE_CHECK) endif() endif() -if(NOT BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL Linux) - target_link_libraries(sherpa-onnx-core -ldl) -endif() - if(NOT WIN32 AND NOT SHERPA_ONNX_ENABLE_WASM AND CMAKE_SYSTEM_NAME STREQUAL Linux) target_link_libraries(sherpa-onnx-core -pthread) endif() @@ -284,17 +270,7 @@ if(SHERPA_ONNX_ENABLE_BINARY) endif() endif() -if(NOT SHERPA_ONNX_BUILD_SINGLE_SHARED_LIB) - if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32) - install(TARGETS sherpa-onnx-core DESTINATION ..) - else() - install(TARGETS sherpa-onnx-core DESTINATION lib) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) - install(TARGETS sherpa-onnx-core DESTINATION bin) - endif() -endif() +install(TARGETS sherpa-onnx-core DESTINATION lib) if(SHERPA_ONNX_ENABLE_BINARY) install( @@ -411,12 +387,6 @@ if(SHERPA_ONNX_ENABLE_PORTAUDIO AND SHERPA_ONNX_ENABLE_BINARY) microphone.cc ) - if(BUILD_SHARED_LIBS) - set(PA_LIB portaudio) - else() - set(PA_LIB portaudio_static) - endif() - set(exes sherpa-onnx-microphone sherpa-onnx-keyword-spotter-microphone @@ -433,7 +403,7 @@ if(SHERPA_ONNX_ENABLE_PORTAUDIO AND SHERPA_ONNX_ENABLE_BINARY) endif() foreach(exe IN LISTS exes) - target_link_libraries(${exe} ${PA_LIB} sherpa-onnx-core) + target_link_libraries(${exe} portaudio_static sherpa-onnx-core) endforeach() if(NOT WIN32) @@ -575,5 +545,3 @@ add_custom_target( DEPENDS ${sources}) add_custom_target(check DEPENDS clang-tidy-check) - -set(BUILD_SHARED_LIBS ${_build_shared_libs_bak}) From 045993dc86f2d4c7832865df1241febe0a519da2 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:12:24 +0800 Subject: [PATCH 20/54] do not install sherpa-onnx-core when BUILD_SHARED_LIBS is ON --- sherpa-onnx/csrc/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index 7479190e3..32cf99e0b 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -270,7 +270,9 @@ if(SHERPA_ONNX_ENABLE_BINARY) endif() endif() -install(TARGETS sherpa-onnx-core DESTINATION lib) +if(NOT BUILD_SHARED_LIBS) + install(TARGETS sherpa-onnx-core DESTINATION lib) +endif() if(SHERPA_ONNX_ENABLE_BINARY) install( From a9d9098787890e9281fa54374be03eb8376b114d Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:20:42 +0800 Subject: [PATCH 21/54] remove rpath settings --- CMakeLists.txt | 15 ------- sherpa-onnx/csrc/CMakeLists.txt | 54 -------------------------- sherpa-onnx/python/csrc/CMakeLists.txt | 18 --------- 3 files changed, 87 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d760429..2c95dd6c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,21 +61,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(BUILD_RPATH_USE_ORIGIN TRUE) -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - -if(NOT APPLE) - set(SHERPA_ONNX_RPATH_ORIGIN "$ORIGIN") -else() - set(SHERPA_ONNX_RPATH_ORIGIN "@loader_path") -endif() - -if(NOT WIN32) - set(CMAKE_INSTALL_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) - set(CMAKE_BUILD_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) -endif() - if(NOT CMAKE_BUILD_TYPE) message(STATUS "No CMAKE_BUILD_TYPE given, default to Release") set(CMAKE_BUILD_TYPE Release) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index 32cf99e0b..d5cdf82eb 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -257,17 +257,6 @@ if(SHERPA_ONNX_ENABLE_BINARY) foreach(exe IN LISTS main_exes) target_link_libraries(${exe} sherpa-onnx-core) endforeach() - - if(NOT WIN32) - foreach(exe IN LISTS main_exes) - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - - if(SHERPA_ONNX_ENABLE_PYTHON) - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") - endif() - endforeach() - endif() endif() if(NOT BUILD_SHARED_LIBS) @@ -326,19 +315,6 @@ if(SHERPA_ONNX_HAS_ALSA AND SHERPA_ONNX_ENABLE_BINARY) endif() endforeach() - if(NOT WIN32) - foreach(exe IN LISTS exes) - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - endforeach() - - if(SHERPA_ONNX_ENABLE_PYTHON) - foreach(exe IN LISTS exes) - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") - endforeach() - endif() - endif() - install( TARGETS ${exes} DESTINATION @@ -408,19 +384,6 @@ if(SHERPA_ONNX_ENABLE_PORTAUDIO AND SHERPA_ONNX_ENABLE_BINARY) target_link_libraries(${exe} portaudio_static sherpa-onnx-core) endforeach() - if(NOT WIN32) - foreach(exe IN LISTS exes) - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - endforeach() - - if(SHERPA_ONNX_ENABLE_PYTHON) - foreach(exe IN LISTS exes) - target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") - endforeach() - endif() - endif() - install( TARGETS ${exes} DESTINATION @@ -460,23 +423,6 @@ if(SHERPA_ONNX_ENABLE_WEBSOCKET AND SHERPA_ONNX_ENABLE_BINARY) target_compile_options(sherpa-onnx-offline-websocket-server PRIVATE -Wno-deprecated-declarations) endif() - if(NOT WIN32) - target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") - target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - - target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") - target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - - target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") - target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") - - if(SHERPA_ONNX_ENABLE_PYTHON AND NOT WIN32) - target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") - target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") - target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") - endif() - endif() - install( TARGETS sherpa-onnx-online-websocket-server diff --git a/sherpa-onnx/python/csrc/CMakeLists.txt b/sherpa-onnx/python/csrc/CMakeLists.txt index 6d61d11dd..3b3e70865 100644 --- a/sherpa-onnx/python/csrc/CMakeLists.txt +++ b/sherpa-onnx/python/csrc/CMakeLists.txt @@ -56,24 +56,6 @@ endif() pybind11_add_module(_sherpa_onnx ${srcs}) -if(APPLE) - execute_process( - COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_DIR - ) - message(STATUS "PYTHON_SITE_PACKAGE_DIR: ${PYTHON_SITE_PACKAGE_DIR}") - if(PYTHON_SITE_PACKAGE_DIR STREQUAL "") - message(WARNING "PYTHON_SITE_PACKAGE_DIR is empty!") - else() - target_link_libraries(_sherpa_onnx PRIVATE "-Wl,-rpath,${PYTHON_SITE_PACKAGE_DIR}") - endif() -endif() - -if(NOT WIN32) - target_link_libraries(_sherpa_onnx PRIVATE "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/sherpa_onnx/lib") -endif() - target_link_libraries(_sherpa_onnx PRIVATE sherpa-onnx-core) if(SHERPA_ONNX_HAS_ALSA) From d1a87d314570f4a6b7faea8d01aa0fcdd70c8f44 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:31:28 +0800 Subject: [PATCH 22/54] fix building on windows --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c95dd6c4..ca08cbd5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,16 @@ to install CUDA toolkit if you have not installed it.") endif() endif() -if(BUILD_SHARED_LIBS AND MSVC) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +# see https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html +# https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake +if(MSVC) + add_compile_options( + $<$:/MT> #---------| + $<$:/MTd> #---|-- Statically link the runtime libraries + $<$:/MT> #--| + $<$:/MT> + $<$:/MT> + ) endif() message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") From 6f88b3982c652338be8c542261d86127cf804c2f Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:37:34 +0800 Subject: [PATCH 23/54] Revert "remove rpath settings" This reverts commit a9d9098787890e9281fa54374be03eb8376b114d. --- CMakeLists.txt | 15 +++++++ sherpa-onnx/csrc/CMakeLists.txt | 54 ++++++++++++++++++++++++++ sherpa-onnx/python/csrc/CMakeLists.txt | 18 +++++++++ 3 files changed, 87 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca08cbd5c..efef2dfa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,21 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_SKIP_BUILD_RPATH FALSE) +set(BUILD_RPATH_USE_ORIGIN TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +if(NOT APPLE) + set(SHERPA_ONNX_RPATH_ORIGIN "$ORIGIN") +else() + set(SHERPA_ONNX_RPATH_ORIGIN "@loader_path") +endif() + +if(NOT WIN32) + set(CMAKE_INSTALL_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) + set(CMAKE_BUILD_RPATH ${SHERPA_ONNX_RPATH_ORIGIN}) +endif() + if(NOT CMAKE_BUILD_TYPE) message(STATUS "No CMAKE_BUILD_TYPE given, default to Release") set(CMAKE_BUILD_TYPE Release) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index d5cdf82eb..32cf99e0b 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -257,6 +257,17 @@ if(SHERPA_ONNX_ENABLE_BINARY) foreach(exe IN LISTS main_exes) target_link_libraries(${exe} sherpa-onnx-core) endforeach() + + if(NOT WIN32) + foreach(exe IN LISTS main_exes) + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") + + if(SHERPA_ONNX_ENABLE_PYTHON) + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") + endif() + endforeach() + endif() endif() if(NOT BUILD_SHARED_LIBS) @@ -315,6 +326,19 @@ if(SHERPA_ONNX_HAS_ALSA AND SHERPA_ONNX_ENABLE_BINARY) endif() endforeach() + if(NOT WIN32) + foreach(exe IN LISTS exes) + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") + endforeach() + + if(SHERPA_ONNX_ENABLE_PYTHON) + foreach(exe IN LISTS exes) + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") + endforeach() + endif() + endif() + install( TARGETS ${exes} DESTINATION @@ -384,6 +408,19 @@ if(SHERPA_ONNX_ENABLE_PORTAUDIO AND SHERPA_ONNX_ENABLE_BINARY) target_link_libraries(${exe} portaudio_static sherpa-onnx-core) endforeach() + if(NOT WIN32) + foreach(exe IN LISTS exes) + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") + endforeach() + + if(SHERPA_ONNX_ENABLE_PYTHON) + foreach(exe IN LISTS exes) + target_link_libraries(${exe} "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") + endforeach() + endif() + endif() + install( TARGETS ${exes} DESTINATION @@ -423,6 +460,23 @@ if(SHERPA_ONNX_ENABLE_WEBSOCKET AND SHERPA_ONNX_ENABLE_BINARY) target_compile_options(sherpa-onnx-offline-websocket-server PRIVATE -Wno-deprecated-declarations) endif() + if(NOT WIN32) + target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") + target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") + + target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") + target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") + + target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib") + target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../../../sherpa_onnx/lib") + + if(SHERPA_ONNX_ENABLE_PYTHON AND NOT WIN32) + target_link_libraries(sherpa-onnx-online-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") + target_link_libraries(sherpa-onnx-online-websocket-client "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") + target_link_libraries(sherpa-onnx-offline-websocket-server "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib/python${PYTHON_VERSION}/site-packages/sherpa_onnx/lib") + endif() + endif() + install( TARGETS sherpa-onnx-online-websocket-server diff --git a/sherpa-onnx/python/csrc/CMakeLists.txt b/sherpa-onnx/python/csrc/CMakeLists.txt index 3b3e70865..6d61d11dd 100644 --- a/sherpa-onnx/python/csrc/CMakeLists.txt +++ b/sherpa-onnx/python/csrc/CMakeLists.txt @@ -56,6 +56,24 @@ endif() pybind11_add_module(_sherpa_onnx ${srcs}) +if(APPLE) + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_DIR + ) + message(STATUS "PYTHON_SITE_PACKAGE_DIR: ${PYTHON_SITE_PACKAGE_DIR}") + if(PYTHON_SITE_PACKAGE_DIR STREQUAL "") + message(WARNING "PYTHON_SITE_PACKAGE_DIR is empty!") + else() + target_link_libraries(_sherpa_onnx PRIVATE "-Wl,-rpath,${PYTHON_SITE_PACKAGE_DIR}") + endif() +endif() + +if(NOT WIN32) + target_link_libraries(_sherpa_onnx PRIVATE "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/sherpa_onnx/lib") +endif() + target_link_libraries(_sherpa_onnx PRIVATE sherpa-onnx-core) if(SHERPA_ONNX_HAS_ALSA) From 5eaab98722682ab4a42716e23e3008b503a0d54e Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:39:39 +0800 Subject: [PATCH 24/54] display wheel --- .github/workflows/test-build-wheel.yaml | 4 ++++ cmake/cmake_extension.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/test-build-wheel.yaml b/.github/workflows/test-build-wheel.yaml index e53ce9313..2781d0242 100644 --- a/.github/workflows/test-build-wheel.yaml +++ b/.github/workflows/test-build-wheel.yaml @@ -114,6 +114,10 @@ jobs: shell: bash run: | ls -lh dist + cd dist + unzip ../*.whl + + tree . - name: Install wheel shell: bash diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index 28204a5de..202ca778f 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -215,6 +215,8 @@ def build_extension(self, ext: setuptools.extension.Extension): shutil.rmtree(f"{install_dir}/bin") shutil.rmtree(f"{install_dir}/share") shutil.rmtree(f"{install_dir}/lib/pkgconfig") + os.remove(f"{install_dir}/lib/libonnxruntime.dylib") + os.remove(f"{install_dir}/lib/libonnxruntime.so") if is_windows(): shutil.rmtree(f"{install_dir}/lib") From 94b95da98b2a03f6c3d312e200ed7a9ce110493b Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 21:53:02 +0800 Subject: [PATCH 25/54] remove extra files from wheel --- cmake/cmake_extension.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index 202ca778f..496f76566 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -215,8 +215,12 @@ def build_extension(self, ext: setuptools.extension.Extension): shutil.rmtree(f"{install_dir}/bin") shutil.rmtree(f"{install_dir}/share") shutil.rmtree(f"{install_dir}/lib/pkgconfig") - os.remove(f"{install_dir}/lib/libonnxruntime.dylib") - os.remove(f"{install_dir}/lib/libonnxruntime.so") + + if is_linux(): + os.remove(f"{install_dir}/lib/libonnxruntime.so") + + if is_macos(): + os.remove(f"{install_dir}/lib/libonnxruntime.dylib") if is_windows(): shutil.rmtree(f"{install_dir}/lib") From fdb18ba0d3434f65dae757aefed505cdce5c82a7 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 22:04:47 +0800 Subject: [PATCH 26/54] fix building for dotnet and dart --- .github/workflows/release-dart-package.yaml | 4 +-- build-android-arm64-v8a.sh | 12 --------- c-api-examples/run.sh | 2 +- ffmpeg-examples/run.sh | 2 +- scripts/dart/release.sh | 10 ------- scripts/dotnet/generate.py | 30 --------------------- scripts/dotnet/run.sh | 21 +++++---------- 7 files changed, 10 insertions(+), 71 deletions(-) diff --git a/.github/workflows/release-dart-package.yaml b/.github/workflows/release-dart-package.yaml index 73554d206..ca539187c 100644 --- a/.github/workflows/release-dart-package.yaml +++ b/.github/workflows/release-dart-package.yaml @@ -197,8 +197,8 @@ 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 - name: Copy pre-built libs shell: bash diff --git a/build-android-arm64-v8a.sh b/build-android-arm64-v8a.sh index b48b5b246..3aee46648 100755 --- a/build-android-arm64-v8a.sh +++ b/build-android-arm64-v8a.sh @@ -118,18 +118,6 @@ rm -rf install/lib/pkgconfig # cd /data/local/tmp # ./sherpa-onnx # -# which shows the following error log: -# -# CANNOT LINK EXECUTABLE "./sherpa-onnx": library "libsherpa-onnx-core.so" not found: needed by main executable -# -# Please run: -# -# export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH -# -# and then you can run: -# -# ./sherpa-onnx -# # It should show the help message of sherpa-onnx. # # Please use the above approach to copy model files to your phone. diff --git a/c-api-examples/run.sh b/c-api-examples/run.sh index 45ebaaa10..02054c2ec 100755 --- a/c-api-examples/run.sh +++ b/c-api-examples/run.sh @@ -11,7 +11,7 @@ if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then exit 1 fi -if [[ ! -f ../build/lib/libsherpa-onnx-core.a && ! -f ../build/lib/libsherpa-onnx-core.dylib && ! -f ../build/lib/libsherpa-onnx-core.so ]]; then +if [[ ! -f ../build/lib/libsherpa-onnx-c-api.a && ! -f ../build/lib/libsherpa-onnx-c-api.dylib && ! -f ../build/lib/libsherpa-onnx-c-api.so ]]; then echo "Please build sherpa-onnx first. You can use" echo "" echo " cd /path/to/sherpa-onnx" diff --git a/ffmpeg-examples/run.sh b/ffmpeg-examples/run.sh index a0651e00b..deede7168 100755 --- a/ffmpeg-examples/run.sh +++ b/ffmpeg-examples/run.sh @@ -11,7 +11,7 @@ if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then exit 1 fi -if [[ ! -f ../build/lib/libsherpa-onnx-core.a && ! -f ../build/lib/libsherpa-onnx-core.dylib && ! -f ../build/lib/libsherpa-onnx-core.so ]]; then +if [[ ! -f ../build/lib/libsherpa-onnx-c-api.a && ! -f ../build/lib/libsherpa-onnx-c-api.dylib && ! -f ../build/lib/libsherpa-onnx-c-api.so ]]; then echo "Please build sherpa-onnx first. You can use" echo "" echo " cd /path/to/sherpa-onnx" diff --git a/scripts/dart/release.sh b/scripts/dart/release.sh index d1d728364..e3f8208a4 100755 --- a/scripts/dart/release.sh +++ b/scripts/dart/release.sh @@ -44,10 +44,6 @@ function process_linux() { pushd linux - rm -v libpiper_phonemize.so libpiper_phonemize.so.1.2.0 - rm -v libonnxruntime.so - rm -v libcargs.so - popd } @@ -69,12 +65,6 @@ function process_macos() { cp -v sherpa_onnx/lib/*.dylib ../macos cd .. rm -rf t - - pushd macos - rm -v libcargs.dylib - rm -v libonnxruntime.dylib - rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib - popd } process_linux diff --git a/scripts/dotnet/generate.py b/scripts/dotnet/generate.py index ad6e5b91e..71b854f92 100755 --- a/scripts/dotnet/generate.py +++ b/scripts/dotnet/generate.py @@ -36,18 +36,8 @@ def get_dict(): def process_linux(s): libs = [ - "libespeak-ng.so", - "libkaldi-decoder-core.so", - "libkaldi-native-fbank-core.so", "libonnxruntime.so.1.17.1", - "libssentencepiece_core.so", - "libpiper_phonemize.so.1", "libsherpa-onnx-c-api.so", - "libsherpa-onnx-core.so", - "libsherpa-onnx-fstfar.so", - "libsherpa-onnx-fst.so", - "libsherpa-onnx-kaldifst-core.so", - "libucd.so", ] prefix = f"{src_dir}/linux/" libs = [prefix + lib for lib in libs] @@ -66,18 +56,8 @@ def process_linux(s): def process_macos(s, rid): libs = [ - "libespeak-ng.dylib", - "libkaldi-decoder-core.dylib", - "libkaldi-native-fbank-core.dylib", "libonnxruntime.1.17.1.dylib", - "libssentencepiece_core.dylib", - "libpiper_phonemize.1.dylib", "libsherpa-onnx-c-api.dylib", - "libsherpa-onnx-core.dylib", - "libsherpa-onnx-fstfar.dylib", - "libsherpa-onnx-fst.dylib", - "libsherpa-onnx-kaldifst-core.dylib", - "libucd.dylib", ] prefix = f"{src_dir}/macos-{rid}/" libs = [prefix + lib for lib in libs] @@ -96,18 +76,8 @@ def process_macos(s, rid): def process_windows(s, rid): libs = [ - "espeak-ng.dll", - "kaldi-decoder-core.dll", - "kaldi-native-fbank-core.dll", "onnxruntime.dll", - "ssentencepiece_core.dll", - "piper_phonemize.dll", "sherpa-onnx-c-api.dll", - "sherpa-onnx-core.dll", - "sherpa-onnx-fstfar.dll", - "sherpa-onnx-fst.dll", - "sherpa-onnx-kaldifst-core.dll", - "ucd.dll", ] version = get_version() diff --git a/scripts/dotnet/run.sh b/scripts/dotnet/run.sh index 8beb8f34d..9f2890b43 100755 --- a/scripts/dotnet/run.sh +++ b/scripts/dotnet/run.sh @@ -44,7 +44,7 @@ windows_x86_wheel=$src_dir/$windows_x86_wheel_filename windows_arm64_wheel_filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-arm64.tar.bz2 windows_arm64_wheel=$src_dir/$windows_arm64_wheel_filename -if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then +if [ ! -f $src_dir/linux/libsherpa-onnx-c-api.so ]; then echo "---linux x86_64---" cd linux mkdir -p wheel @@ -57,15 +57,12 @@ if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then unzip $linux_wheel_filename cp -v sherpa_onnx/lib/*.so* ../ cd .. - rm -fv libpiper_phonemize.so libpiper_phonemize.so.1.2.0 - rm -fv libonnxruntime.so - rm -fv libcargs.so rm -rf wheel ls -lh cd .. fi -if [ ! -f $src_dir/macos-x64/libsherpa-onnx-core.dylib ]; then +if [ ! -f $src_dir/macos-x64/libsherpa-onnx-c-api.dylib ]; then echo "--- macOS x86_64---" cd macos-x64 mkdir -p wheel @@ -80,15 +77,12 @@ if [ ! -f $src_dir/macos-x64/libsherpa-onnx-core.dylib ]; then cd .. - rm -fv libcargs.dylib - rm -fv libonnxruntime.dylib - rm -fv libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib rm -rf wheel ls -lh cd .. fi -if [ ! -f $src_dir/macos-arm64/libsherpa-onnx-core.dylib ]; then +if [ ! -f $src_dir/macos-arm64/libsherpa-onnx-c-api.dylib ]; then echo "--- macOS arm64---" cd macos-arm64 mkdir -p wheel @@ -103,15 +97,12 @@ if [ ! -f $src_dir/macos-arm64/libsherpa-onnx-core.dylib ]; then cd .. - rm -fv libcargs.dylib - rm -fv libonnxruntime.dylib - rm -fv libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib rm -rf wheel ls -lh cd .. fi -if [ ! -f $src_dir/windows-x64/sherpa-onnx-core.dll ]; then +if [ ! -f $src_dir/windows-x64/sherpa-onnx-c-api.dll ]; then echo "---windows x64---" cd windows-x64 mkdir -p wheel @@ -130,7 +121,7 @@ if [ ! -f $src_dir/windows-x64/sherpa-onnx-core.dll ]; then cd .. fi -if [ ! -f $src_dir/windows-x86/sherpa-onnx-core.dll ]; then +if [ ! -f $src_dir/windows-x86/sherpa-onnx-c-api.dll ]; then echo "---windows x86---" cd windows-x86 mkdir -p wheel @@ -149,7 +140,7 @@ if [ ! -f $src_dir/windows-x86/sherpa-onnx-core.dll ]; then cd .. fi -if [ ! -f $src_dir/windows-arm64/sherpa-onnx-core.dll ]; then +if [ ! -f $src_dir/windows-arm64/sherpa-onnx-c-api.dll ]; then echo "---windows arm64---" cd windows-arm64 mkdir -p wheel From ff1821276dabb76852d9682dca6a2ec05e5467b2 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 22:05:34 +0800 Subject: [PATCH 27/54] minor fixes --- .github/workflows/test-build-wheel.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-build-wheel.yaml b/.github/workflows/test-build-wheel.yaml index 2781d0242..789957618 100644 --- a/.github/workflows/test-build-wheel.yaml +++ b/.github/workflows/test-build-wheel.yaml @@ -115,6 +115,9 @@ jobs: run: | ls -lh dist cd dist + + mkdir t + cd t unzip ../*.whl tree . From 55d53c6cd525c0ea9eceff18b03e97627612eeff Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 22:10:49 +0800 Subject: [PATCH 28/54] upload wheels --- .github/workflows/test-build-wheel.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-build-wheel.yaml b/.github/workflows/test-build-wheel.yaml index 789957618..f92994e4e 100644 --- a/.github/workflows/test-build-wheel.yaml +++ b/.github/workflows/test-build-wheel.yaml @@ -110,6 +110,11 @@ jobs: python3 setup.py bdist_wheel ls -lh dist + - uses: actions/upload-artifact@v4 + with: + name: wheel-${{ matrix.os }}-${{ matrix.python-version }} + path: ./dist/*.whl + - name: Display wheel shell: bash run: | From 0d440162cf4e9e0beb68d5284e5b513e6d168571 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 5 Jul 2024 22:11:42 +0800 Subject: [PATCH 29/54] minor fixes --- .github/workflows/test-build-wheel.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-build-wheel.yaml b/.github/workflows/test-build-wheel.yaml index f92994e4e..303da0e59 100644 --- a/.github/workflows/test-build-wheel.yaml +++ b/.github/workflows/test-build-wheel.yaml @@ -125,8 +125,6 @@ jobs: cd t unzip ../*.whl - tree . - - name: Install wheel shell: bash run: | From 264c0905f4a7f84855f5bdebf434de8a2ff20317 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 10:13:20 +0800 Subject: [PATCH 30/54] fix releasing dart --- .github/workflows/release-dart-package.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-dart-package.yaml b/.github/workflows/release-dart-package.yaml index ca539187c..78f078333 100644 --- a/.github/workflows/release-dart-package.yaml +++ b/.github/workflows/release-dart-package.yaml @@ -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 @@ -199,6 +194,7 @@ jobs: 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 @@ -282,7 +278,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 From 416ad3e0d493de5f1dd1352f959bf1f5dbf26638 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 10:19:07 +0800 Subject: [PATCH 31/54] Test go for Linux in CI --- .github/workflows/test-go.yaml | 19 +++++++++++++------ scripts/go/_internal/build_linux_amd64.go | 6 ++++++ .../go/_internal/lib/x86_64-unknown-linux-gnu | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 scripts/go/_internal/build_linux_amd64.go create mode 120000 scripts/go/_internal/lib/x86_64-unknown-linux-gnu diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 01927ab0e..46b61f211 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, macos-14] + os: [macos-latest, macos-13, ubuntu-latest] steps: - uses: actions/checkout@v4 @@ -78,9 +78,16 @@ jobs: -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ .. - make -j1 - cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ - rm ./lib/*.a + make -j2 + + if [[ ${{ matrix.os }} == ubuntu-latest ]]; then + cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* ./lib/ + rm ./lib/libonnxruntime.so + else + cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ + rm ./lib/*.a + rm ./lib/libonnxruntime.dylib + fi cd ../scripts/go/_internal/ ls -lh lib @@ -103,7 +110,7 @@ jobs: cd scripts/go/_internal/streaming-hlg-decoding/ ./run.sh - - name: Test non-streaming TTS (macOS) + - name: Test non-streaming TTS shell: bash run: | mkdir tts-waves @@ -138,7 +145,7 @@ jobs: name: tts-waves-${{ matrix.os }} path: tts-waves - - name: Test non-streaming decoding files (macOS) + - name: Test non-streaming decoding files shell: bash run: | cd scripts/go/_internal/non-streaming-decode-files/ diff --git a/scripts/go/_internal/build_linux_amd64.go b/scripts/go/_internal/build_linux_amd64.go new file mode 100644 index 000000000..518821c23 --- /dev/null +++ b/scripts/go/_internal/build_linux_amd64.go @@ -0,0 +1,6 @@ +//go:build !android && linux && amd64 && !musl + +package sherpa_onnx + +// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-unknown-linux-gnu -lsherpa-onnx-c-api -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/x86_64-unknown-linux-gnu +import "C" diff --git a/scripts/go/_internal/lib/x86_64-unknown-linux-gnu b/scripts/go/_internal/lib/x86_64-unknown-linux-gnu new file mode 120000 index 000000000..b21b8dfab --- /dev/null +++ b/scripts/go/_internal/lib/x86_64-unknown-linux-gnu @@ -0,0 +1 @@ +../../../../build/lib \ No newline at end of file From c002208871396e36dfc856bea634eda8b897a275 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 10:30:22 +0800 Subject: [PATCH 32/54] Test go for windows --- .github/workflows/test-go.yaml | 23 ++++++++++++++++--- cmake/cmake_extension.py | 4 ++-- scripts/go/_internal/build_windows_amd64.go | 6 +++++ .../lib/x86_64-pc-windows-gnu/.gitkeep | 0 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 scripts/go/_internal/build_windows_amd64.go create mode 100644 scripts/go/_internal/lib/x86_64-pc-windows-gnu/.gitkeep diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 46b61f211..38bb24979 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, macos-13, ubuntu-latest] + os: [macos-latest, macos-13, ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 @@ -76,13 +76,30 @@ jobs: -DBUILD_SHARED_LIBS=ON \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ + -DCMAKE_INSTALL_PREFIX=./install \ .. - make -j2 + if [[ ${{ matrix.os }} == windows-latest ]]; then + cmake --build . --target install --config Release -- -m:2 + else + make -j2 install + fi if [[ ${{ matrix.os }} == ubuntu-latest ]]; then cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* ./lib/ - rm ./lib/libonnxruntime.so + rm -v ./lib/libonnxruntime.so + rm -v ./lib/*.a + ls -h ./lib + elif [[ ${{ matrix.os }} == windows-latest ]]; then + cp -v ./install/sherpa-onnx-c-api.dll ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ + cp -v ./install/onnxruntime.dll ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ + ls -lh ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ + cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/speaker-identification/ + cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/streaming-hlg-decoding/ + cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/non-streaming-tts/ + cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/non-streaming-decode-files/ + cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/streaming-decode-files/ + else cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ rm ./lib/*.a diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index 496f76566..b61de20f7 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -151,7 +151,7 @@ def build_extension(self, ext: setuptools.extension.Extension): if is_windows(): build_cmd = f""" cmake {cmake_args} -B {self.build_temp} -S {sherpa_onnx_dir} - cmake --build {self.build_temp} --target install --config Release + cmake --build {self.build_temp} --target install --config Release -- -m:2 """ print(f"build command is:\n{build_cmd}") ret = os.system( @@ -161,7 +161,7 @@ def build_extension(self, ext: setuptools.extension.Extension): raise Exception("Failed to configure sherpa") ret = os.system( - f"cmake --build {self.build_temp} --target install --config Release" # noqa + f"cmake --build {self.build_temp} --target install --config Release -- -m:2" # noqa ) if ret != 0: raise Exception("Failed to build and install sherpa") diff --git a/scripts/go/_internal/build_windows_amd64.go b/scripts/go/_internal/build_windows_amd64.go new file mode 100644 index 000000000..27334c63a --- /dev/null +++ b/scripts/go/_internal/build_windows_amd64.go @@ -0,0 +1,6 @@ +//go:build windows && amd64 + +package sherpa_onnx + +// #cgo LDFLAGS: -L ${SRCDIR}/lib/x86_64-pc-windows-gnu -lsherpa-onnx-c-api -lonnxruntime +import "C" diff --git a/scripts/go/_internal/lib/x86_64-pc-windows-gnu/.gitkeep b/scripts/go/_internal/lib/x86_64-pc-windows-gnu/.gitkeep new file mode 100644 index 000000000..e69de29bb From 2c1527e78d9ddc7023a52b17497ebd2cf422b95a Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 10:32:34 +0800 Subject: [PATCH 33/54] fix go tests --- .github/workflows/test-go.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 38bb24979..72fb74f7d 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -88,6 +88,11 @@ jobs: if [[ ${{ matrix.os }} == ubuntu-latest ]]; then cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* ./lib/ rm -v ./lib/libonnxruntime.so + + cd lib + ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + cd .. + rm -v ./lib/*.a ls -h ./lib elif [[ ${{ matrix.os }} == windows-latest ]]; then @@ -104,6 +109,9 @@ jobs: cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ rm ./lib/*.a rm ./lib/libonnxruntime.dylib + cd lib + ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib + cd .. fi cd ../scripts/go/_internal/ From 58eb850f1ec8011875cf1f5f6f97d84b8095a52b Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 10:46:55 +0800 Subject: [PATCH 34/54] release v1.10.10 --- .github/workflows/release-dart-package.yaml | 8 -------- CHANGELOG.md | 4 ++++ CMakeLists.txt | 2 +- dart-api-examples/non-streaming-asr/pubspec.yaml | 2 +- dart-api-examples/streaming-asr/pubspec.yaml | 2 +- dart-api-examples/tts/pubspec.yaml | 2 +- dart-api-examples/vad/pubspec.yaml | 2 +- flutter-examples/streaming_asr/pubspec.yaml | 4 ++-- flutter/sherpa_onnx/pubspec.yaml | 10 +++++----- 9 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release-dart-package.yaml b/.github/workflows/release-dart-package.yaml index 78f078333..1cc33542e 100644 --- a/.github/workflows/release-dart-package.yaml +++ b/.github/workflows/release-dart-package.yaml @@ -205,14 +205,6 @@ jobs: ls -lh /tmp/to_be_published/macos - pushd /tmp/to_be_published/macos - - rm libonnxruntime.dylib - - ls -lh - - popd - - name: Release shell: bash run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index d58bdad62..edaa2b7ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.10.10 + +* Build sherpa-onnx into a single shared library. + ## 1.10.9 * Fix released packages. piper-phonemize was not included in v1.10.8. diff --git a/CMakeLists.txt b/CMakeLists.txt index efef2dfa7..5c8c5b7d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(sherpa-onnx) # ./nodejs-addon-examples # ./dart-api-examples/ # ./sherpa-onnx/flutter/CHANGELOG.md -set(SHERPA_ONNX_VERSION "1.10.9") +set(SHERPA_ONNX_VERSION "1.10.10") # Disable warning about # diff --git a/dart-api-examples/non-streaming-asr/pubspec.yaml b/dart-api-examples/non-streaming-asr/pubspec.yaml index 783497636..81dbae8c5 100644 --- a/dart-api-examples/non-streaming-asr/pubspec.yaml +++ b/dart-api-examples/non-streaming-asr/pubspec.yaml @@ -10,7 +10,7 @@ environment: # Add regular dependencies here. dependencies: - sherpa_onnx: ^1.10.9 + sherpa_onnx: ^1.10.10 path: ^1.9.0 args: ^2.5.0 diff --git a/dart-api-examples/streaming-asr/pubspec.yaml b/dart-api-examples/streaming-asr/pubspec.yaml index 55073f4f4..9dc7e9fc6 100644 --- a/dart-api-examples/streaming-asr/pubspec.yaml +++ b/dart-api-examples/streaming-asr/pubspec.yaml @@ -11,7 +11,7 @@ environment: # Add regular dependencies here. dependencies: - sherpa_onnx: ^1.10.9 + sherpa_onnx: ^1.10.10 path: ^1.9.0 args: ^2.5.0 diff --git a/dart-api-examples/tts/pubspec.yaml b/dart-api-examples/tts/pubspec.yaml index 174705fbe..a07aff98f 100644 --- a/dart-api-examples/tts/pubspec.yaml +++ b/dart-api-examples/tts/pubspec.yaml @@ -8,7 +8,7 @@ environment: # Add regular dependencies here. dependencies: - sherpa_onnx: ^1.10.9 + sherpa_onnx: ^1.10.10 path: ^1.9.0 args: ^2.5.0 diff --git a/dart-api-examples/vad/pubspec.yaml b/dart-api-examples/vad/pubspec.yaml index 9a6904bdb..5d2b89b8e 100644 --- a/dart-api-examples/vad/pubspec.yaml +++ b/dart-api-examples/vad/pubspec.yaml @@ -9,7 +9,7 @@ environment: sdk: ^3.4.0 dependencies: - sherpa_onnx: ^1.10.9 + sherpa_onnx: ^1.10.10 path: ^1.9.0 args: ^2.5.0 diff --git a/flutter-examples/streaming_asr/pubspec.yaml b/flutter-examples/streaming_asr/pubspec.yaml index c35869217..b30d01f55 100644 --- a/flutter-examples/streaming_asr/pubspec.yaml +++ b/flutter-examples/streaming_asr/pubspec.yaml @@ -5,7 +5,7 @@ description: > publish_to: 'none' -version: 1.10.1 +version: 1.10.10 topics: - speech-recognition @@ -30,7 +30,7 @@ dependencies: record: ^5.1.0 url_launcher: ^6.2.6 - sherpa_onnx: ^1.10.9 + sherpa_onnx: ^1.10.10 # sherpa_onnx: # path: ../../flutter/sherpa_onnx diff --git a/flutter/sherpa_onnx/pubspec.yaml b/flutter/sherpa_onnx/pubspec.yaml index a30ea31e1..e1f2aeb30 100644 --- a/flutter/sherpa_onnx/pubspec.yaml +++ b/flutter/sherpa_onnx/pubspec.yaml @@ -17,7 +17,7 @@ topics: - voice-activity-detection # remember to change the version in ../sherpa_onnx_macos/macos/sherpa_onnx_macos.podspec -version: 1.10.9 +version: 1.10.10 homepage: https://github.com/k2-fsa/sherpa-onnx @@ -30,16 +30,16 @@ dependencies: flutter: sdk: flutter - sherpa_onnx_android: ^1.10.9 + sherpa_onnx_android: ^1.10.10 # path: ../sherpa_onnx_android - sherpa_onnx_macos: ^1.10.9 + sherpa_onnx_macos: ^1.10.10 # path: ../sherpa_onnx_macos - sherpa_onnx_linux: ^1.10.9 + sherpa_onnx_linux: ^1.10.10 # path: ../sherpa_onnx_linux # - sherpa_onnx_windows: ^1.10.9 + sherpa_onnx_windows: ^1.10.10 # path: ../sherpa_onnx_windows flutter: From 6da8e55344706af514ca486f8578ed643241b234 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 11:31:30 +0800 Subject: [PATCH 35/54] fix test go for windows --- .github/workflows/test-go.yaml | 4 ++-- cmake/sherpa-onnx-shared.pc.in | 9 +++++++++ cmake/sherpa-onnx-static-no-tts.pc.in | 9 +++++++++ cmake/sherpa-onnx-static.pc.in | 9 +++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 72fb74f7d..55f750db3 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -96,8 +96,8 @@ jobs: rm -v ./lib/*.a ls -h ./lib elif [[ ${{ matrix.os }} == windows-latest ]]; then - cp -v ./install/sherpa-onnx-c-api.dll ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ - cp -v ./install/onnxruntime.dll ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ + cp -v ./install/lib/sherpa-onnx-c-api.dll ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ + cp -v ./install/lib/onnxruntime.dll ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ ls -lh ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/ cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/speaker-identification/ cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/streaming-hlg-decoding/ diff --git a/cmake/sherpa-onnx-shared.pc.in b/cmake/sherpa-onnx-shared.pc.in index 26ba8797f..e0b0eea10 100644 --- a/cmake/sherpa-onnx-shared.pc.in +++ b/cmake/sherpa-onnx-shared.pc.in @@ -1,3 +1,12 @@ +# Note: If you use Python, then the prefix might not be correct. +# +# You need to either manually modify this file to change the prefix to the location +# where this sherpa-onnx.pc file actually resides +# or +# you can use +# +# pkg-config --define-variable=prefix=/path/to/the/dir/containing/this/file --cflags sherpa-onnx + prefix="@CMAKE_INSTALL_PREFIX@" exec_prefix="${prefix}" includedir="${prefix}/include" diff --git a/cmake/sherpa-onnx-static-no-tts.pc.in b/cmake/sherpa-onnx-static-no-tts.pc.in index 0b020e43c..f100cd95b 100644 --- a/cmake/sherpa-onnx-static-no-tts.pc.in +++ b/cmake/sherpa-onnx-static-no-tts.pc.in @@ -1,3 +1,12 @@ +# Note: If you use Python, then the prefix might not be correct. +# +# You need to either manually modify this file to change the prefix to the location +# where this sherpa-onnx.pc file actually resides +# or +# you can use +# +# pkg-config --define-variable=prefix=/path/to/the/dir/containing/this/file --cflags sherpa-onnx + prefix="@CMAKE_INSTALL_PREFIX@" exec_prefix="${prefix}" includedir="${prefix}/include" diff --git a/cmake/sherpa-onnx-static.pc.in b/cmake/sherpa-onnx-static.pc.in index 87b929a44..1f788b002 100644 --- a/cmake/sherpa-onnx-static.pc.in +++ b/cmake/sherpa-onnx-static.pc.in @@ -1,3 +1,12 @@ +# Note: If you use Python, then the prefix might not be correct. +# +# You need to either manually modify this file to change the prefix to the location +# where this sherpa-onnx.pc file actually resides +# or +# you can use +# +# pkg-config --define-variable=prefix=/path/to/the/dir/containing/this/file --cflags sherpa-onnx + prefix="@CMAKE_INSTALL_PREFIX@" exec_prefix="${prefix}" includedir="${prefix}/include" From 2da535d72d4bc2a301e6b190211c2ea6f5e4b49a Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 11:33:10 +0800 Subject: [PATCH 36/54] fix dot net test --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8c5b7d0..efef2dfa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(sherpa-onnx) # ./nodejs-addon-examples # ./dart-api-examples/ # ./sherpa-onnx/flutter/CHANGELOG.md -set(SHERPA_ONNX_VERSION "1.10.10") +set(SHERPA_ONNX_VERSION "1.10.9") # Disable warning about # From 7fe757efc70e7c0654503e5a337a6ba7d5dda877 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 11:51:28 +0800 Subject: [PATCH 37/54] test dart for windows --- .github/workflows/test-dart-package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-dart-package.yaml b/.github/workflows/test-dart-package.yaml index 4721f4a77..6e5726da1 100644 --- a/.github/workflows/test-dart-package.yaml +++ b/.github/workflows/test-dart-package.yaml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest] #, windows-latest] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 From bf41da3d1ad4ed5712a1e5627b2e4f592a89d0d1 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 12:03:46 +0800 Subject: [PATCH 38/54] minor fixes --- .github/scripts/test-dart.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/scripts/test-dart.sh b/.github/scripts/test-dart.sh index b0be657a7..711aa631f 100755 --- a/.github/scripts/test-dart.sh +++ b/.github/scripts/test-dart.sh @@ -6,17 +6,6 @@ cd dart-api-examples pushd non-streaming-asr -echo '----------paraformer itn----------' -./run-paraformer-itn.sh - -echo '----------paraformer----------' -./run-paraformer.sh -rm -rf sherpa-onnx-* - -echo '----------VAD with paraformer----------' -./run-vad-with-paraformer.sh -rm -rf sherpa-onnx-* - echo '----------NeMo transducer----------' ./run-nemo-transducer.sh rm -rf sherpa-onnx-* @@ -37,6 +26,17 @@ echo '----------zipformer transducer----------' ./run-zipformer-transducer.sh rm -rf sherpa-onnx-* +echo '----------paraformer itn----------' +./run-paraformer-itn.sh + +echo '----------paraformer----------' +./run-paraformer.sh +rm -rf sherpa-onnx-* + +echo '----------VAD with paraformer----------' +./run-vad-with-paraformer.sh +rm -rf sherpa-onnx-* + popd # non-streaming-asr pushd tts From 4c11709be23e9fd1cd464bc36681edd1cebe678b Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 12:19:23 +0800 Subject: [PATCH 39/54] fix releasing windows --- scripts/go/_internal/build_linux_arm.go | 6 +++++ scripts/go/_internal/build_linux_arm64.go | 6 +++++ scripts/go/_internal/build_windows_386.go | 6 +++++ scripts/go/release.sh | 30 +++++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 scripts/go/_internal/build_linux_arm.go create mode 100644 scripts/go/_internal/build_linux_arm64.go create mode 100644 scripts/go/_internal/build_windows_386.go diff --git a/scripts/go/_internal/build_linux_arm.go b/scripts/go/_internal/build_linux_arm.go new file mode 100644 index 000000000..acf6d1186 --- /dev/null +++ b/scripts/go/_internal/build_linux_arm.go @@ -0,0 +1,6 @@ +//go:build linux && arm && !arm7 + +package sherpa_onnx + +// #cgo LDFLAGS: -L ${SRCDIR}/lib/arm-unknown-linux-gnueabihf -lsherpa-onnx-c-api -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/arm-unknown-linux-gnueabihf +import "C" diff --git a/scripts/go/_internal/build_linux_arm64.go b/scripts/go/_internal/build_linux_arm64.go new file mode 100644 index 000000000..0bcb60b86 --- /dev/null +++ b/scripts/go/_internal/build_linux_arm64.go @@ -0,0 +1,6 @@ +//go:build linux && arm64 + +package sherpa_onnx + +// #cgo LDFLAGS: -L ${SRCDIR}/lib/aarch64-unknown-linux-gnu -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-native-fbank-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -lssentencepiece_core -Wl,-rpath,${SRCDIR}/lib/aarch64-unknown-linux-gnu +import "C" diff --git a/scripts/go/_internal/build_windows_386.go b/scripts/go/_internal/build_windows_386.go new file mode 100644 index 000000000..89d589c64 --- /dev/null +++ b/scripts/go/_internal/build_windows_386.go @@ -0,0 +1,6 @@ +//go:build windows && 386 + +package sherpa_onnx + +// #cgo LDFLAGS: -L ${SRCDIR}/lib/i686-pc-windows-gnu -lsherpa-onnx-c-api -lonnxruntime +import "C" diff --git a/scripts/go/release.sh b/scripts/go/release.sh index d46eb1cf7..0834c40e2 100755 --- a/scripts/go/release.sh +++ b/scripts/go/release.sh @@ -17,8 +17,11 @@ echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" function linux() { echo "Process linux" git clone git@github.com:k2-fsa/sherpa-onnx-go-linux.git + rm -v ./sherpa-onnx-go-linux/*.go + cp -v ./sherpa_onnx.go ./sherpa-onnx-go-linux/ cp -v ./_internal/c-api.h ./sherpa-onnx-go-linux/ + cp -v ./_internal/build_linux_*.go ./sherpa-onnx-go-linux/ rm -rf sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu/lib* dst=$(realpath sherpa-onnx-go-linux/lib/x86_64-unknown-linux-gnu) @@ -29,6 +32,11 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst + pushd $dst + rm -v libonnxruntime.so + ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + popd + cd .. rm -rf t @@ -41,6 +49,11 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst + pushd $dst + rm -v libonnxruntime.so + ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + popd + cd .. rm -rf t @@ -53,6 +66,11 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst + pushd $dst + rm libonnxruntime.so + ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + popd + cd .. rm -rf t @@ -73,6 +91,7 @@ function osx() { git clone git@github.com:k2-fsa/sherpa-onnx-go-macos.git cp -v ./sherpa_onnx.go ./sherpa-onnx-go-macos/ cp -v ./_internal/c-api.h ./sherpa-onnx-go-macos/ + cp -v ./_internal/build_darwin_*.go ./sherpa-onnx-go-macos/ rm -rf sherpa-onnx-go-macos/lib/x86_64-apple-darwin/lib* dst=$(realpath sherpa-onnx-go-macos/lib/x86_64-apple-darwin/) @@ -84,6 +103,11 @@ function osx() { cp -v sherpa_onnx/lib/*.dylib $dst/ + pushd $dst + rm -v libonnxruntime.dylib + ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib + popd + cd .. rm -rf t @@ -98,6 +122,11 @@ function osx() { cp -v sherpa_onnx/lib/*.dylib $dst/ + pushd $dst + rm -v libonnxruntime.dylib + ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib + popd + cd .. rm -rf t echo "------------------------------" @@ -117,6 +146,7 @@ function windows() { git clone git@github.com:k2-fsa/sherpa-onnx-go-windows.git cp -v ./sherpa_onnx.go ./sherpa-onnx-go-windows/ cp -v ./_internal/c-api.h ./sherpa-onnx-go-windows/ + cp -v ./_internal/build_windows_*.go ./sherpa-onnx-go-windows/ rm -fv sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu/* dst=$(realpath sherpa-onnx-go-windows/lib/x86_64-pc-windows-gnu) From 95cfa1baa27efb08aa1108ccd8ce914c8718a7e2 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 12:24:35 +0800 Subject: [PATCH 40/54] fix releasing go --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efef2dfa7..5c8c5b7d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(sherpa-onnx) # ./nodejs-addon-examples # ./dart-api-examples/ # ./sherpa-onnx/flutter/CHANGELOG.md -set(SHERPA_ONNX_VERSION "1.10.9") +set(SHERPA_ONNX_VERSION "1.10.10") # Disable warning about # From 55bc14de0acedad3f515c4f0d0843c415c07267e Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 12:25:56 +0800 Subject: [PATCH 41/54] fix go --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8c5b7d0..efef2dfa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(sherpa-onnx) # ./nodejs-addon-examples # ./dart-api-examples/ # ./sherpa-onnx/flutter/CHANGELOG.md -set(SHERPA_ONNX_VERSION "1.10.10") +set(SHERPA_ONNX_VERSION "1.10.9") # Disable warning about # From 712d4f6923e69a5a74055b3386b4cf756fdff3b8 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 12:29:19 +0800 Subject: [PATCH 42/54] fix go --- scripts/go/release.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/go/release.sh b/scripts/go/release.sh index 0834c40e2..eb040f882 100755 --- a/scripts/go/release.sh +++ b/scripts/go/release.sh @@ -33,7 +33,6 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst pushd $dst - rm -v libonnxruntime.so ln -s libonnxruntime.so.1.17.1 libonnxruntime.so popd @@ -50,7 +49,6 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst pushd $dst - rm -v libonnxruntime.so ln -s libonnxruntime.so.1.17.1 libonnxruntime.so popd @@ -67,7 +65,6 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst pushd $dst - rm libonnxruntime.so ln -s libonnxruntime.so.1.17.1 libonnxruntime.so popd @@ -104,7 +101,6 @@ function osx() { cp -v sherpa_onnx/lib/*.dylib $dst/ pushd $dst - rm -v libonnxruntime.dylib ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib popd @@ -123,7 +119,6 @@ function osx() { cp -v sherpa_onnx/lib/*.dylib $dst/ pushd $dst - rm -v libonnxruntime.dylib ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib popd From 53e1a16b7326e0681bf0721600150776497451bc Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 13:58:59 +0800 Subject: [PATCH 43/54] update go ci --- .github/workflows/test-go-package.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-go-package.yaml b/.github/workflows/test-go-package.yaml index 79cf17e44..8401f7801 100644 --- a/.github/workflows/test-go-package.yaml +++ b/.github/workflows/test-go-package.yaml @@ -26,8 +26,10 @@ jobs: include: - os: ubuntu-latest arch: amd64 - - os: macos-latest + - os: macos-13 arch: amd64 + - os: macos-14 + arch: arm64 - os: windows-latest arch: x64 - os: windows-latest From d8f4c980936b0d323d1153d7be14f8b7cf180135 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 14:05:22 +0800 Subject: [PATCH 44/54] fix relesaing go --- scripts/go/release.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/go/release.sh b/scripts/go/release.sh index eb040f882..5c8a0a0fc 100755 --- a/scripts/go/release.sh +++ b/scripts/go/release.sh @@ -86,6 +86,7 @@ function linux() { function osx() { echo "Process osx-x64" git clone git@github.com:k2-fsa/sherpa-onnx-go-macos.git + rm -v ./sherpa-onnx-go-macos/*.go cp -v ./sherpa_onnx.go ./sherpa-onnx-go-macos/ cp -v ./_internal/c-api.h ./sherpa-onnx-go-macos/ cp -v ./_internal/build_darwin_*.go ./sherpa-onnx-go-macos/ @@ -139,6 +140,7 @@ function osx() { function windows() { echo "Process windows" git clone git@github.com:k2-fsa/sherpa-onnx-go-windows.git + rm -v ./sherpa-onnx-go-windows/*.go cp -v ./sherpa_onnx.go ./sherpa-onnx-go-windows/ cp -v ./_internal/c-api.h ./sherpa-onnx-go-windows/ cp -v ./_internal/build_windows_*.go ./sherpa-onnx-go-windows/ From 7e07ae4b04974612f30781f47316919b9e0c9521 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 15:07:01 +0800 Subject: [PATCH 45/54] disable testing dart for windows --- .github/workflows/test-dart-package.yaml | 2 +- .github/workflows/test-dart.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-dart-package.yaml b/.github/workflows/test-dart-package.yaml index 6e5726da1..4721f4a77 100644 --- a/.github/workflows/test-dart-package.yaml +++ b/.github/workflows/test-dart-package.yaml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest, ubuntu-latest] #, windows-latest] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-dart.yaml b/.github/workflows/test-dart.yaml index c9b64198d..fa4ee5ba5 100644 --- a/.github/workflows/test-dart.yaml +++ b/.github/workflows/test-dart.yaml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest] #, windows-latest] steps: - uses: actions/checkout@v4 From 4bca931abcee9a5bdf3a56df457b776baf2c73fa Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 15:34:43 +0800 Subject: [PATCH 46/54] upload built libs --- .github/workflows/test-go.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 55f750db3..23e149fc4 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -67,6 +67,10 @@ jobs: - name: Build sherpa-onnx shell: bash run: | + upload_dir=$PWD/to-upload + mkdir -p $upload_dir + echo "upload_dir" + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" mkdir build cd build @@ -86,6 +90,8 @@ jobs: fi if [[ ${{ matrix.os }} == ubuntu-latest ]]; then + cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* $upload_dir + cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* ./lib/ rm -v ./lib/libonnxruntime.so @@ -105,7 +111,10 @@ jobs: cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/non-streaming-decode-files/ cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll ../scripts/go/_internal/streaming-decode-files/ + cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll $upload_dir else + cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib $upload_dir/ + cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ rm ./lib/*.a rm ./lib/libonnxruntime.dylib @@ -123,6 +132,11 @@ jobs: go mod tidy go build + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-${{ matrix.arch }} + path: to-upload/ + - name: Test speaker identification shell: bash run: | From dc5c58213555c95001689acdde8b0afcf699e2fa Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 15:55:56 +0800 Subject: [PATCH 47/54] fix copy files --- .github/workflows/test-go.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 23e149fc4..f7bfe510b 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -90,6 +90,7 @@ jobs: fi if [[ ${{ matrix.os }} == ubuntu-latest ]]; then + cp -v ./lib/*.so $upload_dir cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* $upload_dir cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* ./lib/ @@ -114,6 +115,7 @@ jobs: cp -v ../scripts/go/_internal/lib/x86_64-pc-windows-gnu/*.dll $upload_dir else cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib $upload_dir/ + cp -v lib/*.dylib $upload_dir cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ rm ./lib/*.a @@ -134,7 +136,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }}-${{ matrix.arch }} + name: ${{ matrix.os }}-libs path: to-upload/ - name: Test speaker identification From 6d6a04be5e150fae6e99637b5bc5b6d54c8c9fc2 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:00:06 +0800 Subject: [PATCH 48/54] fix install python --- .github/workflows/run-python-test-macos.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-python-test-macos.yaml b/.github/workflows/run-python-test-macos.yaml index 23905acdd..fdab4d4d5 100644 --- a/.github/workflows/run-python-test-macos.yaml +++ b/.github/workflows/run-python-test-macos.yaml @@ -87,7 +87,7 @@ jobs: export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" cmake --version - python3 setup.py install + python3 -m pip install . - name: Test sherpa-onnx shell: bash From f97dbca7dfcea15e5625b4229aa0d960190bd117 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:01:09 +0800 Subject: [PATCH 49/54] fix building for linux arm32 and arm64 --- sherpa-onnx/csrc/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index 32cf99e0b..ce94b5111 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -222,6 +222,11 @@ if(SHERPA_ONNX_ENABLE_CHECK) endif() endif() +if(NOT BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL Linux) + # This is for linux arm32 and arm64 + target_link_libraries(sherpa-onnx-core -ldl) +endif() + if(NOT WIN32 AND NOT SHERPA_ONNX_ENABLE_WASM AND CMAKE_SYSTEM_NAME STREQUAL Linux) target_link_libraries(sherpa-onnx-core -pthread) endif() From 27b3ec79ad71fb994652281d498892fe6306e2ad Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:05:35 +0800 Subject: [PATCH 50/54] fix python tests --- .github/workflows/run-python-test-macos.yaml | 2 +- .github/workflows/test-python-offline-websocket-server.yaml | 4 ++-- .github/workflows/test-python-online-websocket-server.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-python-test-macos.yaml b/.github/workflows/run-python-test-macos.yaml index fdab4d4d5..ed51379d2 100644 --- a/.github/workflows/run-python-test-macos.yaml +++ b/.github/workflows/run-python-test-macos.yaml @@ -78,7 +78,7 @@ jobs: - name: Install Python dependencies shell: bash run: | - python3 -m pip install --upgrade pip numpy pypinyin sentencepiece>=0.1.96 soundfile + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece>=0.1.96 soundfile setuptools wheel - name: Install sherpa-onnx shell: bash diff --git a/.github/workflows/test-python-offline-websocket-server.yaml b/.github/workflows/test-python-offline-websocket-server.yaml index a1d3124c5..ab63b2683 100644 --- a/.github/workflows/test-python-offline-websocket-server.yaml +++ b/.github/workflows/test-python-offline-websocket-server.yaml @@ -57,7 +57,7 @@ jobs: - name: Install Python dependencies shell: bash run: | - python3 -m pip install --upgrade pip numpy pypinyin sentencepiece + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece setuptools wheel - name: Install sherpa-onnx shell: bash @@ -66,7 +66,7 @@ jobs: export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" cmake --version - python3 setup.py install + python3 -m pip install . python3 -m pip install websockets - name: Start server for transducer models diff --git a/.github/workflows/test-python-online-websocket-server.yaml b/.github/workflows/test-python-online-websocket-server.yaml index 2084d5401..84bcc46a2 100644 --- a/.github/workflows/test-python-online-websocket-server.yaml +++ b/.github/workflows/test-python-online-websocket-server.yaml @@ -66,7 +66,7 @@ jobs: export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" cmake --version - python3 setup.py install + python3 -m pip install . python3 -m pip install websockets - name: Start server for zipformer2 CTC models From 09a997fd91cc68ba5eb6c0651dcb07c225af0cb0 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:12:18 +0800 Subject: [PATCH 51/54] fix installing portaudio --- cmake/portaudio.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/portaudio.cmake b/cmake/portaudio.cmake index de05f4a9b..d8af8d49b 100644 --- a/cmake/portaudio.cmake +++ b/cmake/portaudio.cmake @@ -55,6 +55,13 @@ function(download_portaudio) if(NOT WIN32) target_compile_options(portaudio_static PRIVATE "-Wno-deprecated-declarations") endif() + + if(NOT BUILD_SHARED_LIBS AND SHERPA_ONNX_ENABLE_BINARY) + install(TARGETS + portaudio_static + DESTINATION lib) + endif() + endfunction() download_portaudio() From f5c0bf69ad575f248a1303987ca738e2131666f4 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:18:06 +0800 Subject: [PATCH 52/54] fix python tests --- .github/workflows/test-python-online-websocket-server.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-python-online-websocket-server.yaml b/.github/workflows/test-python-online-websocket-server.yaml index 84bcc46a2..badf343a0 100644 --- a/.github/workflows/test-python-online-websocket-server.yaml +++ b/.github/workflows/test-python-online-websocket-server.yaml @@ -57,7 +57,7 @@ jobs: - name: Install Python dependencies shell: bash run: | - python3 -m pip install --upgrade pip numpy pypinyin sentencepiece + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece setuptools wheel - name: Install sherpa-onnx shell: bash From 257a514d4a52ed5974864ed374a37bca9904c929 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:24:55 +0800 Subject: [PATCH 53/54] release v1.10.10 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efef2dfa7..5c8c5b7d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(sherpa-onnx) # ./nodejs-addon-examples # ./dart-api-examples/ # ./sherpa-onnx/flutter/CHANGELOG.md -set(SHERPA_ONNX_VERSION "1.10.9") +set(SHERPA_ONNX_VERSION "1.10.10") # Disable warning about # From 4bec77e0dadcef8e12073aff665363ddadb50363 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sat, 6 Jul 2024 16:40:24 +0800 Subject: [PATCH 54/54] fix releasing go packages --- scripts/go/release.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/go/release.sh b/scripts/go/release.sh index 5c8a0a0fc..10ae9f71a 100755 --- a/scripts/go/release.sh +++ b/scripts/go/release.sh @@ -33,7 +33,7 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst pushd $dst - ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + cp -v libonnxruntime.so.1.17.1 libonnxruntime.so popd cd .. @@ -49,7 +49,7 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst pushd $dst - ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + cp -v libonnxruntime.so.1.17.1 libonnxruntime.so popd cd .. @@ -65,7 +65,7 @@ function linux() { cp -v sherpa_onnx/lib/*.so* $dst pushd $dst - ln -s libonnxruntime.so.1.17.1 libonnxruntime.so + cp -v libonnxruntime.so.1.17.1 libonnxruntime.so popd cd .. @@ -102,7 +102,7 @@ function osx() { cp -v sherpa_onnx/lib/*.dylib $dst/ pushd $dst - ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib + cp -v libonnxruntime.1.17.1.dylib libonnxruntime.dylib popd cd .. @@ -120,7 +120,7 @@ function osx() { cp -v sherpa_onnx/lib/*.dylib $dst/ pushd $dst - ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib + cp -v libonnxruntime.1.17.1.dylib libonnxruntime.dylib popd cd ..