Difference between revisions of "How to create a C++ gRPC application"

From epsciwiki
Jump to navigation Jump to search
Line 30: Line 30:
 
</blockquote>
 
</blockquote>
  
: '''Now modify the code to suit.'''
+
: '''Rename a few files and directories, from helloworld to loadBalancerControl '''
  
 +
<blockquote>
 +
<pre>
 +
cd <my_gRPC_dir>/ejfat
 +
 +
mv protos helloworld.proto loadBalancerControl.proto.
 +
cp -r /daqfs/gRPC/grpc/examples/cpp/cmake cpp/.
 +
cp -r /daqfs/gRPC/grpc/examples/cpp/helloworld cpp/.
 +
 +
cd cpp/helloworld
 +
mkdir -p cmake/build
 +
cd cmake/build
 +
cmake -DCMAKE_PREFIX_PATH=$GRPC_INSTALL_DIR -DBUILD_SHARED_LIBS=ON ../..
 +
make -j 4
 +
</pre>
 +
</blockquote>
  
 
=== The application in this case is the reporting to the control plane of the fill level of an ERSAP backend reassembler's fifo. ===
 
=== The application in this case is the reporting to the control plane of the fill level of an ERSAP backend reassembler's fifo. ===
  
 
</font>
 
</font>

Revision as of 21:11, 16 December 2022

Setup some environmental variables (assuming bash)
export GRPC_INSTALL_DIR=/daqfs/gRPC/installation
export PATH="$GRPC_INSTALL_DIR/bin:$PATH"
export LD_LIBRARY_PATH="$GRPC_INSTALL_DIR/lib:$LD_LIBRARY_PATH"
Start by copying the hello world example and compiling it (official instructions here). The compilation steps differ slightly between examples.
cd <my_gRPC_dir>
mkdir ejfat
cd ejfat
mkdir cpp protos

cp /daqfs/gRPC/grpc/examples/protos/helloworld.proto protos/.
cp -r /daqfs/gRPC/grpc/examples/cpp/cmake cpp/.
cp -r /daqfs/gRPC/grpc/examples/cpp/helloworld cpp/.

cd cpp/helloworld
mkdir -p cmake/build
cd cmake/build
cmake -DCMAKE_PREFIX_PATH=$GRPC_INSTALL_DIR -DBUILD_SHARED_LIBS=ON ../..
make -j 4
Rename a few files and directories, from helloworld to loadBalancerControl
cd <my_gRPC_dir>/ejfat

mv protos helloworld.proto loadBalancerControl.proto.
cp -r /daqfs/gRPC/grpc/examples/cpp/cmake cpp/.
cp -r /daqfs/gRPC/grpc/examples/cpp/helloworld cpp/.

cd cpp/helloworld
mkdir -p cmake/build
cd cmake/build
cmake -DCMAKE_PREFIX_PATH=$GRPC_INSTALL_DIR -DBUILD_SHARED_LIBS=ON ../..
make -j 4

The application in this case is the reporting to the control plane of the fill level of an ERSAP backend reassembler's fifo.