From cdeaee5e6360e35dcc1fd5b57938bc1a197185e9 Mon Sep 17 00:00:00 2001 From: MarsMeng <1057010459@qq.com> Date: Wed, 15 Mar 2023 09:07:08 +0000 Subject: [PATCH] fix vad and cls cmake --- runtime/CMakeLists.txt | 4 +--- runtime/build.sh | 18 +++++++++++------- runtime/cmake/glog.cmake | 4 ++-- runtime/engine/cls/nnet/CMakeLists.txt | 2 +- runtime/engine/cls/nnet/panns_nnet.cc | 2 +- runtime/engine/cls/nnet/panns_nnet_main.cc | 1 + runtime/engine/vad/nnet/CMakeLists.txt | 4 ++-- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index efeb62188..e48292e86 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -72,9 +72,7 @@ if(WITH_TESTING) endif() # fastdeploy -if(NOT WITH_ASR) - include(fastdeploy) -endif() +include(fastdeploy) if(WITH_ASR) # openfst diff --git a/runtime/build.sh b/runtime/build.sh index 4a27766a9..9c6a0a371 100755 --- a/runtime/build.sh +++ b/runtime/build.sh @@ -4,17 +4,21 @@ set -xe BUILD_ROOT=build/Linux BUILD_DIR=${BUILD_ROOT}/x86_64 -mkdir -p ${BUILD_DIR} +BUILD_TYPE=Release +#BUILD_TYPE=Debug +BUILD_SO=OFF +BUILD_ASR=OFF +BUILD_CLS=ON +BUILD_VAD=ON # the build script had verified in the paddlepaddle docker image. # please follow the instruction below to install PaddlePaddle image. # https://www.paddlepaddle.org.cn/documentation/docs/zh/install/docker/linux-docker.html #cmake -B build -DBUILD_SHARED_LIBS=OFF -DWITH_ASR=OFF -DWITH_CLS=OFF -DWITH_VAD=ON -DFASTDEPLOY_INSTALL_DIR=/workspace/zhanghui/paddle/FastDeploy/build/Android/arm64-v8a-api-21/install cmake -B ${BUILD_DIR} \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=OFF \ - -DWITH_ASR=OFF \ - -DWITH_CLS=OFF \ - -DWITH_VAD=ON \ - -DFASTDEPLOY_INSTALL_DIR=/workspace/zhanghui/paddle/FastDeploy/build/Linux/x86_64/install + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DBUILD_SHARED_LIBS=${BUILD_SO} \ + -DWITH_ASR=${BUILD_ASR} \ + -DWITH_CLS=${BUILD_CLS} \ + -DWITH_VAD=${BUILD_VAD} cmake --build ${BUILD_DIR} -j diff --git a/runtime/cmake/glog.cmake b/runtime/cmake/glog.cmake index 51d0ef066..898562c77 100644 --- a/runtime/cmake/glog.cmake +++ b/runtime/cmake/glog.cmake @@ -28,8 +28,8 @@ endif() if(ANDROID) add_library(extern_glog INTERFACE) - add_dependencies(extern_glog gflags) + add_dependencies(glog gflags) else() # UNIX add_library(extern_glog ALIAS glog) - add_dependencies(extern_glog gflags) + add_dependencies(glog gflags) endif() \ No newline at end of file diff --git a/runtime/engine/cls/nnet/CMakeLists.txt b/runtime/engine/cls/nnet/CMakeLists.txt index d331d31a6..5d9f05613 100644 --- a/runtime/engine/cls/nnet/CMakeLists.txt +++ b/runtime/engine/cls/nnet/CMakeLists.txt @@ -8,4 +8,4 @@ target_link_libraries(cls INTERFACE -static-libstdc++;-Wl,-Bsymbolic ${FASTDEPLO set(bin_name panns_nnet_main) add_executable(${bin_name} ${CMAKE_CURRENT_SOURCE_DIR}/${bin_name}.cc) -target_link_libraries(${bin_name} -static-libstdc++;-Wl,-Bsymbolic gflags glog) +target_link_libraries(${bin_name} -static-libstdc++;-Wl,-Bsymbolic gflags glog cls) diff --git a/runtime/engine/cls/nnet/panns_nnet.cc b/runtime/engine/cls/nnet/panns_nnet.cc index bd2265d42..2edf71f2e 100644 --- a/runtime/engine/cls/nnet/panns_nnet.cc +++ b/runtime/engine/cls/nnet/panns_nnet.cc @@ -67,7 +67,7 @@ int ClsNnet::Init(const ClsNnetConf& conf) { runtime_option.UsePaddleInferBackend(); #endif runtime_option.SetCpuThreadNum(conf.num_cpu_thread_); - runtime_option.DeletePaddleBackendPass("simplify_with_basic_ops_pass"); + // runtime_option.DeletePaddleBackendPass("simplify_with_basic_ops_pass"); runtime_ = std::unique_ptr(new fastdeploy::Runtime()); if (!runtime_->Init(runtime_option)) { std::cerr << "--- Init FastDeploy Runitme Failed! " diff --git a/runtime/engine/cls/nnet/panns_nnet_main.cc b/runtime/engine/cls/nnet/panns_nnet_main.cc index 14f91fc71..440720823 100644 --- a/runtime/engine/cls/nnet/panns_nnet_main.cc +++ b/runtime/engine/cls/nnet/panns_nnet_main.cc @@ -16,6 +16,7 @@ #include #include "base/flags.h" +#include "base/log.h" #include "cls/nnet/panns_interface.h" DEFINE_string(conf_path, "", "config path"); diff --git a/runtime/engine/vad/nnet/CMakeLists.txt b/runtime/engine/vad/nnet/CMakeLists.txt index 22c9f7602..73749599e 100644 --- a/runtime/engine/vad/nnet/CMakeLists.txt +++ b/runtime/engine/vad/nnet/CMakeLists.txt @@ -3,7 +3,7 @@ set(srcs ) add_library(pps_vad ${srcs}) -target_link_libraries(pps_vad PUBLIC ${FASTDEPLOY_LIBS} common extern_glog) +target_link_libraries(pps_vad PUBLIC ${FASTDEPLOY_LIBS} common glog) set(bin_name vad_nnet_main) @@ -13,4 +13,4 @@ target_link_libraries(${bin_name} pps_vad) file(RELATIVE_PATH DEST_DIR ${ENGINE_ROOT} ${CMAKE_CURRENT_SOURCE_DIR}) install(TARGETS pps_vad DESTINATION lib) -install(TARGETS extern_glog DESTINATION lib) \ No newline at end of file +install(TARGETS glog DESTINATION lib) \ No newline at end of file