diff --git a/runtime/onnxruntime/CMakeLists.txt b/runtime/onnxruntime/CMakeLists.txt index f91655dd1..ab0e84224 100644 --- a/runtime/onnxruntime/CMakeLists.txt +++ b/runtime/onnxruntime/CMakeLists.txt @@ -55,7 +55,10 @@ if(ENABLE_FST) # with some patch to fix the make errors. add_subdirectory(third_party/openfst) include_directories(${openfst_SOURCE_DIR}/src/include) - + if(WIN32) + include_directories(${openfst_SOURCE_DIR}/src/lib) + endif() + endif() add_subdirectory(third_party/yaml-cpp) diff --git a/runtime/onnxruntime/src/CMakeLists.txt b/runtime/onnxruntime/src/CMakeLists.txt index 1a2ca63d8..9eac2b616 100644 --- a/runtime/onnxruntime/src/CMakeLists.txt +++ b/runtime/onnxruntime/src/CMakeLists.txt @@ -7,6 +7,7 @@ message("files: "${files}) if(WIN32) add_compile_options("$<$:/execution-charset:utf-8>") add_compile_options("$<$:/source-charset:utf-8>") +add_compile_options("$<$:/bigobj>") endif() add_library(funasr SHARED ${files}) diff --git a/runtime/onnxruntime/src/bias-lm.cpp b/runtime/onnxruntime/src/bias-lm.cpp index 5be87f82b..a652f295a 100644 --- a/runtime/onnxruntime/src/bias-lm.cpp +++ b/runtime/onnxruntime/src/bias-lm.cpp @@ -1,5 +1,7 @@ #include "bias-lm.h" - +#ifdef _WIN32 +#include "fst-types.cc" +#endif namespace funasr { void print(std::queue &q) { std::queue data = q; diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt index 9960ce955..9097bd869 100644 --- a/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt +++ b/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt @@ -1,6 +1,20 @@ FILE(GLOB HEADER_FILES ../include/fst/*.h) - +if(WIN32) +add_library(fst STATIC + compat.cc + flags.cc + fst-types.cc + fst.cc + mapped-file.cc + properties.cc + symbol-table.cc + symbol-table-ops.cc + util.cc + weight.cc + ${HEADER_FILES} +) +else() add_library(fst compat.cc flags.cc @@ -14,6 +28,8 @@ add_library(fst weight.cc ${HEADER_FILES} ) +endif() + set_target_properties(fst PROPERTIES SOVERSION "${SOVERSION}" ) diff --git a/runtime/websocket/CMakeLists.txt b/runtime/websocket/CMakeLists.txt index b23426517..a34798e5b 100644 --- a/runtime/websocket/CMakeLists.txt +++ b/runtime/websocket/CMakeLists.txt @@ -111,7 +111,9 @@ if(ENABLE_FST) # with some patch to fix the make errors. add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/openfst openfst) include_directories(${openfst_SOURCE_DIR}/src/include) - + if(WIN32) + include_directories(${openfst_SOURCE_DIR}/src/lib) + endif() endif()