Committed by
GitHub
Support MinSizeRel and RelWithDebInfo build on Windows. (#586)
正在显示
6 个修改的文件
包含
50 行增加
和
36 行删除
| @@ -40,13 +40,14 @@ concurrency: | @@ -40,13 +40,14 @@ concurrency: | ||
| 40 | 40 | ||
| 41 | jobs: | 41 | jobs: |
| 42 | windows_x64_debug: | 42 | windows_x64_debug: |
| 43 | - name: Windows x64 debug | 43 | + name: Windows x64 ${{ matrix.build_type }} |
| 44 | runs-on: ${{ matrix.os }} | 44 | runs-on: ${{ matrix.os }} |
| 45 | strategy: | 45 | strategy: |
| 46 | fail-fast: false | 46 | fail-fast: false |
| 47 | matrix: | 47 | matrix: |
| 48 | os: [windows-latest] | 48 | os: [windows-latest] |
| 49 | shared_lib: [OFF] | 49 | shared_lib: [OFF] |
| 50 | + build_type: [Debug, MinSizeRel, RelWithDebInfo] | ||
| 50 | 51 | ||
| 51 | steps: | 52 | steps: |
| 52 | - uses: actions/checkout@v4 | 53 | - uses: actions/checkout@v4 |
| @@ -58,21 +59,21 @@ jobs: | @@ -58,21 +59,21 @@ jobs: | ||
| 58 | run: | | 59 | run: | |
| 59 | mkdir build | 60 | mkdir build |
| 60 | cd build | 61 | cd build |
| 61 | - cmake -A x64 -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. | 62 | + cmake -A x64 -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. |
| 62 | 63 | ||
| 63 | - name: Build sherpa-onnx for windows | 64 | - name: Build sherpa-onnx for windows |
| 64 | shell: bash | 65 | shell: bash |
| 65 | run: | | 66 | run: | |
| 66 | cd build | 67 | cd build |
| 67 | - cmake --build . --config Debug -- -m:2 | ||
| 68 | - cmake --build . --config Debug --target install -- -m:2 | 68 | + cmake --build . --config ${{ matrix.build_type }} -- -m:2 |
| 69 | + cmake --build . --config ${{ matrix.build_type }} --target install -- -m:2 | ||
| 69 | 70 | ||
| 70 | - ls -lh ./bin/Debug/sherpa-onnx.exe | 71 | + ls -lh ./bin/${{ matrix.build_type }}/sherpa-onnx.exe |
| 71 | 72 | ||
| 72 | - name: Test online CTC | 73 | - name: Test online CTC |
| 73 | shell: bash | 74 | shell: bash |
| 74 | run: | | 75 | run: | |
| 75 | - export PATH=$PWD/build/bin/Debug:$PATH | 76 | + export PATH=$PWD/build/bin/${{ matrix.build_type }}:$PATH |
| 76 | export EXE=sherpa-onnx.exe | 77 | export EXE=sherpa-onnx.exe |
| 77 | 78 | ||
| 78 | .github/scripts/test-online-ctc.sh | 79 | .github/scripts/test-online-ctc.sh |
| @@ -40,13 +40,14 @@ concurrency: | @@ -40,13 +40,14 @@ concurrency: | ||
| 40 | 40 | ||
| 41 | jobs: | 41 | jobs: |
| 42 | windows_x86_debug: | 42 | windows_x86_debug: |
| 43 | - name: Windows x86 debug | 43 | + name: Windows x86 ${{ matrix.build_type }} |
| 44 | runs-on: ${{ matrix.os }} | 44 | runs-on: ${{ matrix.os }} |
| 45 | strategy: | 45 | strategy: |
| 46 | fail-fast: false | 46 | fail-fast: false |
| 47 | matrix: | 47 | matrix: |
| 48 | os: [windows-latest] | 48 | os: [windows-latest] |
| 49 | shared_lib: [OFF] | 49 | shared_lib: [OFF] |
| 50 | + build_type: [Debug, MinSizeRel, RelWithDebInfo] | ||
| 50 | 51 | ||
| 51 | steps: | 52 | steps: |
| 52 | - uses: actions/checkout@v4 | 53 | - uses: actions/checkout@v4 |
| @@ -58,21 +59,21 @@ jobs: | @@ -58,21 +59,21 @@ jobs: | ||
| 58 | run: | | 59 | run: | |
| 59 | mkdir build | 60 | mkdir build |
| 60 | cd build | 61 | cd build |
| 61 | - cmake -A Win32 -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -D CMAKE_INSTALL_PREFIX=./install .. | 62 | + cmake -A Win32 -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -D CMAKE_INSTALL_PREFIX=./install .. |
| 62 | 63 | ||
| 63 | - name: Build sherpa-onnx for windows | 64 | - name: Build sherpa-onnx for windows |
| 64 | shell: bash | 65 | shell: bash |
| 65 | run: | | 66 | run: | |
| 66 | cd build | 67 | cd build |
| 67 | - cmake --build . --config Debug -- -m:2 | ||
| 68 | - cmake --build . --config Debug --target install -- -m:2 | 68 | + cmake --build . --config ${{ matrix.build_type }} -- -m:2 |
| 69 | + cmake --build . --config ${{ matrix.build_type }} --target install -- -m:2 | ||
| 69 | 70 | ||
| 70 | - ls -lh ./bin/Debug/sherpa-onnx.exe | 71 | + ls -lh ./bin/${{ matrix.build_type }}/sherpa-onnx.exe |
| 71 | 72 | ||
| 72 | - name: Test online CTC | 73 | - name: Test online CTC |
| 73 | shell: bash | 74 | shell: bash |
| 74 | run: | | 75 | run: | |
| 75 | - export PATH=$PWD/build/bin/Debug:$PATH | 76 | + export PATH=$PWD/build/bin/${{ matrix.build_type }}:$PATH |
| 76 | export EXE=sherpa-onnx.exe | 77 | export EXE=sherpa-onnx.exe |
| 77 | 78 | ||
| 78 | .github/scripts/test-online-ctc.sh | 79 | .github/scripts/test-online-ctc.sh |
| @@ -86,6 +86,8 @@ if(NOT BUILD_SHARED_LIBS AND MSVC) | @@ -86,6 +86,8 @@ if(NOT BUILD_SHARED_LIBS AND MSVC) | ||
| 86 | $<$<CONFIG:>:/MT> #---------| | 86 | $<$<CONFIG:>:/MT> #---------| |
| 87 | $<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries | 87 | $<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries |
| 88 | $<$<CONFIG:Release>:/MT> #--| | 88 | $<$<CONFIG:Release>:/MT> #--| |
| 89 | + $<$<CONFIG:RelWithDebInfo>:/MT> | ||
| 90 | + $<$<CONFIG:MinSizeRel>:/MT> | ||
| 89 | ) | 91 | ) |
| 90 | endif() | 92 | endif() |
| 91 | endif() | 93 | endif() |
| @@ -15,22 +15,26 @@ if(BUILD_SHARED_LIBS) | @@ -15,22 +15,26 @@ if(BUILD_SHARED_LIBS) | ||
| 15 | message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") | 15 | message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") |
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
| 18 | -if(NOT CMAKE_BUILD_TYPE STREQUAL Debug) | ||
| 19 | - message(FATAL_ERROR "This file is for building a debug version on Windows x64") | 18 | +set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.0/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2") |
| 19 | +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2") | ||
| 20 | +if(CMAKE_BUILD_TYPE STREQUAL Debug) | ||
| 21 | + set(onnxruntime_HASH "SHA256=daef674f160044cf9f4c27d615eaa032f93c4ed6b8d2753bb91b4b37ba40349f") | ||
| 22 | +elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) | ||
| 23 | + set(onnxruntime_HASH "SHA256=3b580429702e6f471b0899f4f1eede68c0c394aa01cd00376562c2a2e8224d72") | ||
| 24 | +elseif(CMAKE_BUILD_TYPE STREQUAL MinSizeRel) | ||
| 25 | + set(onnxruntime_HASH "SHA256=2777b1a01355b94760388eb48dbf9900f5decf2a0bd358418806138a687db6f0") | ||
| 26 | +else() | ||
| 27 | + message(FATAL_ERROR "This file is for building a debug version on Windows x64. Given ${CMAKE_BUILD_TYPE}") | ||
| 20 | endif() | 28 | endif() |
| 21 | 29 | ||
| 22 | -set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.0/onnxruntime-win-x64-static_lib-debug-1.17.0.tar.bz2") | ||
| 23 | -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x64-static_lib-debug-1.17.0.tar.bz2") | ||
| 24 | -set(onnxruntime_HASH "SHA256=6010bbab913cee3f11c421aeff9d173980623da6e72e88078396839a26d65c98") | ||
| 25 | - | ||
| 26 | # If you don't have access to the Internet, | 30 | # If you don't have access to the Internet, |
| 27 | # please download onnxruntime to one of the following locations. | 31 | # please download onnxruntime to one of the following locations. |
| 28 | # You can add more if you want. | 32 | # You can add more if you want. |
| 29 | set(possible_file_locations | 33 | set(possible_file_locations |
| 30 | - $ENV{HOME}/Downloads/onnxruntime-win-x64-static_lib-debug-1.17.0.tar.bz2 | ||
| 31 | - ${CMAKE_SOURCE_DIR}/onnxruntime-win-x64-static_lib-debug-1.17.0.tar.bz2 | ||
| 32 | - ${CMAKE_BINARY_DIR}/onnxruntime-win-x64-static_lib-debug-1.17.0.tar.bz2 | ||
| 33 | - /tmp/onnxruntime-win-x64-static_lib-debug-1.17.0.tar.bz2 | 34 | + $ENV{HOME}/Downloads/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 |
| 35 | + ${CMAKE_SOURCE_DIR}/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 | ||
| 36 | + ${CMAKE_BINARY_DIR}/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 | ||
| 37 | + /tmp/onnxruntime-win-x64-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 | ||
| 34 | ) | 38 | ) |
| 35 | 39 | ||
| 36 | foreach(f IN LISTS possible_file_locations) | 40 | foreach(f IN LISTS possible_file_locations) |
| @@ -15,22 +15,27 @@ if(BUILD_SHARED_LIBS) | @@ -15,22 +15,27 @@ if(BUILD_SHARED_LIBS) | ||
| 15 | message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") | 15 | message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") |
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
| 18 | -if(NOT CMAKE_BUILD_TYPE STREQUAL Debug) | ||
| 19 | - message(FATAL_ERROR "This file is for building a debug version on Windows x86") | ||
| 20 | -endif() | ||
| 21 | 18 | ||
| 22 | -set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.0/onnxruntime-win-x86-static_lib-debug-1.17.0.tar.bz2") | ||
| 23 | -set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static_lib-debug-1.17.0.tar.bz2") | ||
| 24 | -set(onnxruntime_HASH "SHA256=aa18677dd45338a90fc1bc14c86fe1e8a21f63913d40b3644924f5b24654218e") | 19 | +set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.17.0/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2") |
| 20 | +set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2") | ||
| 21 | +if(CMAKE_BUILD_TYPE STREQUAL Debug) | ||
| 22 | + set(onnxruntime_HASH "SHA256=7ebf676b4cae50ae4c203ca54ae2341d7c7aeae66a965a85610b254d24effee3") | ||
| 23 | +elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) | ||
| 24 | + set(onnxruntime_HASH "SHA256=bcb1dd68643baf011dc519f938c61b90556f354c6e6ce801e3f08a350d51b689") | ||
| 25 | +elseif(CMAKE_BUILD_TYPE STREQUAL MinSizeRel) | ||
| 26 | + set(onnxruntime_HASH "SHA256=a73a42cbff851b1ee2ec037dd3f4254978516252bc353a7ce86d12030ba73dec") | ||
| 27 | +else() | ||
| 28 | + message(FATAL_ERROR "This file is for building a debug version on Windows x86. Given ${CMAKE_BUILD_TYPE}") | ||
| 29 | +endif() | ||
| 25 | 30 | ||
| 26 | # If you don't have access to the Internet, | 31 | # If you don't have access to the Internet, |
| 27 | # please download onnxruntime to one of the following locations. | 32 | # please download onnxruntime to one of the following locations. |
| 28 | # You can add more if you want. | 33 | # You can add more if you want. |
| 29 | set(possible_file_locations | 34 | set(possible_file_locations |
| 30 | - $ENV{HOME}/Downloads/onnxruntime-win-x86-static_lib-debug-1.17.0.tar.bz2 | ||
| 31 | - ${CMAKE_SOURCE_DIR}/onnxruntime-win-x86-static_lib-debug-1.17.0.tar.bz2 | ||
| 32 | - ${CMAKE_BINARY_DIR}/onnxruntime-win-x86-static_lib-debug-1.17.0.tar.bz2 | ||
| 33 | - /tmp/onnxruntime-win-x86-static_lib-debug-1.17.0.tar.bz2 | 35 | + $ENV{HOME}/Downloads/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 |
| 36 | + ${CMAKE_SOURCE_DIR}/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 | ||
| 37 | + ${CMAKE_BINARY_DIR}/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 | ||
| 38 | + /tmp/onnxruntime-win-x86-static_lib-${CMAKE_BUILD_TYPE}-1.17.0.tar.bz2 | ||
| 34 | ) | 39 | ) |
| 35 | 40 | ||
| 36 | foreach(f IN LISTS possible_file_locations) | 41 | foreach(f IN LISTS possible_file_locations) |
| @@ -71,10 +71,10 @@ function(download_onnxruntime) | @@ -71,10 +71,10 @@ function(download_onnxruntime) | ||
| 71 | else() | 71 | else() |
| 72 | if(CMAKE_BUILD_TYPE STREQUAL Release) | 72 | if(CMAKE_BUILD_TYPE STREQUAL Release) |
| 73 | include(onnxruntime-win-x86-static) | 73 | include(onnxruntime-win-x86-static) |
| 74 | - elseif(CMAKE_BUILD_TYPE STREQUAL Debug) | 74 | + elseif(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel) |
| 75 | include(onnxruntime-win-x86-static-debug) | 75 | include(onnxruntime-win-x86-static-debug) |
| 76 | else() | 76 | else() |
| 77 | - message(STATUS "Support only CMAKE_BUILD_TYPE Release or Debug. Given: ${CMAKE_BUILD_TYPE}") | 77 | + message(FATAL_ERROR "Support only CMAKE_BUILD_TYPE being Release, Debug, RelWithDebInfo, or MinSizeRel. Given: ${CMAKE_BUILD_TYPE}") |
| 78 | endif() | 78 | endif() |
| 79 | endif() | 79 | endif() |
| 80 | 80 | ||
| @@ -85,6 +85,7 @@ function(download_onnxruntime) | @@ -85,6 +85,7 @@ function(download_onnxruntime) | ||
| 85 | # for 64-bit windows | 85 | # for 64-bit windows |
| 86 | 86 | ||
| 87 | if(BUILD_SHARED_LIBS) | 87 | if(BUILD_SHARED_LIBS) |
| 88 | + message(STATUS "Use dynamic onnxruntime libraries") | ||
| 88 | if(SHERPA_ONNX_ENABLE_GPU) | 89 | if(SHERPA_ONNX_ENABLE_GPU) |
| 89 | include(onnxruntime-win-x64-gpu) | 90 | include(onnxruntime-win-x64-gpu) |
| 90 | else() | 91 | else() |
| @@ -95,10 +96,10 @@ function(download_onnxruntime) | @@ -95,10 +96,10 @@ function(download_onnxruntime) | ||
| 95 | message(STATUS "Use static onnxruntime libraries") | 96 | message(STATUS "Use static onnxruntime libraries") |
| 96 | if(CMAKE_BUILD_TYPE STREQUAL Release) | 97 | if(CMAKE_BUILD_TYPE STREQUAL Release) |
| 97 | include(onnxruntime-win-x64-static) | 98 | include(onnxruntime-win-x64-static) |
| 98 | - elseif(CMAKE_BUILD_TYPE STREQUAL Debug) | 99 | + elseif(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel) |
| 99 | include(onnxruntime-win-x64-static-debug) | 100 | include(onnxruntime-win-x64-static-debug) |
| 100 | else() | 101 | else() |
| 101 | - message(STATUS "Support only CMAKE_BUILD_TYPE Release or Debug. Given: ${CMAKE_BUILD_TYPE}") | 102 | + message(FATAL_ERROR "Support only CMAKE_BUILD_TYPE being Release, Debug, RelWithDebInfo, or MinSizeRel. Given: ${CMAKE_BUILD_TYPE}") |
| 102 | endif() | 103 | endif() |
| 103 | endif() | 104 | endif() |
| 104 | endif() | 105 | endif() |
-
请 注册 或 登录 后发表评论