Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncnn库冗余问题 #276

Closed
yyccR opened this issue Nov 7, 2023 · 2 comments
Closed

ncnn库冗余问题 #276

yyccR opened this issue Nov 7, 2023 · 2 comments

Comments

@yyccR
Copy link

yyccR commented Nov 7, 2023

作者你好,非常感谢你提供如此好用的语音识别库,使用上完全没有问题,十分流畅和准确.

但由于本人项目的特殊,有几点疑问想请教一下作者:

我在自己的项目里也有用到ncnn库,通过如下的方法引入和链接:

set(ncnn_DIR ${CMAKE_SOURCE_DIR}/libs/ncnn-xxxx-macos-vulkan/lib/cmake/ncnn)
find_package(ncnn REQUIRED)

target_link_libraries(test ncnn)

现在如果我想着项目里面引用你的库,则需要引用如下:

add_library(kaldi-native-fbank-core SHARED IMPORTED)
set_target_properties(kaldi-native-fbank-core PROPERTIES IMPORTED_LOCATION
        ${CMAKE_CURRENT_SOURCE_DIR}/sherpa/sherpa-ncnn/libkaldi-native-fbank-core.dylib)
add_library(libncnn SHARED IMPORTED)
set_target_properties(libncnn PROPERTIES IMPORTED_LOCATION
        ${CMAKE_CURRENT_SOURCE_DIR}/sherpa/sherpa-ncnn/libncnn.dylib)
add_library(libsherpa-ncnn-c-api SHARED IMPORTED)
set_target_properties(libsherpa-ncnn-c-api PROPERTIES IMPORTED_LOCATION
        ${CMAKE_CURRENT_SOURCE_DIR}/sherpa/sherpa-ncnn/libsherpa-ncnn-c-api.dylib)
add_library(libsherpa-ncnn-core SHARED IMPORTED)
set_target_properties(libsherpa-ncnn-core PROPERTIES IMPORTED_LOCATION
        ${CMAKE_CURRENT_SOURCE_DIR}/sherpa/sherpa-ncnn/libsherpa-ncnn-core.dylib)
add_library(libsherpa-ncnn-portaudio SHARED IMPORTED)
set_target_properties(libsherpa-ncnn-portaudio PROPERTIES IMPORTED_LOCATION
        ${CMAKE_CURRENT_SOURCE_DIR}/sherpa/sherpa-ncnn/libsherpa-ncnn-portaudio.dylib)

target_link_libraries(test libncnn)
target_link_libraries(test libsherpa-ncnn-portaudio)
target_link_libraries(test kaldi-native-fbank-core)
target_link_libraries(test libsherpa-ncnn-c-api)
target_link_libraries(test libsherpa-ncnn-core)

这样一来,就会在项目里冗余两份ncnn,请问我如何修改能让Sherpa链接到ncnn原本的静态库呢?而无需多编译出产物 libsherpa-ncnn-core.dylib, libncnn.dylib, libsherpa-ncnn-c-api.dylib.

非常感谢和期待你的回复.

@csukuangfj
Copy link
Collaborator

这样一来,就会在项目里冗余两份ncnn

你用一份 ncnn 就好了. 请参考 #258

我们支持官方的 ncnn , 即 tencent/master 上的代码。


而无需多编译出产物 libsherpa-ncnn-core.dylib, libncnn.dylib, libsherpa-ncnn-c-api.dylib.

这些 dylib, 不是多余的,他们与 ncnn 没有一点关系. 你总是需要编译它们的

@yyccR
Copy link
Author

yyccR commented Nov 7, 2023

好的,非常感谢,我去细看一下代码.

@yyccR yyccR closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants