From aea13caea6ffc5a373fbfd5157c57d026b9f9a7a Mon Sep 17 00:00:00 2001 From: Satoshi Fujimoto Date: Thu, 29 Jun 2017 14:50:05 +0900 Subject: grpc: Improve building tools and docs for C++ client This patch includes the following fixes: * update Makefile for protobuf 3.3.0 / gRPC 1.4.1 * make build.sh which generates stub codes and builds GoBGP shared library (instead, remove those operations from docs) Signed-off-by: Satoshi Fujimoto --- tools/grpc/cpp/Makefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tools/grpc/cpp/Makefile') diff --git a/tools/grpc/cpp/Makefile b/tools/grpc/cpp/Makefile index 2fcb5c8c..d50df9d9 100644 --- a/tools/grpc/cpp/Makefile +++ b/tools/grpc/cpp/Makefile @@ -1,7 +1,17 @@ +HOST_SYSTEM = $(shell uname | cut -f 1 -d_) +SYSTEM ?= $(HOST_SYSTEM) CXX = g++ -CPPFLAGS += -I/opt/protobuf_3.0.0_alpha4/include -I/opt/grpc/include -pthread +CPPFLAGS += -I/usr/local/include -pthread CXXFLAGS += -std=c++11 -LDFLAGS += -L/opt/grpc/lib -L/opt/protobuf_3.0.0_alpha4/lib -lgrpc++_unsecure -lgrpc -lgpr -lprotobuf -lpthread -ldl +ifeq ($(SYSTEM),Darwin) +LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \ + -lgrpc++_reflection \ + -lprotobuf -lpthread -ldl +else +LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \ + -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \ + -lprotobuf -lpthread -ldl +endif PROTOC = protoc GRPC_CPP_PLUGIN = grpc_cpp_plugin GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)` @@ -13,7 +23,7 @@ vpath %.proto $(PROTOS_PATH) all: system-check gobgp_api_client gobgp_api_client: gobgp_api_client.pb.o gobgp_api_client.grpc.pb.o gobgp_api_client.o - $(CXX) $^ $(LDFLAGS) -L. -lgobgp -o $@ + $(CXX) $^ $(LDFLAGS) -L. -lgobgp -o $@ %.grpc.pb.cc: %.proto $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $< -- cgit v1.2.3