Skip to content

Commit

Permalink
Update the gRPC inports.
Browse files Browse the repository at this point in the history
<grpc++/*.h> has been deprecated in favor of <grpcpp/*.h>.
Include all of grpcpp.h to avoid inclusion issues.
Import <grpcpp/support/sync_stream.h> to get the streaming APIs.
  • Loading branch information
rbost committed Nov 14, 2019
1 parent be28a29 commit 2c2468e
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ci/install_grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ normal=$(tput sgr0)
green=$(tput setaf 2)


if [ -d "$INSTALL_DIR/include/google" ] && [ -d "$INSTALL_DIR/include/grpc" ] && [ -d "$INSTALL_DIR/include/grpc++" ] && [ -f "$INSTALL_DIR/lib/libprotobuf.a" ] && [ -f "$INSTALL_DIR/lib/libgrpc.a" ] && [ -f "$INSTALL_DIR/bin/protoc" ]; then
if [ -d "$INSTALL_DIR/include/google" ] && [ -d "$INSTALL_DIR/include/grpc" ] && [ -d "$INSTALL_DIR/include/grpcpp" ] && [ -f "$INSTALL_DIR/lib/libprotobuf.a" ] && [ -f "$INSTALL_DIR/lib/libgrpc.a" ] && [ -f "$INSTALL_DIR/bin/protoc" ]; then
echo "${bold}${green}gRPC is already installed${normal}"
else
echo "${bold}${green}Install gRPC${normal}"
Expand Down
6 changes: 5 additions & 1 deletion cmake/FindGRPC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ endif()
find_path(GRPC_INCLUDE_DIR grpc/grpc.h)
mark_as_advanced(GRPC_INCLUDE_DIR)

# Find gRPC C++ include directory
find_path(GRPCPP_INCLUDE_DIR grpcpp/grpcpp.h)
mark_as_advanced(GRPCPP_INCLUDE_DIR)

# Find gRPC library
find_library(GRPC_LIBRARY NAMES grpc)
mark_as_advanced(GRPC_LIBRARY)
Expand All @@ -100,7 +104,7 @@ find_library(GRPC_GRPC++_LIBRARY NAMES grpc++)
mark_as_advanced(GRPC_GRPC++_LIBRARY)
add_library(gRPC::grpc++ UNKNOWN IMPORTED)
set_target_properties(gRPC::grpc++ PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${GRPC_INCLUDE_DIR}
INTERFACE_INCLUDE_DIRECTORIES ${GRPCPP_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES gRPC::grpc
IMPORTED_LOCATION ${GRPC_GRPC++_LIBRARY}
)
Expand Down
5 changes: 2 additions & 3 deletions lib/diana/client_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@

#include <sse/dbparser/json/DBParserJSON.h>

#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/security/credentials.h>
#include <grpc/grpc.h>

#include <grpcpp/grpcpp.h>

#include <chrono>
#include <fstream>
#include <iostream>
Expand Down
6 changes: 2 additions & 4 deletions lib/diana/server_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@

#include <sse/crypto/wrapper.hpp>

#include <grpc++/security/server_credentials.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc/grpc.h>

#include <grpcpp/grpcpp.h>

#include <atomic>
#include <fstream>
#include <thread>
Expand Down
3 changes: 1 addition & 2 deletions lib/diana/server_runner_private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

#include <sse/crypto/wrapper.hpp>

#include <grpc++/server.h>
#include <grpc++/server_context.h>
#include <grpcpp/grpcpp.h>

#include <memory>
#include <mutex>
Expand Down
5 changes: 3 additions & 2 deletions lib/include/sse/runners/diana/client_runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#include <sse/crypto/wrapper.hpp>

#include <google/protobuf/empty.pb.h> // For ::google::protobuf::Empty
#include <grpc++/channel.h>
#include <grpc++/completion_queue.h>

#include <grpcpp/grpcpp.h>
#include <grpcpp/support/sync_stream.h>

#include <atomic>
#include <condition_variable>
Expand Down
2 changes: 1 addition & 1 deletion lib/include/sse/runners/diana/server_runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <sse/schemes/diana/diana_server.hpp>

#include <grpc++/server.h>
#include <grpcpp/grpcpp.h>

#include <mutex>
#include <string>
Expand Down
5 changes: 3 additions & 2 deletions lib/include/sse/runners/sophos/sophos_client_runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#include <sse/schemes/sophos/sophos_client.hpp>

#include <google/protobuf/empty.pb.h> // For ::google::protobuf::Empty
#include <grpc++/channel.h>
#include <grpc++/completion_queue.h>

#include <grpcpp/grpcpp.h>
#include <grpcpp/support/sync_stream.h>

#include <atomic>
#include <condition_variable>
Expand Down
3 changes: 1 addition & 2 deletions lib/include/sse/runners/sophos/sophos_server_runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

#pragma once

#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpcpp/grpcpp.h>

#include <string>

Expand Down
4 changes: 2 additions & 2 deletions lib/sophos/sophos_client_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

#include <sse/dbparser/json/DBParserJSON.h>

#include <grpc++/client_context.h>
#include <grpc++/security/credentials.h>
#include <grpc/grpc.h>

#include <grpcpp/grpcpp.h>

#include <chrono>
#include <fstream>
#include <iostream>
Expand Down
6 changes: 2 additions & 4 deletions lib/sophos/sophos_server_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
#include <sse/schemes/utils/logger.hpp>
#include <sse/schemes/utils/utils.hpp>

#include <grpc++/security/server_credentials.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc/grpc.h>

#include <grpcpp/grpcpp.h>

#include <atomic>
#include <fstream>
#include <thread>
Expand Down
4 changes: 2 additions & 2 deletions lib/sophos/sophos_server_runner_private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <sse/schemes/sophos/sophos_server.hpp>

#include <google/protobuf/empty.pb.h> // For ::google::protobuf::Empty
#include <grpc++/server.h>
#include <grpc++/server_context.h>

#include <grpcpp/grpcpp.h>

#include <memory>
#include <mutex>
Expand Down
2 changes: 0 additions & 2 deletions src/diana_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

#include <sse/crypto/utils.hpp>

#include <grpc++/create_channel.h>

#include <cstdio>
#include <unistd.h>

Expand Down
3 changes: 1 addition & 2 deletions src/diana_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@

#include <sse/crypto/utils.hpp>

#include <grpc++/server.h>

#include <csignal>
#include <cstdio>
#include <grpcpp/grpcpp.h>
#include <unistd.h>

sse::diana::DianaServerRunner* server_ptr__ = nullptr;
Expand Down
3 changes: 1 addition & 2 deletions src/sophos_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

#include <sse/crypto/utils.hpp>

#include <grpc++/create_channel.h>

#include <cstdio>
#include <grpcpp/grpcpp.h>
#include <unistd.h>

#include <mutex>
Expand Down
4 changes: 1 addition & 3 deletions test/runners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include <sse/crypto/utils.hpp>
#include <sse/dbparser/json/DBParserJSON.h>

#include <grpc++/create_channel.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/server_builder.h>
#include <grpcpp/grpcpp.h>

#include <algorithm>
#include <condition_variable>
Expand Down

0 comments on commit 2c2468e

Please sign in to comment.