diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a5b4f3..92de3ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ option(GRPC "whether to build with gRPC" ON) option(ONNX "whether to build with ONNX" ON) option(CLEAN_CMAKE_CACHE "是否清空cmake缓存重新构建" ON) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-linux) #清空缓存 if(CLEAN_CMAKE_CACHE) @@ -31,7 +30,6 @@ endif() include(openfst) #wenet个人项目内容 - include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/kaldi diff --git a/bin_test_grpc/CMakeLists.txt b/bin_test_grpc/CMakeLists.txt index 3f1268c..af4fa21 100644 --- a/bin_test_grpc/CMakeLists.txt +++ b/bin_test_grpc/CMakeLists.txt @@ -8,7 +8,7 @@ set(BoldGreen "${Esc}[1;32m") set(BoldRed "${Esc}[31m") set(LIB_BASE_DIR /root/CXX_ENVS/wenet_runtime) # 运行参数 -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fPIC") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread -fPIC") include(../cmake-linux/grpc.cmake) @@ -32,11 +32,12 @@ add_custom_command( --plugin=protoc-gen-grpc=${GRPC_BINARY_DIR}/grpc_cpp_plugin helloworld.proto) -add_library(hello_proto +add_library(hello_proto SHARED ${PROTO_DIR}/helloworld.pb.cc ${PROTO_DIR}/helloworld.pb.h ${PROTO_DIR}/helloworld.grpc.pb.cc ${PROTO_DIR}/helloworld.grpc.pb.h) + target_link_libraries(hello_proto ${REFLECTION} ${GRPC_GRPCPP} diff --git a/cmake-linux/grpc.cmake b/cmake-linux/grpc.cmake index ddc4cd5..6ca275a 100644 --- a/cmake-linux/grpc.cmake +++ b/cmake-linux/grpc.cmake @@ -2,7 +2,7 @@ # grpc version : v1.47.3 set(GRPC_ROOT "${LIB_BASE_DIR}/grpc-build") function(GRPC_INSTALL DEST) - # install grpc + # 建议手动构建,不手动构建容易出BUG if(NOT EXISTS ${GRPC_ROOT}) execute_process(COMMAND mkdir -p "${GRPC_ROOT}") else () @@ -26,7 +26,7 @@ function(GRPC_INSTALL DEST) message("${BoldGreen}GRPC Installed !${ColourReset}") endfunction() -set(CMAKE_CXX_STANDARD 14) + set(protobuf_MODULE_COMPATIBLE TRUE) list(APPEND CMAKE_PREFIX_PATH "${GRPC_ROOT}/lib/cmake/protobuf/") find_package(Protobuf CONFIG REQUIRED) diff --git a/grpc/CMakeLists.txt b/grpc/CMakeLists.txt index 1c5308e..ed8a346 100644 --- a/grpc/CMakeLists.txt +++ b/grpc/CMakeLists.txt @@ -5,11 +5,11 @@ add_custom_command( ${PROTO_DIR}/wenet.pb.h ${PROTO_DIR}/wenet.grpc.pb.cc ${PROTO_DIR}/wenet.grpc.pb.h - COMMAND ${grpc_BINARY_DIR}/protoc + COMMAND ${PROTOBUF_PROTOC} ARGS --grpc_out "${PROTO_DIR}" --cpp_out "${PROTO_DIR}" -I "${PROTO_DIR}" - --plugin=protoc-gen-grpc=${grpc_BINARY_DIR}/grpc_cpp_plugin + --plugin=protoc-gen-grpc=${GRPC_BINARY_DIR}/grpc_cpp_plugin wenet.proto) # grpc_server/client @@ -21,4 +21,6 @@ add_library(wenet_grpc STATIC wenet.pb.cc wenet.grpc.pb.cc ) -target_link_libraries(wenet_grpc PUBLIC ${third_party_libraries} decoder) +target_link_libraries(wenet_grpc PUBLIC ${REFLECTION} + ${GRPC_GRPCPP} + ${PROTOBUF_LIBPROTOBUF} decoder) diff --git a/post_processor/CMakeLists.txt b/post_processor/CMakeLists.txt index 54e9c12..6e416c2 100644 --- a/post_processor/CMakeLists.txt +++ b/post_processor/CMakeLists.txt @@ -8,9 +8,9 @@ add_library(wetext_processor STATIC ) target_link_libraries(wetext_processor PUBLIC dl fst wetext_utils) -add_executable(processor_main processor/processor_main.cc) - -target_link_libraries(processor_main PUBLIC wetext_processor) +#add_executable(processor_main processor/processor_main.cc) +# +#target_link_libraries(processor_main PUBLIC wetext_processor) add_library(post_processor STATIC post_processor.cc