xref: /aosp_15_r20/external/flatbuffers/grpc/README.md (revision 890232f25432b36107d06881e0a25aaa6b473652)
1*890232f2SAndroid Build Coastguard WorkerGRPC implementation and test
2*890232f2SAndroid Build Coastguard Worker============================
3*890232f2SAndroid Build Coastguard Worker
4*890232f2SAndroid Build Coastguard WorkerNOTE: files in `src/` are shared with the GRPC project, and maintained there
5*890232f2SAndroid Build Coastguard Worker(any changes should be submitted to GRPC instead). These files are copied
6*890232f2SAndroid Build Coastguard Workerfrom GRPC, and work with both the Protobuf and FlatBuffers code generator.
7*890232f2SAndroid Build Coastguard Worker
8*890232f2SAndroid Build Coastguard Worker`tests/` contains a GRPC specific test, you need to have built and installed
9*890232f2SAndroid Build Coastguard Workerthe GRPC libraries for this to compile. This test will build using the
10*890232f2SAndroid Build Coastguard Worker`FLATBUFFERS_BUILD_GRPCTEST` option to the main FlatBuffers CMake project.
11*890232f2SAndroid Build Coastguard Worker
12*890232f2SAndroid Build Coastguard Worker## Building Flatbuffers with gRPC
13*890232f2SAndroid Build Coastguard Worker
14*890232f2SAndroid Build Coastguard Worker### Linux
15*890232f2SAndroid Build Coastguard Worker
16*890232f2SAndroid Build Coastguard Worker1. Download, build and install gRPC. See [instructions](https://github.com/grpc/grpc/tree/master/src/cpp).
17*890232f2SAndroid Build Coastguard Worker    * Lets say your gRPC clone is at `/your/path/to/grpc_repo`.
18*890232f2SAndroid Build Coastguard Worker    * Install gRPC in a custom directory by running `make install prefix=/your/path/to/grpc_repo/install`.
19*890232f2SAndroid Build Coastguard Worker2. `export GRPC_INSTALL_PATH=/your/path/to/grpc_repo/install`
20*890232f2SAndroid Build Coastguard Worker3. `export PROTOBUF_DOWNLOAD_PATH=/your/path/to/grpc_repo/third_party/protobuf`
21*890232f2SAndroid Build Coastguard Worker4. `mkdir build ; cd build`
22*890232f2SAndroid Build Coastguard Worker5. `cmake -DFLATBUFFERS_BUILD_GRPCTEST=ON -DGRPC_INSTALL_PATH=${GRPC_INSTALL_PATH} -DPROTOBUF_DOWNLOAD_PATH=${PROTOBUF_DOWNLOAD_PATH} ..`
23*890232f2SAndroid Build Coastguard Worker6. `make`
24*890232f2SAndroid Build Coastguard Worker
25*890232f2SAndroid Build Coastguard WorkerFor Bazel users:
26*890232f2SAndroid Build Coastguard Worker
27*890232f2SAndroid Build Coastguard Worker```shell
28*890232f2SAndroid Build Coastguard Worker$bazel test src/compiler/...
29*890232f2SAndroid Build Coastguard Worker```
30*890232f2SAndroid Build Coastguard Worker
31*890232f2SAndroid Build Coastguard Worker## Running FlatBuffer gRPC tests
32*890232f2SAndroid Build Coastguard Worker
33*890232f2SAndroid Build Coastguard Worker### Linux
34*890232f2SAndroid Build Coastguard Worker
35*890232f2SAndroid Build Coastguard Worker1. `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GRPC_INSTALL_PATH}/lib`
36*890232f2SAndroid Build Coastguard Worker2. `make test ARGS=-V`
37*890232f2SAndroid Build Coastguard Worker
38*890232f2SAndroid Build Coastguard WorkerFor Bazel users:
39*890232f2SAndroid Build Coastguard Worker
40*890232f2SAndroid Build Coastguard Worker```shell
41*890232f2SAndroid Build Coastguard Worker$bazel test tests/...
42*890232f2SAndroid Build Coastguard Worker```