diff --git a/.github/workflows/windows-x64-debug.yaml b/.github/workflows/windows-x64-debug.yaml deleted file mode 100644 index 4086b98826..0000000000 --- a/.github/workflows/windows-x64-debug.yaml +++ /dev/null @@ -1,116 +0,0 @@ -name: windows-x64-debug - -on: - push: - branches: - - master - tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' - paths: - - '.github/workflows/windows-x64-debug.yaml' - - '.github/scripts/test-online-transducer.sh' - - '.github/scripts/test-online-paraformer.sh' - - '.github/scripts/test-offline-transducer.sh' - - '.github/scripts/test-offline-ctc.sh' - - '.github/scripts/test-online-ctc.sh' - - '.github/scripts/test-offline-tts.sh' - - 'cmake/**' - - 'sherpa-onnx/csrc/*' - - workflow_dispatch: - -concurrency: - group: windows-x64-debug-${{ github.ref }} - cancel-in-progress: true - -jobs: - windows_x64_debug: - name: Windows x64 ${{ matrix.build_type }} static CRT ${{ matrix.use_static_crt }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-2022] - shared_lib: [OFF] - build_type: [Debug, MinSizeRel, RelWithDebInfo] - use_static_crt: [ON, OFF] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Update version - shell: bash - run: | - ./new-release.sh - git diff . - - - name: Set up MSVC - uses: ilammy/msvc-dev-cmd@v1 - - - name: find dumpbin - shell: bash - run: | - which dumpbin - - - name: Configure CMake - shell: bash - run: | - mkdir build - - cmake --version - - cd build - cmake \ - -A x64 \ - -D SHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ - -D SHERPA_ONNX_USE_STATIC_CRT=${{ matrix.use_static_crt }} \ - -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -D CMAKE_INSTALL_PREFIX=./install \ - .. - - - name: Check 1 - shell: bash - run: | - cd build - - cat sherpa-onnx/csrc/sherpa-onnx.vcxproj - - - name: Check 2 - shell: cmd - run: | - cd build - - findstr /R /C:"" sherpa-onnx\csrc\sherpa-onnx.vcxproj - - - name: Build sherpa-onnx for windows - shell: bash - run: | - cd build - - cmake --version - - cmake --build . --config ${{ matrix.build_type }} -- -m:2 - cmake --build . --config ${{ matrix.build_type }} --target install -- -m:2 - - ls -lh ./bin/${{ matrix.build_type }}/sherpa-onnx.exe - - - name: Show exe - shell: bash - run: | - ls -lh $PWD/build/bin/${{ matrix.build_type }} - - - name: Dump CRT dependencies - shell: cmd - run: | - dumpbin /dependents build\bin\${{ matrix.build_type }}\sherpa-onnx.exe - - - name: Test online CTC - shell: bash - run: | - export PATH=$PWD/build/bin/${{ matrix.build_type }}:$PATH - export EXE=sherpa-onnx.exe - - .github/scripts/test-online-ctc.sh diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index 5a13b4d3f1..28a4f88754 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -14,12 +14,6 @@ on: - '.github/scripts/test-offline-ctc.sh' - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - - '.github/scripts/test-audio-tagging.sh' - - '.github/scripts/test-offline-punctuation.sh' - - '.github/scripts/test-online-punctuation.sh' - - '.github/scripts/test-speaker-diarization.sh' - - '.github/scripts/test-c-api.sh' - - '.github/scripts/test-cxx-api.sh' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -31,12 +25,13 @@ concurrency: jobs: windows_x64: - name: shared-${{ matrix.shared_lib }} tts-${{ matrix.with_tts }} static CRT ${{ matrix.use_static_crt }} + name: shared-${{ matrix.shared_lib }} tts-${{ matrix.with_tts }} static CRT ${{ matrix.use_static_crt }} ${{ matrix.build_type }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [windows-2022] + build_type: [Release, Debug, MinSizeRel, RelWithDebInfo] shared_lib: [ON, OFF] with_tts: [ON, OFF] use_static_crt: [ON, OFF] @@ -46,6 +41,12 @@ jobs: with: fetch-depth: 0 + - name: Update version + shell: bash + run: | + ./new-release.sh + git diff . + - name: Set up MSVC uses: ilammy/msvc-dev-cmd@v1 @@ -54,16 +55,11 @@ jobs: run: | which dumpbin - - name: Update version - shell: bash - run: | - ./new-release.sh - git diff . - - name: Configure CMake shell: bash run: | mkdir build + cmake --version cd build @@ -71,10 +67,11 @@ jobs: -A x64 \ -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} \ -DSHERPA_ONNX_USE_STATIC_CRT=${{ matrix.use_static_crt }} \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D SHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ - -D CMAKE_BUILD_TYPE=Release \ -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ - -DCMAKE_INSTALL_PREFIX=./install \ + -D CMAKE_INSTALL_PREFIX=./install \ + -D BUILD_ESPEAK_NG_EXE=OFF \ .. - name: Check 1 @@ -93,7 +90,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: sherpa-onnx-vcxproj-release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}-static-crt-${{ matrix.use_static_crt }} + name: sherpa-onnx-vcxproj-release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}-static-crt-${{ matrix.use_static_crt }}-${{ matrix.build_type }} path: build/sherpa-onnx/csrc/sherpa-onnx.vcxproj - name: Check 3 @@ -112,27 +109,34 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: vad-whisper-c-api-vcxproj-release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}-static-crt-${{ matrix.use_static_crt }} + name: vad-whisper-c-api-vcxproj-release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}-static-crt-${{ matrix.use_static_crt }}-${{ matrix.build_type }} path: build/c-api-examples/vad-whisper-c-api.vcxproj - name: Build sherpa-onnx for windows shell: bash run: | cd build + cmake --version - cmake --build . --config Release -- -m:2 - cmake --build . --config Release --target install -- -m:2 + cmake --build . --config ${{ matrix.build_type }} -- -m:2 + cmake --build . --config ${{ matrix.build_type }} --target install -- -m:2 + + ls -lh ./bin/${{ matrix.build_type }}/sherpa-onnx.exe - ls -lh ./bin/Release/sherpa-onnx.exe + - name: Show exe + shell: bash + run: | + ls -lh $PWD/build/bin/${{ matrix.build_type }} - # - name: Setup tmate session - # if: failure() - # uses: mxschmitt/action-tmate@v3 + - name: Dump CRT dependencies + shell: cmd + run: | + dumpbin /dependents build\bin\${{ matrix.build_type }}\sherpa-onnx.exe - uses: actions/upload-artifact@v4 with: - name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}-static-crt-${{ matrix.use_static_crt }} + name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}-static-crt-${{ matrix.use_static_crt }}-${{ matrix.build_type }} path: build/install/* - name: Copy files @@ -144,15 +148,15 @@ jobs: use_static_crt=${{ matrix.use_static_crt }} if [[ $shared_lib == "ON" ]]; then if [[ $use_static_crt == ON ]]; then - suffix=shared-MT + suffix=shared-MT-${{ matrix.build_type }} else - suffix=shared-MD + suffix=shared-MD-${{ matrix.build_type }} fi else if [[ $use_static_crt == ON ]]; then - suffix=static-MT + suffix=static-MT-${{ matrix.build_type }} else - suffix=static-MD + suffix=static-MD-${{ matrix.build_type }} fi fi @@ -231,20 +235,6 @@ jobs: overwrite: true file: sherpa-onnx-*-win-x64*.tar.bz2 - - name: Show exe - shell: bash - run: | - ls -lh $PWD/build/bin/Release - - - name: Dump CRT dependencies - shell: cmd - run: | - dumpbin /dependents build\bin\Release\sherpa-onnx.exe - - # - name: Setup tmate session - # if: failure() - # uses: mxschmitt/action-tmate@v3 - - name: Test offline Moonshine for windows x64 shell: bash run: | diff --git a/cmake/onnxruntime-win-x64-static-debug.cmake b/cmake/onnxruntime-win-x64-static-debug.cmake deleted file mode 100644 index 82b8cd7e7d..0000000000 --- a/cmake/onnxruntime-win-x64-static-debug.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (c) 2022-2023 Xiaomi Corporation -message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") -message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") -message(STATUS "CMAKE_VS_PLATFORM_NAME: ${CMAKE_VS_PLATFORM_NAME}") - -if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) - message(FATAL_ERROR "This file is for Windows only. Given: ${CMAKE_SYSTEM_NAME}") -endif() - -if(NOT (CMAKE_VS_PLATFORM_NAME STREQUAL X64 OR CMAKE_VS_PLATFORM_NAME STREQUAL x64)) - message(FATAL_ERROR "This file is for Windows x64 only. Given: ${CMAKE_VS_PLATFORM_NAME}") -endif() - -if(BUILD_SHARED_LIBS) - message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") -endif() - -# Hashes for static CRT (/MT) -set(ONNXRUNTIME_HASH_MT_Debug "SHA256=efd7c3aa9fa10a380e5534ead76627790dd533142307e3fd1de2d1fba533dd90") -set(ONNXRUNTIME_HASH_MT_RelWithDebInfo "SHA256=4cf1733121eee79c9f18b048d1f5e9603079931e62af1c878c0d873ecd48900e") -set(ONNXRUNTIME_HASH_MT_MinSizeRel "SHA256=2d362a781ff98731423688ff5a50a08e1dd0e863e2de5b1d66c6595945a60735") - -# Hashes for dynamic CRT (/MD) -set(ONNXRUNTIME_HASH_MD_Debug "SHA256=68aa603aa25fd1cbe7ebef465395d0b685aa66fc8fd2df0b6d6f5a1e88621c60") -set(ONNXRUNTIME_HASH_MD_RelWithDebInfo "SHA256=ba5ae7bf3b5a29ea348f38516e7c46ff49921eb2a2e81e391f36bc932c4a7a20") -set(ONNXRUNTIME_HASH_MD_MinSizeRel "SHA256=e57978b5811fcf795e07c33eb69f32fac5cac8b848d32acf1154ce13c9cbcfd7") - -if(NOT (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel)) - message(FATAL_ERROR "This file is for building a debug version on Windows x64. Given ${CMAKE_BUILD_TYPE}") -endif() - -if(SHERPA_ONNX_USE_STATIC_CRT) - set(onnxruntime_crt "MT") -else() - set(onnxruntime_crt "MD") -endif() - -set(onnxruntime_HASH "${ONNXRUNTIME_HASH_${onnxruntime_crt}_${CMAKE_BUILD_TYPE}}") -message(STATUS "Use MSVC CRT: ${onnxruntime_crt}") - -set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.23.2/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-${CMAKE_BUILD_TYPE}-1.23.2.tar.bz2") - -# 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_lib-${onnxruntime_crt}-${CMAKE_BUILD_TYPE}-1.23.2.tar.bz2 - ${CMAKE_SOURCE_DIR}/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-${CMAKE_BUILD_TYPE}-1.23.2.tar.bz2 - ${CMAKE_BINARY_DIR}/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-${CMAKE_BUILD_TYPE}-1.23.2.tar.bz2 - /tmp/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-${CMAKE_BUILD_TYPE}-1.23.2.tar.bz2 -) - -foreach(f IN LISTS possible_file_locations) - if(EXISTS ${f}) - set(onnxruntime_URL "${f}") - file(TO_CMAKE_PATH "${onnxruntime_URL}" onnxruntime_URL) - message(STATUS "Found local downloaded onnxruntime: ${onnxruntime_URL}") - break() - endif() -endforeach() - -FetchContent_Declare(onnxruntime - URL - ${onnxruntime_URL} - URL_HASH ${onnxruntime_HASH} -) - -FetchContent_GetProperties(onnxruntime) -if(NOT onnxruntime_POPULATED) - message(STATUS "Downloading onnxruntime from ${onnxruntime_URL}") - FetchContent_Populate(onnxruntime) -endif() -message(STATUS "onnxruntime is downloaded to ${onnxruntime_SOURCE_DIR}") - -# for static libraries, we use onnxruntime_lib_files directly below -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}") -if(SHERPA_ONNX_ENABLE_PYTHON) - install(FILES ${onnxruntime_lib_files} DESTINATION ..) -else() - install(FILES ${onnxruntime_lib_files} DESTINATION lib) -endif() diff --git a/cmake/onnxruntime-win-x64-static.cmake b/cmake/onnxruntime-win-x64-static.cmake index c2dbb63f29..3a23423aab 100644 --- a/cmake/onnxruntime-win-x64-static.cmake +++ b/cmake/onnxruntime-win-x64-static.cmake @@ -15,20 +15,21 @@ if(BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -if(NOT CMAKE_BUILD_TYPE STREQUAL Release) - message(FATAL_ERROR "This file is for building a release version on Windows x64") +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$") + message(FATAL_ERROR "Supported CMAKE_BUILD_TYPE values are: Release, Debug, RelWithDebInfo, MinSizeRel. Given ${CMAKE_BUILD_TYPE}") endif() -# Determine which CRT flavor to use -# SHERPA_ONNX_USE_STATIC_CRT = ON -> MT -# SHERPA_ONNX_USE_STATIC_CRT = OFF -> MD - # Hashes for static CRT (/MT) -set(ONNXRUNTIME_HASH_MT "SHA256=c8748ef2f57faa0189c654d4058ec6df2ec5159747d3a9ca6049bf3738bbd312") - -# Hashes for static CRT (/MD) -set(ONNXRUNTIME_HASH_MD "SHA256=a1c39e1fdaa0caea76c449811417938c6d6ad42ce6265216810dc90ed4ac4502") +set(ONNXRUNTIME_HASH_MT_Release "SHA256=c853a7646f9ebb0bf900e547141ef3e68d3ec888b27756ecb5f32476a6472391") +set(ONNXRUNTIME_HASH_MT_Debug "SHA256=efd7c3aa9fa10a380e5534ead76627790dd533142307e3fd1de2d1fba533dd90") +set(ONNXRUNTIME_HASH_MT_RelWithDebInfo "SHA256=4cf1733121eee79c9f18b048d1f5e9603079931e62af1c878c0d873ecd48900e") +set(ONNXRUNTIME_HASH_MT_MinSizeRel "SHA256=2d362a781ff98731423688ff5a50a08e1dd0e863e2de5b1d66c6595945a60735") +# Hashes for dynamic CRT (/MD) +set(ONNXRUNTIME_HASH_MD_Release "SHA256=f4596146f3aea7d9c557e466eb55af1cf8bb8e9f2a291ce4c428dd93d0501e33") +set(ONNXRUNTIME_HASH_MD_Debug "SHA256=68aa603aa25fd1cbe7ebef465395d0b685aa66fc8fd2df0b6d6f5a1e88621c60") +set(ONNXRUNTIME_HASH_MD_RelWithDebInfo "SHA256=ba5ae7bf3b5a29ea348f38516e7c46ff49921eb2a2e81e391f36bc932c4a7a20") +set(ONNXRUNTIME_HASH_MD_MinSizeRel "SHA256=e57978b5811fcf795e07c33eb69f32fac5cac8b848d32acf1154ce13c9cbcfd7") if(SHERPA_ONNX_USE_STATIC_CRT) set(onnxruntime_crt "MT") @@ -38,17 +39,19 @@ endif() message(STATUS "Use MSVC CRT: ${onnxruntime_crt}") -set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.23.2/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-1.23.2.tar.bz2") -set(onnxruntime_HASH "${ONNXRUNTIME_HASH_${onnxruntime_crt}}") +set(onnxruntime_filename "onnxruntime-win-x64-static_lib-${onnxruntime_crt}-${CMAKE_BUILD_TYPE}-1.23.2.tar.bz2") +set(onnxruntime_HASH "${ONNXRUNTIME_HASH_${onnxruntime_crt}_${CMAKE_BUILD_TYPE}}") +set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.23.2/${onnxruntime_filename}") # 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_lib-${onnxruntime_crt}-1.23.2.tar.bz2 - ${CMAKE_SOURCE_DIR}/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-1.23.2.tar.bz2 - ${CMAKE_BINARY_DIR}/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-1.23.2.tar.bz2 - /tmp/onnxruntime-win-x64-static_lib-${onnxruntime_crt}-1.23.2.tar.bz2 + $ENV{HOME}/Downloads/${onnxruntime_filename} + ${CMAKE_SOURCE_DIR}/${onnxruntime_filename} + ${CMAKE_BINARY_DIR}/${onnxruntime_filename} + $ENV{TMP}/${onnxruntime_filename} + $ENV{TEMP}/${onnxruntime_filename} ) foreach(f IN LISTS possible_file_locations) diff --git a/cmake/onnxruntime-win-x64.cmake b/cmake/onnxruntime-win-x64.cmake index 778a0b8078..c2f6fba78d 100644 --- a/cmake/onnxruntime-win-x64.cmake +++ b/cmake/onnxruntime-win-x64.cmake @@ -15,8 +15,8 @@ if(NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") endif() -if(NOT (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel OR CMAKE_BUILD_TYPE STREQUAL Release)) - message(FATAL_ERROR "Please set CMAKE_BUILD_TYPE to Release, Debug, RelWithDebInfo or MinSizeRel") +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$") + message(FATAL_ERROR "Supported CMAKE_BUILD_TYPE values are: Release, Debug, RelWithDebInfo, MinSizeRel. Given ${CMAKE_BUILD_TYPE}") endif() # Hashes for static CRT (/MT) diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index b6a9d21c5b..aa317d48b1 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -107,13 +107,7 @@ function(download_onnxruntime) else() # static libraries for windows x64 message(STATUS "Use static onnxruntime libraries") - if(CMAKE_BUILD_TYPE STREQUAL Release) - include(onnxruntime-win-x64-static) - elseif(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel) - include(onnxruntime-win-x64-static-debug) - else() - message(FATAL_ERROR "Support only CMAKE_BUILD_TYPE being Release, Debug, RelWithDebInfo, or MinSizeRel. Given: ${CMAKE_BUILD_TYPE}") - endif() + include(onnxruntime-win-x64-static) endif() endif() else()