2022-10-12 11:27:05 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR})
|
2022-10-12 21:35:07 +08:00
|
|
|
|
2023-04-04 15:45:59 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_PYTHON)
|
|
|
|
|
message(STATUS "PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
|
|
|
|
|
execute_process(
|
|
|
|
|
COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; print('.'.join(sys.version.split('.')[:2]))"
|
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
|
OUTPUT_VARIABLE PYTHON_VERSION
|
|
|
|
|
)
|
|
|
|
|
message(STATUS "PYTHON_VERSION: ${PYTHON_VERSION}")
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-02-22 15:35:55 +08:00
|
|
|
set(sources
|
2023-08-07 12:34:18 +08:00
|
|
|
base64-decode.cc
|
2023-02-21 20:00:03 +08:00
|
|
|
cat.cc
|
2023-09-17 14:54:38 +08:00
|
|
|
circular-buffer.cc
|
2023-06-16 14:26:36 +08:00
|
|
|
context-graph.cc
|
2023-02-22 15:35:55 +08:00
|
|
|
endpoint.cc
|
2023-02-18 21:35:15 +08:00
|
|
|
features.cc
|
2023-02-24 21:39:51 +08:00
|
|
|
file-utils.cc
|
2024-10-24 11:15:08 +08:00
|
|
|
fst-utils.cc
|
2023-03-01 15:32:54 +08:00
|
|
|
hypothesis.cc
|
2024-01-20 22:52:41 +08:00
|
|
|
keyword-spotter-impl.cc
|
|
|
|
|
keyword-spotter.cc
|
2023-10-08 11:32:39 +08:00
|
|
|
offline-ctc-fst-decoder-config.cc
|
|
|
|
|
offline-ctc-fst-decoder.cc
|
2023-04-07 23:11:34 +08:00
|
|
|
offline-ctc-greedy-search-decoder.cc
|
|
|
|
|
offline-ctc-model.cc
|
2023-04-23 17:15:18 +08:00
|
|
|
offline-lm-config.cc
|
|
|
|
|
offline-lm.cc
|
2023-03-28 17:59:54 +08:00
|
|
|
offline-model-config.cc
|
2024-10-26 14:34:07 +08:00
|
|
|
offline-moonshine-greedy-search-decoder.cc
|
|
|
|
|
offline-moonshine-model-config.cc
|
|
|
|
|
offline-moonshine-model.cc
|
2023-04-07 23:11:34 +08:00
|
|
|
offline-nemo-enc-dec-ctc-model-config.cc
|
|
|
|
|
offline-nemo-enc-dec-ctc-model.cc
|
2023-03-28 17:59:54 +08:00
|
|
|
offline-paraformer-greedy-search-decoder.cc
|
|
|
|
|
offline-paraformer-model-config.cc
|
|
|
|
|
offline-paraformer-model.cc
|
2023-03-27 14:59:40 +08:00
|
|
|
offline-recognizer-impl.cc
|
|
|
|
|
offline-recognizer.cc
|
2023-04-23 17:15:18 +08:00
|
|
|
offline-rnn-lm.cc
|
2024-07-18 22:54:18 +08:00
|
|
|
offline-sense-voice-model-config.cc
|
|
|
|
|
offline-sense-voice-model.cc
|
2023-03-26 08:53:42 +08:00
|
|
|
offline-stream.cc
|
2023-08-12 19:50:22 +08:00
|
|
|
offline-tdnn-ctc-model.cc
|
|
|
|
|
offline-tdnn-model-config.cc
|
2024-06-05 00:26:40 +08:00
|
|
|
offline-telespeech-ctc-model.cc
|
2023-03-26 08:53:42 +08:00
|
|
|
offline-transducer-greedy-search-decoder.cc
|
2024-05-10 12:15:39 +08:00
|
|
|
offline-transducer-greedy-search-nemo-decoder.cc
|
2023-03-26 08:53:42 +08:00
|
|
|
offline-transducer-model-config.cc
|
|
|
|
|
offline-transducer-model.cc
|
2023-04-23 17:15:18 +08:00
|
|
|
offline-transducer-modified-beam-search-decoder.cc
|
2024-05-10 12:15:39 +08:00
|
|
|
offline-transducer-nemo-model.cc
|
2023-11-15 14:23:20 +08:00
|
|
|
offline-wenet-ctc-model-config.cc
|
|
|
|
|
offline-wenet-ctc-model.cc
|
2023-08-07 12:34:18 +08:00
|
|
|
offline-whisper-greedy-search-decoder.cc
|
|
|
|
|
offline-whisper-model-config.cc
|
|
|
|
|
offline-whisper-model.cc
|
2023-10-08 11:32:39 +08:00
|
|
|
offline-zipformer-ctc-model-config.cc
|
|
|
|
|
offline-zipformer-ctc-model.cc
|
2023-05-10 23:30:39 -07:00
|
|
|
online-conformer-transducer-model.cc
|
2024-04-03 21:31:42 +08:00
|
|
|
online-ctc-fst-decoder-config.cc
|
|
|
|
|
online-ctc-fst-decoder.cc
|
2023-11-16 10:35:23 +08:00
|
|
|
online-ctc-greedy-search-decoder.cc
|
|
|
|
|
online-ctc-model.cc
|
2023-04-23 17:15:18 +08:00
|
|
|
online-lm-config.cc
|
2023-05-12 15:57:44 +08:00
|
|
|
online-lm.cc
|
2023-02-18 21:35:15 +08:00
|
|
|
online-lstm-transducer-model.cc
|
2023-08-09 20:27:31 +08:00
|
|
|
online-model-config.cc
|
2024-05-10 16:26:43 +08:00
|
|
|
online-nemo-ctc-model-config.cc
|
|
|
|
|
online-nemo-ctc-model.cc
|
2023-08-14 10:32:14 +08:00
|
|
|
online-paraformer-model-config.cc
|
|
|
|
|
online-paraformer-model.cc
|
2023-08-09 20:27:31 +08:00
|
|
|
online-recognizer-impl.cc
|
2023-02-19 12:45:38 +08:00
|
|
|
online-recognizer.cc
|
2023-05-05 21:23:54 +08:00
|
|
|
online-rnn-lm.cc
|
2023-02-19 11:42:15 +08:00
|
|
|
online-stream.cc
|
2023-03-03 12:10:59 +08:00
|
|
|
online-transducer-decoder.cc
|
2023-02-19 10:39:07 +08:00
|
|
|
online-transducer-greedy-search-decoder.cc
|
2023-02-18 21:35:15 +08:00
|
|
|
online-transducer-model-config.cc
|
|
|
|
|
online-transducer-model.cc
|
2023-03-03 12:10:59 +08:00
|
|
|
online-transducer-modified-beam-search-decoder.cc
|
2024-05-30 07:55:03 +02:00
|
|
|
online-transducer-nemo-model.cc
|
|
|
|
|
online-transducer-greedy-search-nemo-decoder.cc
|
2023-11-16 10:35:23 +08:00
|
|
|
online-wenet-ctc-model-config.cc
|
|
|
|
|
online-wenet-ctc-model.cc
|
2023-02-21 20:00:03 +08:00
|
|
|
online-zipformer-transducer-model.cc
|
2023-12-22 13:46:33 +08:00
|
|
|
online-zipformer2-ctc-model-config.cc
|
|
|
|
|
online-zipformer2-ctc-model.cc
|
2023-06-26 11:09:43 +08:00
|
|
|
online-zipformer2-transducer-model.cc
|
2023-02-18 21:35:15 +08:00
|
|
|
onnx-utils.cc
|
2023-03-08 14:12:20 +08:00
|
|
|
packed-sequence.cc
|
2023-03-05 22:02:50 +08:00
|
|
|
pad-sequence.cc
|
2023-02-22 15:35:55 +08:00
|
|
|
parse-options.cc
|
2024-07-05 12:48:37 +05:30
|
|
|
provider-config.cc
|
2023-05-12 15:57:44 +08:00
|
|
|
provider.cc
|
2023-02-21 22:04:21 +08:00
|
|
|
resample.cc
|
2023-08-07 12:34:18 +08:00
|
|
|
session.cc
|
2023-09-17 14:54:38 +08:00
|
|
|
silero-vad-model-config.cc
|
|
|
|
|
silero-vad-model.cc
|
2023-03-05 19:18:31 +08:00
|
|
|
slice.cc
|
2024-03-24 22:57:00 +08:00
|
|
|
spoken-language-identification-impl.cc
|
|
|
|
|
spoken-language-identification.cc
|
2023-05-10 23:30:39 -07:00
|
|
|
stack.cc
|
2022-10-12 21:35:07 +08:00
|
|
|
symbol-table.cc
|
2023-02-21 20:00:03 +08:00
|
|
|
text-utils.cc
|
2024-01-20 22:52:41 +08:00
|
|
|
transducer-keyword-decoder.cc
|
2023-03-05 11:27:17 +08:00
|
|
|
transpose.cc
|
2023-02-21 20:00:03 +08:00
|
|
|
unbind.cc
|
2023-09-14 19:33:17 +08:00
|
|
|
utils.cc
|
2023-09-17 14:54:38 +08:00
|
|
|
vad-model-config.cc
|
|
|
|
|
vad-model.cc
|
|
|
|
|
voice-activity-detector.cc
|
2022-10-12 21:35:07 +08:00
|
|
|
wave-reader.cc
|
2024-03-26 17:21:35 +08:00
|
|
|
wave-writer.cc
|
2022-10-12 21:35:07 +08:00
|
|
|
)
|
2022-09-23 08:46:25 +03:00
|
|
|
|
2024-01-09 22:06:08 +08:00
|
|
|
# speaker embedding extractor
|
|
|
|
|
list(APPEND sources
|
|
|
|
|
speaker-embedding-extractor-impl.cc
|
2024-01-11 19:10:30 +08:00
|
|
|
speaker-embedding-extractor-model.cc
|
2024-01-13 21:42:09 +08:00
|
|
|
speaker-embedding-extractor-nemo-model.cc
|
2024-01-09 22:06:08 +08:00
|
|
|
speaker-embedding-extractor.cc
|
|
|
|
|
speaker-embedding-manager.cc
|
|
|
|
|
)
|
|
|
|
|
|
2024-04-10 14:47:06 +08:00
|
|
|
# audio tagging
|
|
|
|
|
list(APPEND sources
|
|
|
|
|
audio-tagging-impl.cc
|
|
|
|
|
audio-tagging-label-file.cc
|
|
|
|
|
audio-tagging-model-config.cc
|
|
|
|
|
audio-tagging.cc
|
2024-04-19 15:20:37 +08:00
|
|
|
offline-ced-model.cc
|
2024-04-10 14:47:06 +08:00
|
|
|
offline-zipformer-audio-tagging-model-config.cc
|
|
|
|
|
offline-zipformer-audio-tagging-model.cc
|
|
|
|
|
)
|
|
|
|
|
|
2024-04-13 12:15:57 +08:00
|
|
|
# punctuation
|
|
|
|
|
list(APPEND sources
|
|
|
|
|
offline-ct-transformer-model.cc
|
|
|
|
|
offline-punctuation-impl.cc
|
|
|
|
|
offline-punctuation-model-config.cc
|
|
|
|
|
offline-punctuation.cc
|
2024-08-06 17:33:38 +08:00
|
|
|
online-cnn-bilstm-model.cc
|
|
|
|
|
online-punctuation-impl.cc
|
|
|
|
|
online-punctuation-model-config.cc
|
|
|
|
|
online-punctuation.cc
|
2024-04-13 12:15:57 +08:00
|
|
|
)
|
|
|
|
|
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
list(APPEND sources
|
2024-04-21 14:47:13 +08:00
|
|
|
jieba-lexicon.cc
|
2024-03-26 17:21:35 +08:00
|
|
|
lexicon.cc
|
2024-07-16 15:55:02 +08:00
|
|
|
melo-tts-lexicon.cc
|
2024-03-26 17:21:35 +08:00
|
|
|
offline-tts-character-frontend.cc
|
2024-07-16 15:55:02 +08:00
|
|
|
offline-tts-frontend.cc
|
2024-03-26 17:21:35 +08:00
|
|
|
offline-tts-impl.cc
|
|
|
|
|
offline-tts-model-config.cc
|
|
|
|
|
offline-tts-vits-model-config.cc
|
|
|
|
|
offline-tts-vits-model.cc
|
|
|
|
|
offline-tts.cc
|
|
|
|
|
piper-phonemize-lexicon.cc
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-10-13 19:30:38 +08:00
|
|
|
|
2024-09-29 23:44:29 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_SPEAKER_DIARIZATION)
|
|
|
|
|
list(APPEND sources
|
|
|
|
|
fast-clustering-config.cc
|
|
|
|
|
fast-clustering.cc
|
2024-10-09 12:01:20 +08:00
|
|
|
offline-speaker-diarization-impl.cc
|
|
|
|
|
offline-speaker-diarization-result.cc
|
|
|
|
|
offline-speaker-diarization.cc
|
|
|
|
|
offline-speaker-segmentation-model-config.cc
|
|
|
|
|
offline-speaker-segmentation-pyannote-model-config.cc
|
|
|
|
|
offline-speaker-segmentation-pyannote-model.cc
|
2024-09-29 23:44:29 +08:00
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-02-22 15:35:55 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_CHECK)
|
|
|
|
|
list(APPEND sources log.cc)
|
|
|
|
|
endif()
|
2024-07-06 16:41:54 +08:00
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-28 19:12:58 +08:00
|
|
|
if(APPLE)
|
|
|
|
|
target_compile_options(sherpa-onnx-core PRIVATE
|
|
|
|
|
-Wno-deprecated-declarations
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-02-22 15:35:55 +08:00
|
|
|
|
2023-02-22 22:36:05 +08:00
|
|
|
if(ANDROID_NDK)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core android log)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-03-26 17:21:35 +08:00
|
|
|
target_link_libraries(sherpa-onnx-core
|
|
|
|
|
kaldi-native-fbank-core
|
|
|
|
|
kaldi-decoder-core
|
2024-05-20 19:41:36 +08:00
|
|
|
ssentencepiece_core
|
2024-03-26 17:21:35 +08:00
|
|
|
)
|
2024-11-24 16:29:24 +08:00
|
|
|
if(DEFINED OHOS AND x${OHOS} STREQUAL xOHOS)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core
|
|
|
|
|
hilog_ndk.z
|
|
|
|
|
rawfile.z
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-07-13 14:52:43 +08:00
|
|
|
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_GPU)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core
|
|
|
|
|
onnxruntime_providers_shared
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-10-08 11:32:39 +08:00
|
|
|
|
2024-11-08 21:07:36 +08:00
|
|
|
if(BUILD_SHARED_LIBS AND NOT DEFINED onnxruntime_lib_files)
|
2023-07-13 14:52:43 +08:00
|
|
|
target_link_libraries(sherpa-onnx-core onnxruntime)
|
|
|
|
|
else()
|
|
|
|
|
target_link_libraries(sherpa-onnx-core ${onnxruntime_lib_files})
|
|
|
|
|
endif()
|
2022-10-12 21:35:07 +08:00
|
|
|
|
2024-06-27 18:05:18 +08:00
|
|
|
if(NOT WIN32)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core -lm)
|
|
|
|
|
endif()
|
2024-02-21 15:36:54 +08:00
|
|
|
|
2023-10-31 20:24:43 +08:00
|
|
|
if(NOT BUILD_SHARED_LIBS AND APPLE)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core "-framework Foundation")
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-06-18 13:42:17 +08:00
|
|
|
target_link_libraries(sherpa-onnx-core fstfar fst)
|
|
|
|
|
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core piper_phonemize)
|
2024-04-21 14:47:13 +08:00
|
|
|
target_link_libraries(sherpa-onnx-core cppjieba)
|
2023-05-12 22:30:47 +08:00
|
|
|
endif()
|
|
|
|
|
|
2023-02-22 15:35:55 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_CHECK)
|
|
|
|
|
target_compile_definitions(sherpa-onnx-core PUBLIC SHERPA_ONNX_ENABLE_CHECK=1)
|
|
|
|
|
|
|
|
|
|
if(SHERPA_ONNX_HAVE_EXECINFO_H)
|
|
|
|
|
target_compile_definitions(sherpa-onnx-core PRIVATE SHERPA_ONNX_HAVE_EXECINFO_H=1)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(SHERPA_ONNX_HAVE_CXXABI_H)
|
|
|
|
|
target_compile_definitions(sherpa-onnx-core PRIVATE SHERPA_ONNX_HAVE_CXXABI_H=1)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-09-25 11:48:55 +08:00
|
|
|
if(NOT BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL Linux)
|
2024-07-06 16:41:54 +08:00
|
|
|
# This is for linux arm32 and arm64
|
2024-02-08 23:39:12 +08:00
|
|
|
target_link_libraries(sherpa-onnx-core -ldl)
|
2023-09-21 10:15:42 +08:00
|
|
|
endif()
|
|
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
if(NOT WIN32 AND NOT SHERPA_ONNX_ENABLE_WASM AND CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
|
target_link_libraries(sherpa-onnx-core -pthread)
|
|
|
|
|
endif()
|
2023-09-21 10:15:42 +08:00
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_BINARY)
|
|
|
|
|
add_executable(sherpa-onnx sherpa-onnx.cc)
|
|
|
|
|
add_executable(sherpa-onnx-keyword-spotter sherpa-onnx-keyword-spotter.cc)
|
|
|
|
|
add_executable(sherpa-onnx-offline sherpa-onnx-offline.cc)
|
2024-04-10 14:47:06 +08:00
|
|
|
add_executable(sherpa-onnx-offline-audio-tagging sherpa-onnx-offline-audio-tagging.cc)
|
2024-04-13 12:15:57 +08:00
|
|
|
add_executable(sherpa-onnx-offline-language-identification sherpa-onnx-offline-language-identification.cc)
|
|
|
|
|
add_executable(sherpa-onnx-offline-parallel sherpa-onnx-offline-parallel.cc)
|
|
|
|
|
add_executable(sherpa-onnx-offline-punctuation sherpa-onnx-offline-punctuation.cc)
|
2024-08-06 17:33:38 +08:00
|
|
|
add_executable(sherpa-onnx-online-punctuation sherpa-onnx-online-punctuation.cc)
|
2024-02-08 23:39:12 +08:00
|
|
|
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
add_executable(sherpa-onnx-offline-tts sherpa-onnx-offline-tts.cc)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-10-09 12:01:20 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_SPEAKER_DIARIZATION)
|
|
|
|
|
add_executable(sherpa-onnx-offline-speaker-diarization sherpa-onnx-offline-speaker-diarization.cc)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
set(main_exes
|
|
|
|
|
sherpa-onnx
|
|
|
|
|
sherpa-onnx-keyword-spotter
|
|
|
|
|
sherpa-onnx-offline
|
2024-04-10 14:47:06 +08:00
|
|
|
sherpa-onnx-offline-audio-tagging
|
2024-04-13 12:15:57 +08:00
|
|
|
sherpa-onnx-offline-language-identification
|
|
|
|
|
sherpa-onnx-offline-parallel
|
|
|
|
|
sherpa-onnx-offline-punctuation
|
2024-08-06 17:33:38 +08:00
|
|
|
sherpa-onnx-online-punctuation
|
2024-02-08 23:39:12 +08:00
|
|
|
)
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
list(APPEND main_exes
|
|
|
|
|
sherpa-onnx-offline-tts
|
|
|
|
|
)
|
2024-10-09 12:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(SHERPA_ONNX_ENABLE_SPEAKER_DIARIZATION)
|
|
|
|
|
list(APPEND main_exes
|
|
|
|
|
sherpa-onnx-offline-speaker-diarization
|
|
|
|
|
)
|
2024-03-26 17:21:35 +08:00
|
|
|
endif()
|
2023-04-04 15:45:59 +08:00
|
|
|
|
2023-12-02 15:35:11 +08:00
|
|
|
foreach(exe IN LISTS main_exes)
|
2024-02-08 23:39:12 +08:00
|
|
|
target_link_libraries(${exe} sherpa-onnx-core)
|
2023-12-02 15:35:11 +08:00
|
|
|
endforeach()
|
2024-02-08 23:39:12 +08:00
|
|
|
|
|
|
|
|
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()
|
2023-02-19 19:36:03 +08:00
|
|
|
endif()
|
|
|
|
|
|
2024-07-06 16:41:54 +08:00
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
2023-03-18 13:55:59 +08:00
|
|
|
install(TARGETS sherpa-onnx-core DESTINATION lib)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_BINARY)
|
|
|
|
|
install(
|
|
|
|
|
TARGETS
|
|
|
|
|
${main_exes}
|
|
|
|
|
DESTINATION
|
|
|
|
|
bin
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-02-21 20:00:03 +08:00
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
if(SHERPA_ONNX_HAS_ALSA AND SHERPA_ONNX_ENABLE_BINARY)
|
2023-02-21 22:04:21 +08:00
|
|
|
add_executable(sherpa-onnx-alsa sherpa-onnx-alsa.cc alsa.cc)
|
2024-02-26 21:17:26 +08:00
|
|
|
add_executable(sherpa-onnx-alsa-offline sherpa-onnx-alsa-offline.cc alsa.cc)
|
2024-04-13 12:15:57 +08:00
|
|
|
add_executable(sherpa-onnx-alsa-offline-audio-tagging sherpa-onnx-alsa-offline-audio-tagging.cc alsa.cc)
|
2024-02-23 19:27:51 +08:00
|
|
|
add_executable(sherpa-onnx-alsa-offline-speaker-identification sherpa-onnx-alsa-offline-speaker-identification.cc alsa.cc)
|
2024-04-13 12:15:57 +08:00
|
|
|
add_executable(sherpa-onnx-keyword-spotter-alsa sherpa-onnx-keyword-spotter-alsa.cc alsa.cc)
|
2024-04-08 16:41:01 +08:00
|
|
|
add_executable(sherpa-onnx-vad-alsa sherpa-onnx-vad-alsa.cc alsa.cc)
|
2023-02-21 22:04:21 +08:00
|
|
|
|
2024-03-26 17:21:35 +08:00
|
|
|
|
|
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
add_executable(sherpa-onnx-offline-tts-play-alsa sherpa-onnx-offline-tts-play-alsa.cc alsa-play.cc)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-12-13 22:28:03 +08:00
|
|
|
set(exes
|
|
|
|
|
sherpa-onnx-alsa
|
2024-02-26 21:17:26 +08:00
|
|
|
sherpa-onnx-alsa-offline
|
2024-02-23 19:27:51 +08:00
|
|
|
sherpa-onnx-alsa-offline-speaker-identification
|
2024-04-08 16:41:01 +08:00
|
|
|
sherpa-onnx-keyword-spotter-alsa
|
|
|
|
|
sherpa-onnx-vad-alsa
|
2024-04-10 21:00:35 +08:00
|
|
|
sherpa-onnx-alsa-offline-audio-tagging
|
2023-12-13 22:28:03 +08:00
|
|
|
)
|
2024-03-26 17:21:35 +08:00
|
|
|
|
|
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
list(APPEND exes
|
|
|
|
|
sherpa-onnx-offline-tts-play-alsa
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-07-06 16:41:54 +08:00
|
|
|
# # To fix the following error for Windows when building exe
|
|
|
|
|
# # mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_Dynamic Release'
|
|
|
|
|
|
2023-12-13 22:28:03 +08:00
|
|
|
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})
|
|
|
|
|
target_link_libraries(${exe} -L$ENV{SHERPA_ONNX_ALSA_LIB_DIR} -lasound)
|
|
|
|
|
else()
|
|
|
|
|
target_link_libraries(${exe} asound)
|
|
|
|
|
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()
|
2023-02-21 22:04:21 +08:00
|
|
|
endif()
|
2023-12-13 22:28:03 +08:00
|
|
|
|
|
|
|
|
install(
|
|
|
|
|
TARGETS ${exes}
|
|
|
|
|
DESTINATION
|
|
|
|
|
bin
|
|
|
|
|
)
|
2023-02-21 22:04:21 +08:00
|
|
|
endif()
|
|
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_PORTAUDIO AND SHERPA_ONNX_ENABLE_BINARY)
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
add_executable(sherpa-onnx-offline-tts-play
|
|
|
|
|
sherpa-onnx-offline-tts-play.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-12-02 15:35:11 +08:00
|
|
|
|
2024-03-01 09:31:11 +08:00
|
|
|
add_executable(sherpa-onnx-keyword-spotter-microphone
|
|
|
|
|
sherpa-onnx-keyword-spotter-microphone.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2023-02-22 17:13:07 +08:00
|
|
|
add_executable(sherpa-onnx-microphone
|
|
|
|
|
sherpa-onnx-microphone.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2023-03-30 19:43:05 +08:00
|
|
|
add_executable(sherpa-onnx-microphone-offline
|
|
|
|
|
sherpa-onnx-microphone-offline.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2023-09-17 14:54:38 +08:00
|
|
|
add_executable(sherpa-onnx-vad-microphone
|
|
|
|
|
sherpa-onnx-vad-microphone.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-11 22:54:27 +08:00
|
|
|
add_executable(sherpa-onnx-vad-microphone-offline-asr
|
|
|
|
|
sherpa-onnx-vad-microphone-offline-asr.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2024-01-30 11:21:43 +08:00
|
|
|
add_executable(sherpa-onnx-microphone-offline-speaker-identification
|
|
|
|
|
sherpa-onnx-microphone-offline-speaker-identification.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2024-04-10 21:00:35 +08:00
|
|
|
add_executable(sherpa-onnx-microphone-offline-audio-tagging
|
|
|
|
|
sherpa-onnx-microphone-offline-audio-tagging.cc
|
|
|
|
|
microphone.cc
|
|
|
|
|
)
|
|
|
|
|
|
2023-09-17 14:54:38 +08:00
|
|
|
set(exes
|
|
|
|
|
sherpa-onnx-microphone
|
2024-03-01 09:31:11 +08:00
|
|
|
sherpa-onnx-keyword-spotter-microphone
|
2023-09-17 14:54:38 +08:00
|
|
|
sherpa-onnx-microphone-offline
|
2024-01-30 11:21:43 +08:00
|
|
|
sherpa-onnx-microphone-offline-speaker-identification
|
2024-04-10 21:00:35 +08:00
|
|
|
sherpa-onnx-microphone-offline-audio-tagging
|
2023-09-17 14:54:38 +08:00
|
|
|
sherpa-onnx-vad-microphone
|
2023-11-11 22:54:27 +08:00
|
|
|
sherpa-onnx-vad-microphone-offline-asr
|
2023-09-17 14:54:38 +08:00
|
|
|
)
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
list(APPEND exes
|
|
|
|
|
sherpa-onnx-offline-tts-play
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-09-17 14:54:38 +08:00
|
|
|
foreach(exe IN LISTS exes)
|
2024-07-06 16:41:54 +08:00
|
|
|
target_link_libraries(${exe} portaudio_static sherpa-onnx-core)
|
2023-09-17 14:54:38 +08:00
|
|
|
endforeach()
|
2023-04-04 15:45:59 +08:00
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
2023-09-17 14:54:38 +08:00
|
|
|
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()
|
2023-04-04 15:45:59 +08:00
|
|
|
|
|
|
|
|
if(SHERPA_ONNX_ENABLE_PYTHON)
|
2023-09-17 14:54:38 +08:00
|
|
|
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()
|
2023-04-04 15:45:59 +08:00
|
|
|
endif()
|
|
|
|
|
endif()
|
2023-03-30 19:43:05 +08:00
|
|
|
|
|
|
|
|
install(
|
2023-09-17 14:54:38 +08:00
|
|
|
TARGETS ${exes}
|
2023-03-30 19:43:05 +08:00
|
|
|
DESTINATION
|
|
|
|
|
bin
|
|
|
|
|
)
|
2023-02-22 17:13:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
2024-02-08 23:39:12 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_WEBSOCKET AND SHERPA_ONNX_ENABLE_BINARY)
|
2023-02-24 21:39:51 +08:00
|
|
|
add_definitions(-DASIO_STANDALONE)
|
|
|
|
|
add_definitions(-D_WEBSOCKETPP_CPP11_STL_)
|
|
|
|
|
|
|
|
|
|
add_executable(sherpa-onnx-online-websocket-server
|
|
|
|
|
online-websocket-server-impl.cc
|
|
|
|
|
online-websocket-server.cc
|
|
|
|
|
)
|
|
|
|
|
target_link_libraries(sherpa-onnx-online-websocket-server sherpa-onnx-core)
|
|
|
|
|
|
|
|
|
|
add_executable(sherpa-onnx-online-websocket-client
|
|
|
|
|
online-websocket-client.cc
|
|
|
|
|
)
|
|
|
|
|
target_link_libraries(sherpa-onnx-online-websocket-client sherpa-onnx-core)
|
|
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
|
target_compile_options(sherpa-onnx-online-websocket-server PRIVATE -Wno-deprecated-declarations)
|
|
|
|
|
|
|
|
|
|
target_compile_options(sherpa-onnx-online-websocket-client PRIVATE -Wno-deprecated-declarations)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-03-29 21:48:45 +08:00
|
|
|
# For offline websocket
|
|
|
|
|
add_executable(sherpa-onnx-offline-websocket-server
|
|
|
|
|
offline-websocket-server-impl.cc
|
|
|
|
|
offline-websocket-server.cc
|
|
|
|
|
)
|
|
|
|
|
target_link_libraries(sherpa-onnx-offline-websocket-server sherpa-onnx-core)
|
|
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
|
target_compile_options(sherpa-onnx-offline-websocket-server PRIVATE -Wno-deprecated-declarations)
|
|
|
|
|
endif()
|
2023-04-04 15:45:59 +08:00
|
|
|
|
|
|
|
|
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")
|
|
|
|
|
|
2024-07-06 16:41:54 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_PYTHON AND NOT WIN32)
|
2023-04-04 15:45:59 +08:00
|
|
|
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
|
|
|
|
|
sherpa-onnx-online-websocket-client
|
|
|
|
|
sherpa-onnx-offline-websocket-server
|
|
|
|
|
DESTINATION
|
|
|
|
|
bin
|
|
|
|
|
)
|
2023-02-24 21:39:51 +08:00
|
|
|
endif()
|
|
|
|
|
|
2023-02-21 20:00:03 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TESTS)
|
|
|
|
|
set(sherpa_onnx_test_srcs
|
|
|
|
|
cat-test.cc
|
2023-09-17 14:54:38 +08:00
|
|
|
circular-buffer-test.cc
|
2023-06-16 14:26:36 +08:00
|
|
|
context-graph-test.cc
|
2023-03-08 14:12:20 +08:00
|
|
|
packed-sequence-test.cc
|
2023-03-05 22:02:50 +08:00
|
|
|
pad-sequence-test.cc
|
2023-03-05 19:18:31 +08:00
|
|
|
slice-test.cc
|
2023-05-10 23:30:39 -07:00
|
|
|
stack-test.cc
|
2024-05-20 19:41:36 +08:00
|
|
|
text2token-test.cc
|
2023-03-05 11:27:17 +08:00
|
|
|
transpose-test.cc
|
2023-02-21 20:00:03 +08:00
|
|
|
unbind-test.cc
|
2023-10-18 10:19:10 +08:00
|
|
|
utfcpp-test.cc
|
2023-02-21 20:00:03 +08:00
|
|
|
)
|
2024-03-26 17:21:35 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_TTS)
|
|
|
|
|
list(APPEND sherpa_onnx_test_srcs
|
2024-04-21 14:47:13 +08:00
|
|
|
cppjieba-test.cc
|
2024-03-26 17:21:35 +08:00
|
|
|
piper-phonemize-test.cc
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2023-02-21 20:00:03 +08:00
|
|
|
|
2024-09-29 23:44:29 +08:00
|
|
|
if(SHERPA_ONNX_ENABLE_SPEAKER_DIARIZATION)
|
|
|
|
|
list(APPEND sherpa_onnx_test_srcs
|
|
|
|
|
fast-clustering-test.cc
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-01-09 22:06:08 +08:00
|
|
|
list(APPEND sherpa_onnx_test_srcs
|
|
|
|
|
speaker-embedding-manager-test.cc
|
|
|
|
|
)
|
|
|
|
|
|
2023-02-21 20:00:03 +08:00
|
|
|
function(sherpa_onnx_add_test source)
|
|
|
|
|
get_filename_component(name ${source} NAME_WE)
|
|
|
|
|
set(target_name ${name})
|
|
|
|
|
add_executable(${target_name} "${source}")
|
|
|
|
|
|
|
|
|
|
target_link_libraries(${target_name}
|
|
|
|
|
PRIVATE
|
|
|
|
|
gtest
|
|
|
|
|
gtest_main
|
|
|
|
|
sherpa-onnx-core
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_test(NAME "${target_name}"
|
|
|
|
|
COMMAND
|
|
|
|
|
$<TARGET_FILE:${target_name}>
|
|
|
|
|
)
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
foreach(source IN LISTS sherpa_onnx_test_srcs)
|
|
|
|
|
sherpa_onnx_add_test(${source})
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
2024-06-19 20:51:57 +08:00
|
|
|
|
|
|
|
|
set(srcs_to_check)
|
|
|
|
|
foreach(s IN LISTS sources)
|
|
|
|
|
list(APPEND srcs_to_check ${CMAKE_CURRENT_LIST_DIR}/${s})
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
# For clang-tidy
|
|
|
|
|
add_custom_target(
|
|
|
|
|
clang-tidy-check
|
|
|
|
|
clang-tidy -p ${CMAKE_BINARY_DIR}/compile_commands.json --config-file ${CMAKE_SOURCE_DIR}/.clang-tidy ${srcs_to_check}
|
|
|
|
|
DEPENDS ${sources})
|
|
|
|
|
|
|
|
|
|
add_custom_target(check DEPENDS clang-tidy-check)
|