Generate Protocol Buffers files for iOS

Stay organized with collections Save and categorize content based on your preferences.

This guide shows you how to generate the Protocol Buffers source files for iOS from scratch.

Generate C++ source files from the proto file

  1. Download the Protocol Buffers Compiler v3.18.0 on your local machine.

  2. Unzip it.

  3. Check its version:

    ./bin/protoc --version

    You should have libprotoc 3.18.0.

  4. In the Cardboard repository, locate the proto folder and save its path.

  5. Generate the Protocol Buffers source files in C++:

    ./bin/protoc --proto_path=$PROTO_FOLDER_PATH --cpp_out=$PROTO_FOLDER_PATH cardboard_device.proto

    You should now have cardboard_device.pb.cc and cardboard_device.pb.h.