Skip to content
Snippets Groups Projects
Commit cd0d8aed authored by Muxi Yan's avatar Muxi Yan
Browse files

Identify system and remove --no-as-need if it is Mac OS

parent 4e3df00f
No related branches found
No related tags found
No related merge requests found
...@@ -29,12 +29,20 @@ ...@@ -29,12 +29,20 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++ CXX = g++
CPPFLAGS += -I/usr/local/include -pthread CPPFLAGS += -I/usr/local/include -pthread
CXXFLAGS += -std=c++11 CXXFLAGS += -std=c++11
ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++ grpc` \ LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++ grpc` \
-lgrpc++_reflection \ -lgrpc++_reflection \
-lprotobuf -lpthread -ldl -lprotobuf -lpthread -ldl
else
LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++ grpc` \
-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \
-lprotobuf -lpthread -ldl
endif
PROTOC = protoc PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)` GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
......
...@@ -29,12 +29,20 @@ ...@@ -29,12 +29,20 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++ CXX = g++
CPPFLAGS += -I/usr/local/include -pthread CPPFLAGS += -I/usr/local/include -pthread
CXXFLAGS += -std=c++11 CXXFLAGS += -std=c++11
ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \ LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \
-lgrpc++_reflection \ -lgrpc++_reflection \
-lprotobuf -lpthread -ldl -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 PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)` GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment