From 27db015c8ed7e3c5b2b8c2bf52262d6a19791c71 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Tue, 31 Oct 2023 21:50:56 +0800 Subject: [PATCH] Use a single static lib file for onnxruntime on Windows (#404) --- cmake/onnxruntime-win-x64-static.cmake | 15 ++++++------ cmake/onnxruntime-win-x86-static.cmake | 14 +++++------ .../sherpa-onnx-deps.props | 24 +------------------ .../NonStreamingTextToSpeech.vcxproj | 2 +- .../sherpa-onnx-deps.props | 24 +------------------ .../sherpa-onnx-deps.props | 24 +------------------ 6 files changed, 19 insertions(+), 84 deletions(-) diff --git a/cmake/onnxruntime-win-x64-static.cmake b/cmake/onnxruntime-win-x64-static.cmake index 849c973d3..f885d6c04 100644 --- a/cmake/onnxruntime-win-x64-static.cmake +++ b/cmake/onnxruntime-win-x64-static.cmake @@ -15,18 +15,18 @@ if(BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-win-x64-static-1.16.0.tar.bz2") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static-1.16.0.tar.bz2") -set(onnxruntime_HASH "SHA256=d1b87e8a438a7e31b46bf13a194c5ac38fdf60ebeefef82692008e42e3242776") +set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-win-x64-static_lib-1.16.0.tar.bz2") +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static_lib-1.16.0.tar.bz2") +set(onnxruntime_HASH "SHA256=7b28a694178d075e6836d618613e2a0fd0046ccd9fd66bbf6a46d22e96db33b8") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x64-static-1.16.0.tar.bz2 - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-static-1.16.0.tar.bz2 - ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-static-1.16.0.tar.bz2 - /tmp/onnxruntime-win-x64-static-1.16.0.tar.bz2 + $ENV{HOME}/Downloads/onnxruntime-win-x64-static_lib-1.16.0.tar.bz2 + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-static_lib-1.16.0.tar.bz2 + ${PROJECT_BINARY_DIR}/onnxruntime-win-x64-static_lib-1.16.0.tar.bz2 + /tmp/onnxruntime-win-x64-static_lib-1.16.0.tar.bz2 ) foreach(f IN LISTS possible_file_locations) @@ -57,6 +57,7 @@ message(STATUS "onnxruntime is downloaded to ${onnxruntime_SOURCE_DIR}") include_directories(${onnxruntime_SOURCE_DIR}/include) file(GLOB onnxruntime_lib_files "${onnxruntime_SOURCE_DIR}/lib/*.lib") + set(onnxruntime_lib_files ${onnxruntime_lib_files} PARENT_SCOPE) message(STATUS "onnxruntime lib files: ${onnxruntime_lib_files}") diff --git a/cmake/onnxruntime-win-x86-static.cmake b/cmake/onnxruntime-win-x86-static.cmake index cd7992e22..9cc34ba43 100644 --- a/cmake/onnxruntime-win-x86-static.cmake +++ b/cmake/onnxruntime-win-x86-static.cmake @@ -15,18 +15,18 @@ if(BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-win-x86-static-1.16.0.tar.bz2") -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static-1.16.0.tar.bz2") -set(onnxruntime_HASH "SHA256=aedb6b5275f7832ac5117db8e40328a0842ae8ce6749a0c99bcb4218c53fdc60") +set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-win-x86-static_lib-1.16.0.tar.bz2") +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static_lib-1.16.0.tar.bz2") +set(onnxruntime_HASH "SHA256=fe78775b222244bbcb512631719a94336391b645edb23c314201a6991ddecb58") # If you don't have access to the Internet, # please download onnxruntime to one of the following locations. # You can add more if you want. set(possible_file_locations - $ENV{HOME}/Downloads/onnxruntime-win-x86-static-1.16.0.tar.bz2 - ${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-static-1.16.0.tar.bz2 - ${PROJECT_BINARY_DIR}/onnxruntime-win-x86-static-1.16.0.tar.bz2 - /tmp/onnxruntime-win-x86-static-1.16.0.tar.bz2 + $ENV{HOME}/Downloads/onnxruntime-win-x86-static_lib-1.16.0.tar.bz2 + ${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-static_lib-1.16.0.tar.bz2 + ${PROJECT_BINARY_DIR}/onnxruntime-win-x86-static_lib-1.16.0.tar.bz2 + /tmp/onnxruntime-win-x86-static_lib-1.16.0.tar.bz2 ) foreach(f IN LISTS possible_file_locations) diff --git a/mfc-examples/NonStreamingSpeechRecognition/sherpa-onnx-deps.props b/mfc-examples/NonStreamingSpeechRecognition/sherpa-onnx-deps.props index 4c144708a..58cf638a7 100644 --- a/mfc-examples/NonStreamingSpeechRecognition/sherpa-onnx-deps.props +++ b/mfc-examples/NonStreamingSpeechRecognition/sherpa-onnx-deps.props @@ -13,29 +13,7 @@ sherpa-onnx-kaldifst-core.lib; sherpa-onnx-fst.lib; kaldi-native-fbank-core.lib; - absl_base.lib; - absl_city.lib; - absl_hash.lib; - absl_low_level_hash.lib; - absl_raw_hash_set.lib; - absl_raw_logging_internal.lib; - absl_throw_delegate.lib; - clog.lib; - cpuinfo.lib; - flatbuffers.lib; - libprotobuf-lite.lib; - onnx.lib; - onnx_proto.lib; - onnxruntime_common.lib; - onnxruntime_flatbuffers.lib; - onnxruntime_framework.lib; - onnxruntime_graph.lib; - onnxruntime_mlas.lib; - onnxruntime_optimizer.lib; - onnxruntime_providers.lib; - onnxruntime_session.lib; - onnxruntime_util.lib; - re2.lib; + onnxruntime.lib; diff --git a/mfc-examples/NonStreamingTextToSpeech/NonStreamingTextToSpeech.vcxproj b/mfc-examples/NonStreamingTextToSpeech/NonStreamingTextToSpeech.vcxproj index d7eb6fd1b..26ed5cc9b 100644 --- a/mfc-examples/NonStreamingTextToSpeech/NonStreamingTextToSpeech.vcxproj +++ b/mfc-examples/NonStreamingTextToSpeech/NonStreamingTextToSpeech.vcxproj @@ -39,7 +39,7 @@ v143 true Unicode - Dynamic + Static Application diff --git a/mfc-examples/NonStreamingTextToSpeech/sherpa-onnx-deps.props b/mfc-examples/NonStreamingTextToSpeech/sherpa-onnx-deps.props index 4c144708a..58cf638a7 100644 --- a/mfc-examples/NonStreamingTextToSpeech/sherpa-onnx-deps.props +++ b/mfc-examples/NonStreamingTextToSpeech/sherpa-onnx-deps.props @@ -13,29 +13,7 @@ sherpa-onnx-kaldifst-core.lib; sherpa-onnx-fst.lib; kaldi-native-fbank-core.lib; - absl_base.lib; - absl_city.lib; - absl_hash.lib; - absl_low_level_hash.lib; - absl_raw_hash_set.lib; - absl_raw_logging_internal.lib; - absl_throw_delegate.lib; - clog.lib; - cpuinfo.lib; - flatbuffers.lib; - libprotobuf-lite.lib; - onnx.lib; - onnx_proto.lib; - onnxruntime_common.lib; - onnxruntime_flatbuffers.lib; - onnxruntime_framework.lib; - onnxruntime_graph.lib; - onnxruntime_mlas.lib; - onnxruntime_optimizer.lib; - onnxruntime_providers.lib; - onnxruntime_session.lib; - onnxruntime_util.lib; - re2.lib; + onnxruntime.lib; diff --git a/mfc-examples/StreamingSpeechRecognition/sherpa-onnx-deps.props b/mfc-examples/StreamingSpeechRecognition/sherpa-onnx-deps.props index 4c144708a..58cf638a7 100644 --- a/mfc-examples/StreamingSpeechRecognition/sherpa-onnx-deps.props +++ b/mfc-examples/StreamingSpeechRecognition/sherpa-onnx-deps.props @@ -13,29 +13,7 @@ sherpa-onnx-kaldifst-core.lib; sherpa-onnx-fst.lib; kaldi-native-fbank-core.lib; - absl_base.lib; - absl_city.lib; - absl_hash.lib; - absl_low_level_hash.lib; - absl_raw_hash_set.lib; - absl_raw_logging_internal.lib; - absl_throw_delegate.lib; - clog.lib; - cpuinfo.lib; - flatbuffers.lib; - libprotobuf-lite.lib; - onnx.lib; - onnx_proto.lib; - onnxruntime_common.lib; - onnxruntime_flatbuffers.lib; - onnxruntime_framework.lib; - onnxruntime_graph.lib; - onnxruntime_mlas.lib; - onnxruntime_optimizer.lib; - onnxruntime_providers.lib; - onnxruntime_session.lib; - onnxruntime_util.lib; - re2.lib; + onnxruntime.lib;