Fangjun Kuang
Committed by GitHub

Fix issues about DLLs when installing pre-compiled wheels on windows (#91)

name: test-pip-install
on:
push:
branches:
- test-pip-install
schedule:
# minute (0-59)
# hour (0-23)
# day of the month (1-31)
# month (1-12)
# day of the week (0-6)
# nightly build at 23:50 UTC time every day
- cron: "50 23 * * *"
concurrency:
group: test-pip-install-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test_pip_install:
runs-on: ${{ matrix.os }}
name: Test pip install on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install sherpa-onnx
shell: bash
run: |
pip install --verbose sherpa-onnx
- name: Test sherp-onnx
shell: bash
run: |
python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"
python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)"
... ...
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(sherpa-onnx)
set(SHERPA_ONNX_VERSION "1.3.0")
set(SHERPA_ONNX_VERSION "1.3.2")
# Disable warning about
#
... ... @@ -74,9 +74,37 @@ endif()
check_include_file_cxx(cxxabi.h SHERPA_ONNX_HAVE_CXXABI_H)
check_include_file_cxx(execinfo.h SHERPA_ONNX_HAVE_EXECINFO_H)
if(WIN32)
add_definitions(-DNOMINMAX) # Otherwise, std::max() and std::min() won't work
endif()
if(WIN32 AND MSVC)
# disable various warnings for MSVC
# 4244: 'return': conversion from 'unsigned __int64' to 'int', possible loss of data
# 4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
# 4305: 'argument': truncation from 'double' to 'const float'
# 4334: '<<': result of 32-bit shift implicitly converted to 64 bits
# 4800: 'int': forcing value to bool 'true' or 'false'
# 4996: 'fopen': This function or variable may be unsafe
set(disabled_warnings
/wd4244
/wd4267
/wd4305
/wd4334
/wd4800
/wd4996
)
message(STATUS "Disabled warnings: ${disabled_warnings}")
foreach(w IN LISTS disabled_warnings)
string(APPEND CMAKE_CXX_FLAGS " ${w} ")
endforeach()
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(kaldi-native-fbank)
include(onnxruntime)
... ...
... ... @@ -71,10 +71,8 @@ class BuildExtension(build_ext):
cmake_args = "-DCMAKE_BUILD_TYPE=Release"
extra_cmake_args = f" -DCMAKE_INSTALL_PREFIX={install_dir} "
if not is_windows():
extra_cmake_args += " -DBUILD_SHARED_LIBS=ON "
else:
extra_cmake_args += " -DBUILD_SHARED_LIBS=OFF "
extra_cmake_args += " -DBUILD_SHARED_LIBS=ON "
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_CHECK=OFF "
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PYTHON=ON "
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF "
... ...
... ... @@ -49,7 +49,11 @@ function(download_kaldi_native_fbank)
INTERFACE
${kaldi_native_fbank_SOURCE_DIR}/
)
install(TARGETS kaldi-native-fbank-core DESTINATION 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()
endfunction()
download_kaldi_native_fbank()
... ...
... ... @@ -155,7 +155,11 @@ function(download_onnxruntime)
endif()
message(STATUS "onnxruntime lib files: ${onnxruntime_lib_files}")
install(FILES ${onnxruntime_lib_files} DESTINATION lib)
if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32)
install(FILES ${onnxruntime_lib_files} DESTINATION ..)
else()
install(FILES ${onnxruntime_lib_files} DESTINATION lib)
endif()
endfunction()
# First, we try to locate the header and the lib if the use has already
... ...
... ... @@ -62,7 +62,12 @@ if(NOT WIN32)
target_link_libraries(sherpa-onnx "-Wl,-rpath,${SHERPA_ONNX_RPATH_ORIGIN}/../lib")
endif()
install(TARGETS sherpa-onnx-core DESTINATION lib)
if(SHERPA_ONNX_ENABLE_PYTHON AND WIN32)
install(TARGETS sherpa-onnx-core DESTINATION ..)
else()
install(TARGETS sherpa-onnx-core DESTINATION lib)
endif()
install(TARGETS sherpa-onnx DESTINATION bin)
if(SHERPA_ONNX_HAS_ALSA)
... ...
... ... @@ -20,7 +20,7 @@
namespace sherpa_onnx {
class OnlineTransducerDecoderResult;
struct OnlineTransducerDecoderResult;
class OnlineTransducerModel {
public:
... ...