Skip to content

Commit

Permalink
修复了onnxruntime在macos下编译失败的错误 (#1748)
Browse files Browse the repository at this point in the history
* Add files via upload

增加macos的编译支持

* Add files via upload

增加macos支持

* Add files via upload

target_link_directories(funasr PUBLIC ${ONNXRUNTIME_DIR}/lib)
target_link_directories(funasr PUBLIC ${FFMPEG_DIR}/lib)
添加 if(APPLE) 限制

---------

Co-authored-by: Yabin Li <wucong.lyb@alibaba-inc.com>
  • Loading branch information
szsteven008 and lyblsgo committed May 28, 2024
1 parent 7c11a0d commit bd9e630
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions runtime/onnxruntime/include/funasrruntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ _FUNASRAPI FUNASR_RESULT FunOfflineInferBuffer(FUNASR_HANDLE handle, const char*
_FUNASRAPI FUNASR_RESULT FunOfflineInfer(FUNASR_HANDLE handle, const char* sz_filename, FUNASR_MODE mode,
QM_CALLBACK fn_callback, const std::vector<std::vector<float>> &hw_emb,
int sampling_rate=16000, bool itn=true, FUNASR_DEC_HANDLE dec_handle=nullptr);
#if !defined(__APPLE__)
//#if !defined(__APPLE__)
_FUNASRAPI const std::vector<std::vector<float>> CompileHotwordEmbedding(FUNASR_HANDLE handle, std::string &hotwords, ASR_TYPE mode=ASR_OFFLINE);
#endif
//#endif

_FUNASRAPI void FunOfflineUninit(FUNASR_HANDLE handle);

Expand Down
8 changes: 8 additions & 0 deletions runtime/onnxruntime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

file(GLOB files1 "*.cpp")
if(APPLE)
file(GLOB itn_files "itn-*.cpp")
list(REMOVE_ITEM files1 ${itn_files})
endif(APPLE)
list(REMOVE_ITEM files1 "${CMAKE_CURRENT_SOURCE_DIR}/paraformer-torch.cpp")
set(files ${files1})

Expand Down Expand Up @@ -28,6 +32,10 @@ else()
set(EXTRA_LIBS pthread yaml-cpp csrc kaldi-decoder fst glog gflags avutil avcodec avformat swresample)
include_directories(${ONNXRUNTIME_DIR}/include)
include_directories(${FFMPEG_DIR}/include)
if(APPLE)
target_link_directories(funasr PUBLIC ${ONNXRUNTIME_DIR}/lib)
target_link_directories(funasr PUBLIC ${FFMPEG_DIR}/lib)
endif(APPLE)
endif()

if(GPU)
Expand Down
4 changes: 2 additions & 2 deletions runtime/onnxruntime/src/funasrruntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
return p_result;
}

#if !defined(__APPLE__)
//#if !defined(__APPLE__)
_FUNASRAPI const std::vector<std::vector<float>> CompileHotwordEmbedding(FUNASR_HANDLE handle, std::string &hotwords, ASR_TYPE mode)
{
if (mode == ASR_OFFLINE){
Expand All @@ -470,7 +470,7 @@
}

}
#endif
//#endif

// APIs for 2pass-stream Infer
_FUNASRAPI FUNASR_RESULT FunTpassInferBuffer(FUNASR_HANDLE handle, FUNASR_HANDLE online_handle, const char* sz_buf,
Expand Down

0 comments on commit bd9e630

Please sign in to comment.