You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.0 KiB

  1. add_custom_command(
  2. OUTPUT ${PROTO_DIR}/helloworld.pb.cc
  3. ${PROTO_DIR}/helloworld.pb.h
  4. ${PROTO_DIR}/helloworld.grpc.pb.cc
  5. ${PROTO_DIR}/helloworld.grpc.pb.h
  6. COMMAND ${protobuf_BINARY_DIR}/protoc
  7. ARGS --grpc_out "${PROTO_DIR}"
  8. --cpp_out "${PROTO_DIR}"
  9. -I "${PROTO_DIR}"
  10. --plugin=protoc-gen-grpc=${grpc_BINARY_DIR}/grpc_cpp_plugin
  11. helloworld.proto)
  12. message("${BoldGreen}add files at ${PROTO_DIR} successfully!${ColourReset}")
  13. add_library(test2_grpc STATIC
  14. ${PROTO_DIR}/helloworld.pb.cc
  15. ${PROTO_DIR}/helloworld.pb.h
  16. ${PROTO_DIR}/helloworld.grpc.pb.cc
  17. ${PROTO_DIR}/helloworld.grpc.pb.h)
  18. target_link_libraries(wenet_proto PUBLIC ${third_party_libraries})
  19. foreach(_target
  20. greeter_client greeter_server
  21. greeter_async_client greeter_async_client2 greeter_async_server)
  22. add_executable(${_target} "${_target}.cc")
  23. target_link_libraries(${_target} test2_grpc ${third_party_libraries})
  24. endforeach()