继续操作前请注册或者登录。
frankyoujian
Committed by GitHub

Support windows x86 platform (#86)

* support windows x86 platform

* improve cmake

* resolve comments

---------

Co-authored-by: Jian You (jianyou) <jianyou@cisco.com>
... ... @@ -37,9 +37,8 @@ endif()
set(CMAKE_INSTALL_RPATH ${SHERPA_ONNX_RPATH_ORIGIN})
set(CMAKE_BUILD_RPATH ${SHERPA_ONNX_RPATH_ORIGIN})
if(WIN32 AND BUILD_SHARED_LIBS)
message(STATUS "Set BUILD_SHARED_LIBS to OFF for windows")
set(BUILD_SHARED_LIBS OFF)
if(BUILD_SHARED_LIBS AND MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
if(NOT CMAKE_BUILD_TYPE)
... ...
... ... @@ -54,15 +54,32 @@ function(download_onnxruntime)
elseif(WIN32)
# If you don't have access to the Internet,
# please pre-download onnxruntime
set(possible_file_locations
$ENV{HOME}/Downloads/onnxruntime-win-x64-1.14.0.zip
${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-1.14.0.zip
${PROJECT_BINARY_DIR}/onnxruntime-win-x64-1.14.0.zip
/tmp/onnxruntime-win-x64-1.14.0.zip
)
set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-win-x64-1.14.0.zip")
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x64-1.14.0.zip")
set(onnxruntime_HASH "SHA256=300eafef456748cde2743ee08845bd40ff1bab723697ff934eba6d4ce3519620")
if(CMAKE_VS_PLATFORM_NAME STREQUAL Win32)
# for 32-bit windows
set(possible_file_locations
$ENV{HOME}/Downloads/onnxruntime-win-x86-1.14.0.zip
${PROJECT_SOURCE_DIR}/onnxruntime-win-x86-1.14.0.zip
${PROJECT_BINARY_DIR}/onnxruntime-win-x86-1.14.0.zip
/tmp/onnxruntime-win-x86-1.14.0.zip
)
set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-win-x86-1.14.0.zip")
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x86-1.14.0.zip")
set(onnxruntime_HASH "SHA256=4214b130db602cbf31a6f26f25377ab077af0cf03c4ddd4651283e1fb68f56cf")
else()
# for 64-bit windows
set(possible_file_locations
$ENV{HOME}/Downloads/onnxruntime-win-x64-1.14.0.zip
${PROJECT_SOURCE_DIR}/onnxruntime-win-x64-1.14.0.zip
${PROJECT_BINARY_DIR}/onnxruntime-win-x64-1.14.0.zip
/tmp/onnxruntime-win-x64-1.14.0.zip
)
set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-win-x64-1.14.0.zip")
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-win-x64-1.14.0.zip")
set(onnxruntime_HASH "SHA256=300eafef456748cde2743ee08845bd40ff1bab723697ff934eba6d4ce3519620")
endif()
# After downloading, it contains:
# ./lib/onnxruntime.{dll,lib,pdb}
# ./lib/onnxruntime_providers_shared.{dll,lib,pdb}
... ...
... ... @@ -60,9 +60,13 @@ static ModelType GetModelType(char *model_data, size_t model_data_length,
std::unique_ptr<OnlineTransducerModel> OnlineTransducerModel::Create(
const OnlineTransducerModelConfig &config) {
auto buffer = ReadFile(config.encoder_filename);
ModelType model_type = ModelType::kUnkown;
auto model_type = GetModelType(buffer.data(), buffer.size(), config.debug);
{
auto buffer = ReadFile(config.encoder_filename);
model_type = GetModelType(buffer.data(), buffer.size(), config.debug);
}
switch (model_type) {
case ModelType::kLstm:
... ...