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

From epsciwiki
Jump to navigation Jump to search
Line 9: Line 9:
 
<pre>
 
<pre>
 
cd /daqfs/gRPC
 
cd /daqfs/gRPC
mkdir -p ejfat/protos
+
mkdir ejfat
mkdir -p ejfat/cpp
+
cd ejfat
cd ejfat/cpp
+
mkdir cpp protos
cp -r /daqfs/gRPC/grpc/examples/cpp/helloworld loadBalancerControl
+
 
 +
cp /daqfs/gRPC/grpc/examples/protos/helloworld.proto protos/loadBalancerControl.proto
 +
cp -r /daqfs/gRPC/grpc/examples/cpp/cmake cpp/.
 +
cp -r /daqfs/gRPC/grpc/examples/cpp/helloworld cpp/loadBalancerControl
  
 
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$GRPC_INSTALL_DIR -DBUILD_SHARED_LIBS=ON ../..
 
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$GRPC_INSTALL_DIR -DBUILD_SHARED_LIBS=ON ../..
Line 20: Line 23:
 
</pre>
 
</pre>
 
</blockquote>
 
</blockquote>
 
=== Currently grpc is installed in /daqfs/gRPC/ ===
 
  
  
 
</font>
 
</font>

Revision as of 20:03, 16 December 2022

Steps to take in creating a gRPC application from an example in the C++ gRPC package.


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

Start by copying the hello world example as it's the simplest and does what we want
cd /daqfs/gRPC
mkdir ejfat
cd ejfat
mkdir cpp protos

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

cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$GRPC_INSTALL_DIR -DBUILD_SHARED_LIBS=ON ../..
make -j 4
make install
popd