正在显示
14 个修改的文件
包含
214 行增加
和
64 行删除
| @@ -22,20 +22,27 @@ jobs: | @@ -22,20 +22,27 @@ jobs: | ||
| 22 | strategy: | 22 | strategy: |
| 23 | fail-fast: false | 23 | fail-fast: false |
| 24 | matrix: | 24 | matrix: |
| 25 | - os: [windows-latest] | ||
| 26 | - python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"] | 25 | + os: [windows-2019] |
| 26 | + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | ||
| 27 | 27 | ||
| 28 | steps: | 28 | steps: |
| 29 | - uses: actions/checkout@v4 | 29 | - uses: actions/checkout@v4 |
| 30 | 30 | ||
| 31 | - # see https://cibuildwheel.readthedocs.io/en/stable/changelog/ | ||
| 32 | - # for a list of versions | 31 | + - name: Setup Python ${{ matrix.python-version }} |
| 32 | + uses: actions/setup-python@v5 | ||
| 33 | + with: | ||
| 34 | + python-version: ${{ matrix.python-version }} | ||
| 35 | + | ||
| 33 | - name: Build wheels | 36 | - name: Build wheels |
| 34 | - uses: pypa/cibuildwheel@v2.16.5 | ||
| 35 | - env: | ||
| 36 | - CIBW_BUILD: "${{ matrix.python-version}}-* " | ||
| 37 | - CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*" | ||
| 38 | - CIBW_BUILD_VERBOSITY: 3 | 37 | + shell: bash |
| 38 | + run: | | ||
| 39 | + pip install setuptools wheel | ||
| 40 | + | ||
| 41 | + python3 setup.py bdist_wheel | ||
| 42 | + | ||
| 43 | + ls -lh ./dist/ | ||
| 44 | + | ||
| 45 | + mv dist wheelhouse | ||
| 39 | 46 | ||
| 40 | - name: Display wheels | 47 | - name: Display wheels |
| 41 | shell: bash | 48 | shell: bash |
| @@ -48,7 +55,6 @@ jobs: | @@ -48,7 +55,6 @@ jobs: | ||
| 48 | path: ./wheelhouse/*.whl | 55 | path: ./wheelhouse/*.whl |
| 49 | 56 | ||
| 50 | - name: Publish to huggingface | 57 | - name: Publish to huggingface |
| 51 | - if: matrix.python-version == 'cp38' | ||
| 52 | env: | 58 | env: |
| 53 | HF_TOKEN: ${{ secrets.HF_TOKEN }} | 59 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 54 | uses: nick-fields/retry@v3 | 60 | uses: nick-fields/retry@v3 |
| @@ -77,36 +83,6 @@ jobs: | @@ -77,36 +83,6 @@ jobs: | ||
| 77 | git commit -m "add more wheels" | 83 | git commit -m "add more wheels" |
| 78 | git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main | 84 | git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main |
| 79 | 85 | ||
| 80 | - - name: Publish to huggingface | ||
| 81 | - if: matrix.python-version == 'cp38' | ||
| 82 | - env: | ||
| 83 | - HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 84 | - uses: nick-fields/retry@v2 | ||
| 85 | - with: | ||
| 86 | - max_attempts: 20 | ||
| 87 | - timeout_seconds: 200 | ||
| 88 | - shell: bash | ||
| 89 | - command: | | ||
| 90 | - git config --global user.email "csukuangfj@gmail.com" | ||
| 91 | - git config --global user.name "Fangjun Kuang" | ||
| 92 | - | ||
| 93 | - rm -rf huggingface | ||
| 94 | - export GIT_LFS_SKIP_SMUDGE=1 | ||
| 95 | - export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 96 | - | ||
| 97 | - git clone https://huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface | ||
| 98 | - cd huggingface | ||
| 99 | - git fetch | ||
| 100 | - git pull | ||
| 101 | - git merge -m "merge remote" --ff origin main | ||
| 102 | - | ||
| 103 | - cp -v ../wheelhouse/*.whl . | ||
| 104 | - | ||
| 105 | - git status | ||
| 106 | - git add . | ||
| 107 | - git commit -m "add more wheels" | ||
| 108 | - git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main | ||
| 109 | - | ||
| 110 | - name: Publish wheels to PyPI | 86 | - name: Publish wheels to PyPI |
| 111 | env: | 87 | env: |
| 112 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | 88 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| @@ -11,8 +11,103 @@ permissions: | @@ -11,8 +11,103 @@ permissions: | ||
| 11 | contents: read | 11 | contents: read |
| 12 | 12 | ||
| 13 | jobs: | 13 | jobs: |
| 14 | + build-libs: | ||
| 15 | + name: ${{ matrix.os }} ${{ matrix.arch }} | ||
| 16 | + runs-on: ${{ matrix.os }} | ||
| 17 | + strategy: | ||
| 18 | + fail-fast: false | ||
| 19 | + matrix: | ||
| 20 | + os: [windows-2019] | ||
| 21 | + arch: [x64, x86, arm64] | ||
| 22 | + | ||
| 23 | + steps: | ||
| 24 | + - uses: actions/checkout@v4 | ||
| 25 | + with: | ||
| 26 | + fetch-depth: 0 | ||
| 27 | + | ||
| 28 | + - name: Build sherpa-onnx | ||
| 29 | + shell: bash | ||
| 30 | + run: | | ||
| 31 | + arch=${{ matrix.arch }} | ||
| 32 | + opts="" | ||
| 33 | + if [ $arch == x86 ]; then | ||
| 34 | + opts="-A Win32" | ||
| 35 | + elif [ $arch == arm64 ]; then | ||
| 36 | + opts="-A ARM64" | ||
| 37 | + fi | ||
| 38 | + | ||
| 39 | + mkdir build | ||
| 40 | + cd build | ||
| 41 | + cmake \ | ||
| 42 | + $opts \ | ||
| 43 | + -DBUILD_SHARED_LIBS=ON \ | ||
| 44 | + -DCMAKE_INSTALL_PREFIX=./install \ | ||
| 45 | + -DCMAKE_BUILD_TYPE=Release \ | ||
| 46 | + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | ||
| 47 | + -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 48 | + -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \ | ||
| 49 | + -DSHERPA_ONNX_ENABLE_BINARY=ON \ | ||
| 50 | + .. | ||
| 51 | + | ||
| 52 | + cmake --build . --target install --config Release | ||
| 53 | + rm -rf install/pkgconfig | ||
| 54 | + | ||
| 55 | + - uses: actions/upload-artifact@v4 | ||
| 56 | + with: | ||
| 57 | + name: windows-${{ matrix.arch }} | ||
| 58 | + path: ./build/install/lib/ | ||
| 59 | + | ||
| 60 | + - name: Create tar file | ||
| 61 | + shell: bash | ||
| 62 | + run: | | ||
| 63 | + arch=${{ matrix.arch }} | ||
| 64 | + | ||
| 65 | + cd build | ||
| 66 | + | ||
| 67 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ../CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 68 | + | ||
| 69 | + dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-$arch | ||
| 70 | + mv install/lib $dst | ||
| 71 | + tar cjvf $dst.tar.bz2 $dst | ||
| 72 | + ls -lh *.tar.bz2 | ||
| 73 | + mv *.tar.bz2 ../ | ||
| 74 | + | ||
| 75 | + # https://huggingface.co/docs/hub/spaces-github-actions | ||
| 76 | + - name: Publish to huggingface | ||
| 77 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | ||
| 78 | + env: | ||
| 79 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 80 | + uses: nick-fields/retry@v3 | ||
| 81 | + with: | ||
| 82 | + max_attempts: 20 | ||
| 83 | + timeout_seconds: 200 | ||
| 84 | + shell: bash | ||
| 85 | + command: | | ||
| 86 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 87 | + git config --global user.name "Fangjun Kuang" | ||
| 88 | + | ||
| 89 | + rm -rf huggingface | ||
| 90 | + export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 91 | + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface | ||
| 92 | + | ||
| 93 | + cd huggingface | ||
| 94 | + mkdir -p windows-for-dotnet | ||
| 95 | + | ||
| 96 | + cp -v ../sherpa-onnx-*.tar.bz2 ./windows-for-dotnet | ||
| 97 | + | ||
| 98 | + git status | ||
| 99 | + git lfs track "*.bz2" | ||
| 100 | + | ||
| 101 | + git add . | ||
| 102 | + | ||
| 103 | + git commit -m "add more files" | ||
| 104 | + | ||
| 105 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main | ||
| 106 | + rm -rf huggingface | ||
| 107 | + | ||
| 14 | release-nuget-package: | 108 | release-nuget-package: |
| 15 | runs-on: ${{ matrix.os }} | 109 | runs-on: ${{ matrix.os }} |
| 110 | + needs: [build-libs] | ||
| 16 | strategy: | 111 | strategy: |
| 17 | fail-fast: false | 112 | fail-fast: false |
| 18 | matrix: | 113 | matrix: |
| @@ -30,12 +125,47 @@ jobs: | @@ -30,12 +125,47 @@ jobs: | ||
| 30 | 6.0.x | 125 | 6.0.x |
| 31 | 7.0.x | 126 | 7.0.x |
| 32 | 127 | ||
| 128 | + - name: Install Python dependencies | ||
| 129 | + shell: bash | ||
| 130 | + run: | | ||
| 131 | + python3 -m pip install --upgrade pip Jinja2 | ||
| 132 | + | ||
| 133 | + - name: Retrieve artifact from windows x64 | ||
| 134 | + uses: actions/download-artifact@v4 | ||
| 135 | + with: | ||
| 136 | + name: windows-x64 | ||
| 137 | + path: /tmp/windows-x64 | ||
| 138 | + | ||
| 139 | + - name: Retrieve artifact from windows x86 | ||
| 140 | + uses: actions/download-artifact@v4 | ||
| 141 | + with: | ||
| 142 | + name: windows-x86 | ||
| 143 | + path: /tmp/windows-x86 | ||
| 144 | + | ||
| 145 | + - name: Retrieve artifact from windows arm64 | ||
| 146 | + uses: actions/download-artifact@v4 | ||
| 147 | + with: | ||
| 148 | + name: windows-arm64 | ||
| 149 | + path: /tmp/windows-arm64 | ||
| 150 | + | ||
| 33 | - name: Check dotnet | 151 | - name: Check dotnet |
| 34 | run: dotnet --info | 152 | run: dotnet --info |
| 35 | 153 | ||
| 36 | - name: Build | 154 | - name: Build |
| 37 | shell: bash | 155 | shell: bash |
| 38 | run: | | 156 | run: | |
| 157 | + sudo apt-get install -y tree | ||
| 158 | + ls -lh /tmp/ | ||
| 159 | + | ||
| 160 | + tree /tmp/windows* | ||
| 161 | + echo "----" | ||
| 162 | + | ||
| 163 | + rm -v /tmp/windows*/*.lib | ||
| 164 | + tree /tmp/windows* | ||
| 165 | + | ||
| 166 | + - name: Build | ||
| 167 | + shell: bash | ||
| 168 | + run: | | ||
| 39 | cd scripts/dotnet | 169 | cd scripts/dotnet |
| 40 | ./run.sh | 170 | ./run.sh |
| 41 | 171 |
| @@ -44,17 +44,17 @@ jobs: | @@ -44,17 +44,17 @@ jobs: | ||
| 44 | - os: macos-11 | 44 | - os: macos-11 |
| 45 | python-version: "3.7" | 45 | python-version: "3.7" |
| 46 | 46 | ||
| 47 | - - os: macos-12 | 47 | + - os: macos-13 |
| 48 | python-version: "3.8" | 48 | python-version: "3.8" |
| 49 | 49 | ||
| 50 | - os: macos-13 | 50 | - os: macos-13 |
| 51 | python-version: "3.9" | 51 | python-version: "3.9" |
| 52 | - - os: macos-13 | 52 | + - os: macos-14 |
| 53 | python-version: "3.10" | 53 | python-version: "3.10" |
| 54 | - - os: macos-13 | 54 | + - os: macos-14 |
| 55 | python-version: "3.11" | 55 | python-version: "3.11" |
| 56 | 56 | ||
| 57 | - - os: macos-14 | 57 | + - os: macos-latest |
| 58 | python-version: "3.12" | 58 | python-version: "3.12" |
| 59 | 59 | ||
| 60 | steps: | 60 | steps: |
| @@ -90,7 +90,7 @@ jobs: | @@ -90,7 +90,7 @@ jobs: | ||
| 90 | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | 90 | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 91 | cmake --version | 91 | cmake --version |
| 92 | 92 | ||
| 93 | - python3 -m pip install --verbose . | 93 | + python3 setup.py install |
| 94 | 94 | ||
| 95 | - name: Test sherpa-onnx | 95 | - name: Test sherpa-onnx |
| 96 | shell: bash | 96 | shell: bash |
| @@ -66,7 +66,7 @@ jobs: | @@ -66,7 +66,7 @@ jobs: | ||
| 66 | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | 66 | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 67 | cmake --version | 67 | cmake --version |
| 68 | 68 | ||
| 69 | - python3 -m pip install --no-deps --verbose . | 69 | + python3 setup.py install |
| 70 | python3 -m pip install websockets | 70 | python3 -m pip install websockets |
| 71 | 71 | ||
| 72 | - name: Start server for transducer models | 72 | - name: Start server for transducer models |
| @@ -66,7 +66,7 @@ jobs: | @@ -66,7 +66,7 @@ jobs: | ||
| 66 | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | 66 | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 67 | cmake --version | 67 | cmake --version |
| 68 | 68 | ||
| 69 | - python3 -m pip install --no-deps --verbose . | 69 | + python3 setup.py install |
| 70 | python3 -m pip install websockets | 70 | python3 -m pip install websockets |
| 71 | 71 | ||
| 72 | - name: Start server for zipformer2 CTC models | 72 | - name: Start server for zipformer2 CTC models |
| @@ -69,11 +69,16 @@ jobs: | @@ -69,11 +69,16 @@ jobs: | ||
| 69 | shell: bash | 69 | shell: bash |
| 70 | run: | | 70 | run: | |
| 71 | cd build | 71 | cd build |
| 72 | - cmake --build . --config Release -- -m:2 | 72 | + cmake --build . --config Release -- -m:2 |
| 73 | cmake --build . --config Release --target install -- -m:2 | 73 | cmake --build . --config Release --target install -- -m:2 |
| 74 | 74 | ||
| 75 | ls -lh ./bin/Release/sherpa-onnx.exe | 75 | ls -lh ./bin/Release/sherpa-onnx.exe |
| 76 | 76 | ||
| 77 | + - uses: actions/upload-artifact@v4 | ||
| 78 | + with: | ||
| 79 | + name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }} | ||
| 80 | + path: build/install/* | ||
| 81 | + | ||
| 77 | - name: Test offline punctuation | 82 | - name: Test offline punctuation |
| 78 | shell: bash | 83 | shell: bash |
| 79 | run: | | 84 | run: | |
| @@ -74,6 +74,11 @@ jobs: | @@ -74,6 +74,11 @@ jobs: | ||
| 74 | 74 | ||
| 75 | ls -lh ./bin/Release/sherpa-onnx.exe | 75 | ls -lh ./bin/Release/sherpa-onnx.exe |
| 76 | 76 | ||
| 77 | + - uses: actions/upload-artifact@v4 | ||
| 78 | + with: | ||
| 79 | + name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }} | ||
| 80 | + path: build/install/* | ||
| 81 | + | ||
| 77 | - name: Test offline punctuation | 82 | - name: Test offline punctuation |
| 78 | shell: bash | 83 | shell: bash |
| 79 | run: | | 84 | run: | |
| @@ -8,7 +8,7 @@ project(sherpa-onnx) | @@ -8,7 +8,7 @@ project(sherpa-onnx) | ||
| 8 | # ./nodejs-addon-examples | 8 | # ./nodejs-addon-examples |
| 9 | # ./dart-api-examples/ | 9 | # ./dart-api-examples/ |
| 10 | # ./sherpa-onnx/flutter/CHANGELOG.md | 10 | # ./sherpa-onnx/flutter/CHANGELOG.md |
| 11 | -set(SHERPA_ONNX_VERSION "1.10.2") | 11 | +set(SHERPA_ONNX_VERSION "1.10.5") |
| 12 | 12 | ||
| 13 | # Disable warning about | 13 | # Disable warning about |
| 14 | # | 14 | # |
| @@ -37,6 +37,7 @@ option(SHERPA_ONNX_ENABLE_TTS "Whether to build TTS related code" ON) | @@ -37,6 +37,7 @@ option(SHERPA_ONNX_ENABLE_TTS "Whether to build TTS related code" ON) | ||
| 37 | option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. Used only when BUILD_SHARED_LIBS is OFF on Linux" ON) | 37 | option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. Used only when BUILD_SHARED_LIBS is OFF on Linux" ON) |
| 38 | option(SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE "True to use pre-installed onnxruntime if available" ON) | 38 | option(SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE "True to use pre-installed onnxruntime if available" ON) |
| 39 | option(SHERPA_ONNX_ENABLE_SANITIZER "Whether to enable ubsan and asan" OFF) | 39 | option(SHERPA_ONNX_ENABLE_SANITIZER "Whether to enable ubsan and asan" OFF) |
| 40 | +option(SHERPA_ONNX_BUILD_C_API_EXAMPLES "Whether to enable C API examples" ON) | ||
| 40 | 41 | ||
| 41 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") | 42 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") |
| 42 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") | 43 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") |
| @@ -127,6 +128,7 @@ message(STATUS "SHERPA_ONNX_ENABLE_TTS ${SHERPA_ONNX_ENABLE_TTS}") | @@ -127,6 +128,7 @@ message(STATUS "SHERPA_ONNX_ENABLE_TTS ${SHERPA_ONNX_ENABLE_TTS}") | ||
| 127 | message(STATUS "SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY ${SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY}") | 128 | message(STATUS "SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY ${SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY}") |
| 128 | message(STATUS "SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE ${SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE}") | 129 | message(STATUS "SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE ${SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE}") |
| 129 | message(STATUS "SHERPA_ONNX_ENABLE_SANITIZER: ${SHERPA_ONNX_ENABLE_SANITIZER}") | 130 | message(STATUS "SHERPA_ONNX_ENABLE_SANITIZER: ${SHERPA_ONNX_ENABLE_SANITIZER}") |
| 131 | +message(STATUS "SHERPA_ONNX_BUILD_C_API_EXAMPLES: ${SHERPA_ONNX_BUILD_C_API_EXAMPLES}") | ||
| 130 | 132 | ||
| 131 | if(SHERPA_ONNX_ENABLE_TTS) | 133 | if(SHERPA_ONNX_ENABLE_TTS) |
| 132 | message(STATUS "TTS is enabled") | 134 | message(STATUS "TTS is enabled") |
| @@ -302,7 +304,7 @@ endif() | @@ -302,7 +304,7 @@ endif() | ||
| 302 | 304 | ||
| 303 | add_subdirectory(sherpa-onnx) | 305 | add_subdirectory(sherpa-onnx) |
| 304 | 306 | ||
| 305 | -if(SHERPA_ONNX_ENABLE_C_API AND SHERPA_ONNX_ENABLE_BINARY) | 307 | +if(SHERPA_ONNX_ENABLE_C_API AND SHERPA_ONNX_ENABLE_BINARY AND SHERPA_ONNX_BUILD_C_API_EXAMPLES) |
| 306 | set(SHERPA_ONNX_PKG_WITH_CARGS "-lcargs") | 308 | set(SHERPA_ONNX_PKG_WITH_CARGS "-lcargs") |
| 307 | add_subdirectory(c-api-examples) | 309 | add_subdirectory(c-api-examples) |
| 308 | endif() | 310 | endif() |
| @@ -146,6 +146,7 @@ class BuildExtension(build_ext): | @@ -146,6 +146,7 @@ class BuildExtension(build_ext): | ||
| 146 | extra_cmake_args += " -DBUILD_ESPEAK_NG_EXE=OFF " | 146 | extra_cmake_args += " -DBUILD_ESPEAK_NG_EXE=OFF " |
| 147 | extra_cmake_args += " -DBUILD_ESPEAK_NG_TESTS=OFF " | 147 | extra_cmake_args += " -DBUILD_ESPEAK_NG_TESTS=OFF " |
| 148 | 148 | ||
| 149 | + extra_cmake_args += " -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF " | ||
| 149 | extra_cmake_args += " -DSHERPA_ONNX_ENABLE_CHECK=OFF " | 150 | extra_cmake_args += " -DSHERPA_ONNX_ENABLE_CHECK=OFF " |
| 150 | extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PYTHON=ON " | 151 | extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PYTHON=ON " |
| 151 | extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PORTAUDIO=ON " | 152 | extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PORTAUDIO=ON " |
| @@ -134,6 +134,7 @@ def main(): | @@ -134,6 +134,7 @@ def main(): | ||
| 134 | process_linux(s) | 134 | process_linux(s) |
| 135 | process_windows(s, "x64") | 135 | process_windows(s, "x64") |
| 136 | process_windows(s, "x86") | 136 | process_windows(s, "x86") |
| 137 | + process_windows(s, "arm64") | ||
| 137 | 138 | ||
| 138 | s = read_proj_file("./sherpa-onnx.csproj.in") | 139 | s = read_proj_file("./sherpa-onnx.csproj.in") |
| 139 | d = get_dict() | 140 | d = get_dict() |
| @@ -24,7 +24,7 @@ export src_dir | @@ -24,7 +24,7 @@ export src_dir | ||
| 24 | mkdir -p $src_dir | 24 | mkdir -p $src_dir |
| 25 | pushd $src_dir | 25 | pushd $src_dir |
| 26 | 26 | ||
| 27 | -mkdir -p linux macos-x64 macos-arm64 windows-x64 windows-x86 | 27 | +mkdir -p linux macos-x64 macos-arm64 windows-x64 windows-x86 windows-arm64 |
| 28 | 28 | ||
| 29 | linux_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | 29 | linux_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| 30 | linux_wheel=$src_dir/$linux_wheel_filename | 30 | linux_wheel=$src_dir/$linux_wheel_filename |
| @@ -41,6 +41,9 @@ windows_x64_wheel=$src_dir/$windows_x64_wheel_filename | @@ -41,6 +41,9 @@ windows_x64_wheel=$src_dir/$windows_x64_wheel_filename | ||
| 41 | windows_x86_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win32.whl | 41 | windows_x86_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win32.whl |
| 42 | windows_x86_wheel=$src_dir/$windows_x86_wheel_filename | 42 | windows_x86_wheel=$src_dir/$windows_x86_wheel_filename |
| 43 | 43 | ||
| 44 | +windows_arm64_wheel_filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-arm64.tar.bz2 | ||
| 45 | +windows_arm64_wheel=$src_dir/$windows_arm64_wheel_filename | ||
| 46 | + | ||
| 44 | if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then | 47 | if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then |
| 45 | echo "---linux x86_64---" | 48 | echo "---linux x86_64---" |
| 46 | cd linux | 49 | cd linux |
| @@ -54,9 +57,9 @@ if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then | @@ -54,9 +57,9 @@ if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then | ||
| 54 | unzip $linux_wheel_filename | 57 | unzip $linux_wheel_filename |
| 55 | cp -v sherpa_onnx/lib/*.so* ../ | 58 | cp -v sherpa_onnx/lib/*.so* ../ |
| 56 | cd .. | 59 | cd .. |
| 57 | - rm -v libpiper_phonemize.so libpiper_phonemize.so.1.2.0 | ||
| 58 | - rm -v libonnxruntime.so | ||
| 59 | - rm -v libcargs.so | 60 | + rm -fv libpiper_phonemize.so libpiper_phonemize.so.1.2.0 |
| 61 | + rm -fv libonnxruntime.so | ||
| 62 | + rm -fv libcargs.so | ||
| 60 | rm -rf wheel | 63 | rm -rf wheel |
| 61 | ls -lh | 64 | ls -lh |
| 62 | cd .. | 65 | cd .. |
| @@ -77,9 +80,9 @@ if [ ! -f $src_dir/macos-x64/libsherpa-onnx-core.dylib ]; then | @@ -77,9 +80,9 @@ if [ ! -f $src_dir/macos-x64/libsherpa-onnx-core.dylib ]; then | ||
| 77 | 80 | ||
| 78 | cd .. | 81 | cd .. |
| 79 | 82 | ||
| 80 | - rm -v libcargs.dylib | ||
| 81 | - rm -v libonnxruntime.dylib | ||
| 82 | - rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib | 83 | + rm -fv libcargs.dylib |
| 84 | + rm -fv libonnxruntime.dylib | ||
| 85 | + rm -fv libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib | ||
| 83 | rm -rf wheel | 86 | rm -rf wheel |
| 84 | ls -lh | 87 | ls -lh |
| 85 | cd .. | 88 | cd .. |
| @@ -100,9 +103,9 @@ if [ ! -f $src_dir/macos-arm64/libsherpa-onnx-core.dylib ]; then | @@ -100,9 +103,9 @@ if [ ! -f $src_dir/macos-arm64/libsherpa-onnx-core.dylib ]; then | ||
| 100 | 103 | ||
| 101 | cd .. | 104 | cd .. |
| 102 | 105 | ||
| 103 | - rm -v libcargs.dylib | ||
| 104 | - rm -v libonnxruntime.dylib | ||
| 105 | - rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib | 106 | + rm -fv libcargs.dylib |
| 107 | + rm -fv libonnxruntime.dylib | ||
| 108 | + rm -fv libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib | ||
| 106 | rm -rf wheel | 109 | rm -rf wheel |
| 107 | ls -lh | 110 | ls -lh |
| 108 | cd .. | 111 | cd .. |
| @@ -146,9 +149,28 @@ if [ ! -f $src_dir/windows-x86/sherpa-onnx-core.dll ]; then | @@ -146,9 +149,28 @@ if [ ! -f $src_dir/windows-x86/sherpa-onnx-core.dll ]; then | ||
| 146 | cd .. | 149 | cd .. |
| 147 | fi | 150 | fi |
| 148 | 151 | ||
| 152 | +if [ ! -f $src_dir/windows-arm64/sherpa-onnx-core.dll ]; then | ||
| 153 | + echo "---windows arm64---" | ||
| 154 | + cd windows-arm64 | ||
| 155 | + mkdir -p wheel | ||
| 156 | + cd wheel | ||
| 157 | + if [ -f $windows_arm64_wheel ]; then | ||
| 158 | + cp -v $windows_arm64_wheel . | ||
| 159 | + else | ||
| 160 | + curl -OL https://$HF_MIRROR/csukuangfj/sherpa-onnx-libs/resolve/main/windows-for-dotnet/$windows_arm64_wheel_filename | ||
| 161 | + fi | ||
| 162 | + unzip $windows_arm64_wheel_filename | ||
| 163 | + cp -v sherpa-onnx-${SHERPA_ONNX_VERSION}-win-arm64/*dll ../ | ||
| 164 | + cd .. | ||
| 165 | + | ||
| 166 | + rm -rf wheel | ||
| 167 | + ls -lh | ||
| 168 | + cd .. | ||
| 169 | +fi | ||
| 170 | + | ||
| 149 | popd | 171 | popd |
| 150 | 172 | ||
| 151 | -mkdir -p macos-x64 macos-arm64 linux windows-x64 windows-x86 all | 173 | +mkdir -p macos-x64 macos-arm64 linux windows-x64 windows-x86 windows-arm64 all |
| 152 | 174 | ||
| 153 | cp ./*.cs all | 175 | cp ./*.cs all |
| 154 | 176 | ||
| @@ -179,6 +201,11 @@ dotnet build -c Release | @@ -179,6 +201,11 @@ dotnet build -c Release | ||
| 179 | dotnet pack -c Release -o ../packages | 201 | dotnet pack -c Release -o ../packages |
| 180 | popd | 202 | popd |
| 181 | 203 | ||
| 204 | +pushd windows-arm64 | ||
| 205 | +dotnet build -c Release | ||
| 206 | +dotnet pack -c Release -o ../packages | ||
| 207 | +popd | ||
| 208 | + | ||
| 182 | pushd all | 209 | pushd all |
| 183 | dotnet build -c Release | 210 | dotnet build -c Release |
| 184 | dotnet pack -c Release -o ../packages | 211 | dotnet pack -c Release -o ../packages |
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | <OutputType>Library</OutputType> | 5 | <OutputType>Library</OutputType> |
| 6 | <LangVersion>10.0</LangVersion> | 6 | <LangVersion>10.0</LangVersion> |
| 7 | <TargetFrameworks>netstandard2.0</TargetFrameworks> | 7 | <TargetFrameworks>netstandard2.0</TargetFrameworks> |
| 8 | - <RuntimeIdentifiers>linux-x64;osx-x64;osx-arm64;win-x64;win-x86</RuntimeIdentifiers> | 8 | + <RuntimeIdentifiers>linux-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64</RuntimeIdentifiers> |
| 9 | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | 9 | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| 10 | <AssemblyName>sherpa-onnx</AssemblyName> | 10 | <AssemblyName>sherpa-onnx</AssemblyName> |
| 11 | <Version>{{ version }}</Version> | 11 | <Version>{{ version }}</Version> |
| @@ -53,6 +53,7 @@ | @@ -53,6 +53,7 @@ | ||
| 53 | <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.osx-arm64" Version="{{ version }}" /> | 53 | <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.osx-arm64" Version="{{ version }}" /> |
| 54 | <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.win-x64" Version="{{ version }}" /> | 54 | <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.win-x64" Version="{{ version }}" /> |
| 55 | <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.win-x86" Version="{{ version }}" /> | 55 | <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.win-x86" Version="{{ version }}" /> |
| 56 | + <PackageReference Include="org.k2fsa.sherpa.onnx.runtime.win-arm64" Version="{{ version }}" /> | ||
| 56 | </ItemGroup> | 57 | </ItemGroup> |
| 57 | 58 | ||
| 58 | </Project> | 59 | </Project> |
| @@ -184,7 +184,9 @@ else() | @@ -184,7 +184,9 @@ else() | ||
| 184 | target_link_libraries(sherpa-onnx-core ${onnxruntime_lib_files}) | 184 | target_link_libraries(sherpa-onnx-core ${onnxruntime_lib_files}) |
| 185 | endif() | 185 | endif() |
| 186 | 186 | ||
| 187 | -target_link_libraries(sherpa-onnx-core -lm) | 187 | +if(NOT WIN32) |
| 188 | + target_link_libraries(sherpa-onnx-core -lm) | ||
| 189 | +endif() | ||
| 188 | 190 | ||
| 189 | if(NOT BUILD_SHARED_LIBS AND APPLE) | 191 | if(NOT BUILD_SHARED_LIBS AND APPLE) |
| 190 | target_link_libraries(sherpa-onnx-core "-framework Foundation") | 192 | target_link_libraries(sherpa-onnx-core "-framework Foundation") |
-
请 注册 或 登录 后发表评论