Here we add a client and server samples for the basic "hello" service. These samples are designed to be run by either Zephyr or the host machine, interchangeably. Additionally, there is a python version of the client to demonstrate Thrift's cross-language capabilities. This code was merged from the following repository at the commit specified below, with minor formatting and coding-style modifications. https://github.com/zephyrproject-rtos/gsoc-2022-thrift e12e014d295918cc5ba0b4c507d1bf595a2f539a Signed-off-by: Chris Friedt <cfriedt@meta.com>
41 lines
1.2 KiB
Makefile
41 lines
1.2 KiB
Makefile
# Copyright 2022 Meta
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
.PHONY: all clean
|
|
|
|
CXXFLAGS :=
|
|
CXXFLAGS += -std=c++17
|
|
|
|
GEN_DIR = gen-cpp
|
|
GENSRC = $(GEN_DIR)/Hello.cpp $(GEN_DIR)/Hello.h $(GEN_DIR)/hello_types.h
|
|
GENHDR = $(filter %.h, $(GENSRC))
|
|
GENOBJ = $(filter-out %.h, $(GENSRC:.cpp=.o))
|
|
|
|
THRIFT_FLAGS :=
|
|
THRIFT_FLAGS += $(shell pkg-config --cflags thrift)
|
|
THRIFT_FLAGS += -I$(GEN_DIR)
|
|
THRIFT_LIBS :=
|
|
THRIFT_LIBS = $(shell pkg-config --libs thrift)
|
|
|
|
all: hello_server hello_server_compact hello_server_ssl
|
|
|
|
hello_server.stamp: ../hello.thrift
|
|
thrift --gen cpp:no_skeleton $<
|
|
|
|
$(GENSRC): hello_server.stamp
|
|
|
|
%.o: %.cpp $(GENHDR)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(THRIFT_FLAGS) -o $@ -c $<
|
|
|
|
hello_server: src/main.cpp $(GENOBJ) $(GENHDR)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(THRIFT_FLAGS) -o $@ $< $(GENOBJ) $(THRIFT_LIBS)
|
|
|
|
hello_server_compact: src/main.cpp $(GENOBJ) $(GENHDR)
|
|
$(CXX) -DCONFIG_THRIFT_COMPACT_PROTOCOL=1 $(CPPFLAGS) $(CXXFLAGS) $(THRIFT_FLAGS) -o $@ $< $(GENOBJ) $(THRIFT_LIBS)
|
|
|
|
hello_server_ssl: src/main.cpp $(GENOBJ) $(GENHDR)
|
|
$(CXX) -DCONFIG_THRIFT_SSL_SOCKET=1 $(CPPFLAGS) $(CXXFLAGS) $(THRIFT_FLAGS) -o $@ $< $(GENOBJ) $(THRIFT_LIBS)
|
|
|
|
clean:
|
|
rm -Rf hello_server hello_server_compact hello_server_ssl $(GEN_DIR)
|