aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/cpp
diff options
context:
space:
mode:
authorGravatar Toshihito Kikuchi <k.toshihito@yahoo.de>2017-04-22 15:35:45 -0700
committerGravatar Mehrdad Afshari <mehrdada@users.noreply.github.com>2017-06-13 16:15:04 -0700
commit351506688d0afaa3d03764b6d2445c33eb1592a4 (patch)
tree30c7b2703d80a966d1ff654a8ad18ae8582c8ff6 /examples/cpp
parent8fd84cfa07a7f33766a05e3343132a6222e5aa32 (diff)
Update compiler/linker options to use pkg-config in C++ examples
Diffstat (limited to 'examples/cpp')
-rw-r--r--examples/cpp/helloworld/Makefile14
-rw-r--r--examples/cpp/route_guide/Makefile14
2 files changed, 14 insertions, 14 deletions
diff --git a/examples/cpp/helloworld/Makefile b/examples/cpp/helloworld/Makefile
index 5d6305496e..6af92347aa 100644
--- a/examples/cpp/helloworld/Makefile
+++ b/examples/cpp/helloworld/Makefile
@@ -17,16 +17,16 @@
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++
-CPPFLAGS += -I/usr/local/include -pthread
+CPPFLAGS += `pkg-config --cflags protobuf grpc`
CXXFLAGS += -std=c++11
ifeq ($(SYSTEM),Darwin)
-LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++ grpc` \
- -lgrpc++_reflection \
- -lprotobuf -lpthread -ldl
+LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
+ -lgrpc++_reflection\
+ -ldl
else
-LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++ grpc` \
- -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \
- -lprotobuf -lpthread -ldl
+LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
+ -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\
+ -ldl
endif
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
diff --git a/examples/cpp/route_guide/Makefile b/examples/cpp/route_guide/Makefile
index 88d0e51376..48a2073ba8 100644
--- a/examples/cpp/route_guide/Makefile
+++ b/examples/cpp/route_guide/Makefile
@@ -17,16 +17,16 @@
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++
-CPPFLAGS += -I/usr/local/include -pthread
+CPPFLAGS += `pkg-config --cflags protobuf grpc`
CXXFLAGS += -std=c++11
ifeq ($(SYSTEM),Darwin)
-LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \
- -lgrpc++_reflection \
- -lprotobuf -lpthread -ldl
+LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++`\
+ -lgrpc++_reflection\
+ -ldl
else
-LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \
- -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \
- -lprotobuf -lpthread -ldl
+LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++`\
+ -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\
+ -ldl
endif
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin