Support MinSizeRel and RelWithDebInfo build on Windows. (#586)

This commit is contained in:
Fangjun Kuang
2024-02-20 10:22:02 +08:00
committed by GitHub
parent 3d2c7fad74
commit 5f075d0fce
6 changed files with 50 additions and 36 deletions

View File

@@ -71,10 +71,10 @@ function(download_onnxruntime)
else()
if(CMAKE_BUILD_TYPE STREQUAL Release)
include(onnxruntime-win-x86-static)
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
elseif(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
include(onnxruntime-win-x86-static-debug)
else()
message(STATUS "Support only CMAKE_BUILD_TYPE Release or Debug. Given: ${CMAKE_BUILD_TYPE}")
message(FATAL_ERROR "Support only CMAKE_BUILD_TYPE being Release, Debug, RelWithDebInfo, or MinSizeRel. Given: ${CMAKE_BUILD_TYPE}")
endif()
endif()
@@ -85,6 +85,7 @@ function(download_onnxruntime)
# for 64-bit windows
if(BUILD_SHARED_LIBS)
message(STATUS "Use dynamic onnxruntime libraries")
if(SHERPA_ONNX_ENABLE_GPU)
include(onnxruntime-win-x64-gpu)
else()
@@ -95,10 +96,10 @@ function(download_onnxruntime)
message(STATUS "Use static onnxruntime libraries")
if(CMAKE_BUILD_TYPE STREQUAL Release)
include(onnxruntime-win-x64-static)
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
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(STATUS "Support only CMAKE_BUILD_TYPE Release or Debug. Given: ${CMAKE_BUILD_TYPE}")
message(FATAL_ERROR "Support only CMAKE_BUILD_TYPE being Release, Debug, RelWithDebInfo, or MinSizeRel. Given: ${CMAKE_BUILD_TYPE}")
endif()
endif()
endif()