Skip to content

Commit

Permalink
解决windwos 加载lm模型失败 (#1093)
Browse files Browse the repository at this point in the history
* fix vc compatibility

* fix windwos load lm model failed
  • Loading branch information
cdevelop authored Nov 15, 2023
1 parent 12d694f commit eff2570
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
5 changes: 4 additions & 1 deletion runtime/onnxruntime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions runtime/onnxruntime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ message("files: "${files})
if(WIN32)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/bigobj>")
endif()

add_library(funasr SHARED ${files})
Expand Down
4 changes: 3 additions & 1 deletion runtime/onnxruntime/src/bias-lm.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "bias-lm.h"

#ifdef _WIN32
#include "fst-types.cc"
#endif
namespace funasr {
void print(std::queue<StateId> &q) {
std::queue<StateId> data = q;
Expand Down
18 changes: 17 additions & 1 deletion runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,6 +28,8 @@ add_library(fst
weight.cc
${HEADER_FILES}
)
endif()

set_target_properties(fst PROPERTIES
SOVERSION "${SOVERSION}"
)
Expand Down
4 changes: 3 additions & 1 deletion runtime/websocket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

0 comments on commit eff2570

Please sign in to comment.