An open API service indexing awesome lists of open source software.

https://github.com/bewaremypower/protobuf-demo

Google protocol buffer demos
https://github.com/bewaremypower/protobuf-demo

cpp protocol-buffers

Last synced: 11 days ago
JSON representation

Google protocol buffer demos

Awesome Lists containing this project

README

          

# protobuf-demo

Examples to use [protobuf](https://github.com/protocolbuffers/protobuf).

## Install dependencies

It's recommended to use [vcpkg](https://github.com/microsoft/vcpkg) to install dependencies.

Take MacOS 64-bit as example, you need to run:

```bash
vcpkg install --feature-flags=manifests --triplet x64-osx
```

Choose the correct triplet for your OS, see [here](https://github.com/microsoft/vcpkg/tree/master/triplets) for all available triplets.

## Build examples

If you have installed dependencies using vcpkg, you can simply run:

```bash
cmake -B ./build -DVCPKG_TRIPLET=x64-osx
cmake --build ./build
```

Then all executables will be generated under `build/` directory.

On MacOS, you can also run the wrapped scripts:

```bash
./scripts/configure-osx.sh
./scripts/build-osx.sh
```

> **NOTE**
>
> You must ensure the `VCPKG_TRIPLET` is the correct triplet for your OS. If you don't use vcpkg to install dependencies, you will need to specify `-DCMAKE_PREFIX_PATH` or ensure your dependencies are installed in system path.

## Code format

If `clang-format` is installed, the code will be formatted automatically using `clang-format`.

You can also run following command to format the code manually.

```bash
cmake --build ./build --target format
```