diff --git a/runtime/cmake/gflags.cmake b/runtime/cmake/gflags.cmake index d01eaf60a..8ddf66356 100644 --- a/runtime/cmake/gflags.cmake +++ b/runtime/cmake/gflags.cmake @@ -9,3 +9,5 @@ FetchContent_MakeAvailable(gflags) # openfst need include_directories(${gflags_BINARY_DIR}/include) + +install(FILES ${gflags_BINARY_DIR}/libgflags_nothreads.a DESTINATION lib) \ No newline at end of file diff --git a/runtime/cmake/glog.cmake b/runtime/cmake/glog.cmake index 60bd3725d..51d0ef066 100644 --- a/runtime/cmake/glog.cmake +++ b/runtime/cmake/glog.cmake @@ -28,7 +28,8 @@ endif() if(ANDROID) add_library(extern_glog INTERFACE) + add_dependencies(extern_glog gflags) else() # UNIX - add_dependencies(glog gflags) add_library(extern_glog ALIAS glog) + add_dependencies(extern_glog gflags) endif() \ No newline at end of file diff --git a/runtime/engine/common/CMakeLists.txt b/runtime/engine/common/CMakeLists.txt index 495921b2b..405479ae1 100644 --- a/runtime/engine/common/CMakeLists.txt +++ b/runtime/engine/common/CMakeLists.txt @@ -12,4 +12,8 @@ ${CMAKE_CURRENT_SOURCE_DIR}/frontend add_subdirectory(frontend) add_library(common INTERFACE) -target_link_libraries(common INTERFACE base utils kaldi-matrix frontend) \ No newline at end of file +target_link_libraries(common INTERFACE base utils kaldi-matrix frontend) +install(TARGETS base DESTINATION lib) +install(TARGETS utils DESTINATION lib) +install(TARGETS kaldi-matrix DESTINATION lib) +install(TARGETS frontend DESTINATION lib) \ No newline at end of file diff --git a/runtime/engine/vad/CMakeLists.txt b/runtime/engine/vad/CMakeLists.txt index edf18f4e3..f61c5a9a8 100644 --- a/runtime/engine/vad/CMakeLists.txt +++ b/runtime/engine/vad/CMakeLists.txt @@ -4,8 +4,4 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../ add_subdirectory(nnet) -add_subdirectory(interface) - -if(ANDROID) - add_subdirectory(jni) -endif() \ No newline at end of file +add_subdirectory(interface) \ No newline at end of file diff --git a/runtime/engine/vad/jni/CMakeLists.txt b/runtime/engine/vad/jni/CMakeLists.txt deleted file mode 100644 index dc88451fa..000000000 --- a/runtime/engine/vad/jni/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(srcs - vad_jni_interface.cc -) - -add_library(pps_vad_jni_interface ${srcs}) -target_link_libraries(pps_vad_jni_interface PUBLIC pps_vad_interface) - - -file(RELATIVE_PATH DEST_DIR ${ENGINE_ROOT} ${CMAKE_CURRENT_SOURCE_DIR}) -install(TARGETS pps_vad_jni_interface DESTINATION lib) -install(FILES vad_jni_interface.h DESTINATION include/${DEST_DIR}) \ No newline at end of file diff --git a/runtime/engine/vad/jni/vad_jni_interface.cc b/runtime/engine/vad/jni/vad_jni_interface.cc deleted file mode 100644 index 805c38f77..000000000 --- a/runtime/engine/vad/jni/vad_jni_interface.cc +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "vad/jni/vad_jni_interface.h" - -JNIEXPORT jlong JNICALL Java_com_baidu_paddlespeech_vadjni_createInstance( - JNIEnv* env, jobject thiz, jstring conf_path) { - const char* path = env->GetStringUTFChars(conf_path, JNI_FALSE); - PPSHandle_t handle = PPSVadCreateInstance(path); - - return (jlong)(handle); -} - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_destoryInstance( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance) { - PPSHandle_t handle = (PPSHandle_t)(instance); - return (jint)PPSVadDestroyInstance(handle); -} - - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_reset( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance) { - PPSHandle_t handle = (PPSHandle_t)(instance); - return (jint)PPSVadReset(handle); -} - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_chunkSizeSamples( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance) { - PPSHandle_t handle = (PPSHandle_t)(instance); - return (jint)PPSVadChunkSizeSamples(handle); -} - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_feedForward( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance, jfloatArray chunk) { - PPSHandle_t handle = (PPSHandle_t)(instance); - jsize num_elms = env->GetArrayLength(chunk); - jfloat* chunk_ptr = env->GetFloatArrayElements(chunk, JNI_FALSE); - return (jint)PPSVadFeedForward(handle, (float*)chunk_ptr, (int)num_elms); -} \ No newline at end of file diff --git a/runtime/engine/vad/jni/vad_jni_interface.h b/runtime/engine/vad/jni/vad_jni_interface.h deleted file mode 100644 index 5564f05e8..000000000 --- a/runtime/engine/vad/jni/vad_jni_interface.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// PackageName: paddlespeech.baidu.com -// ClassName: vadjni -#include - -#include "vad/interface/vad_interface.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef jlong PPSJniHandle_t; - -JNIEXPORT PPSJniHandle_t JNICALL -Java_com_baidu_paddlespeech_vadjni_createInstance(JNIEnv* env, - jobject thiz, - jstring conf_path); - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_destoryInstance( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance); - - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_reset( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance); - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_chunkSizeSamples( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance); - -// typedef enum { -// PPS_VAD_ILLEGAL = 0, // error -// PPS_VAD_SIL, // silence -// PPS_VAD_START, // start speech -// PPS_VAD_SPEECH, // in speech -// PPS_VAD_END, // end speech -// PPS_VAD_NUMSTATES, // number of states -// } PPSVadState_t; - -JNIEXPORT jint JNICALL Java_com_baidu_paddlespeech_vadjni_feedForward( - JNIEnv* env, jobject thiz, PPSJniHandle_t instance, jfloatArray chunk); - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/runtime/engine/vad/nnet/CMakeLists.txt b/runtime/engine/vad/nnet/CMakeLists.txt index aad5e3475..22c9f7602 100644 --- a/runtime/engine/vad/nnet/CMakeLists.txt +++ b/runtime/engine/vad/nnet/CMakeLists.txt @@ -8,9 +8,9 @@ target_link_libraries(pps_vad PUBLIC ${FASTDEPLOY_LIBS} common extern_glog) set(bin_name vad_nnet_main) add_executable(${bin_name} ${CMAKE_CURRENT_SOURCE_DIR}/${bin_name}.cc) -# target_link_libraries(${bin_name} ${FASTDEPLOY_LIBS} vad gflags extern_glog) target_link_libraries(${bin_name} pps_vad) file(RELATIVE_PATH DEST_DIR ${ENGINE_ROOT} ${CMAKE_CURRENT_SOURCE_DIR}) -install(TARGETS pps_vad DESTINATION lib) \ No newline at end of file +install(TARGETS pps_vad DESTINATION lib) +install(TARGETS extern_glog DESTINATION lib) \ No newline at end of file