What is this, exactly?
- An Objective-C interface (src/runtime) for creating and reading protobuf messages.
- Source for Obj-C protobuf compiler (src/compiler), which allows us to compile protobuf source (.proto) into compiled Obj-C source. This is built and installed as protoc-gen-objc.
- A number of .proto files (src/proto) that define the interface we use when interfacing with Dropcam devices and certain services. These are compiled using the compiler.
- A script (compile_proto.sh) which generates the compiled Obj-C source and places it in src/gen_proto.
Prerequisites
- Homebrew, to install the following dependencies. Installing it to ~/homebrew is suggested. See https://wiki.corp.google.com/twiki/bin/view/Main/MacRoadWarrior#Homebrew for more details. No matter where you install it, set HOMEBREW to the root Homebrew directory.
- Protobuf, to compile the Obj-C compiler. Protobuf 2.6.0 is requried and as of this writing, it is the current version provided via Homebrew.
- autoconf, to run the autogen script.
brew install protobuf
brew install autoconf automake libevent
Generating Compiled Protobuf Source
./compile_proto.sh
How does it work?
- compile_proto.sh runs build.sh
- build.sh builds protoc-gen-objc, the Obj-C protbuf compiler, and installs it in bin.
- Then, compile_proto.sh runs protoc, the generic protobuf compiler provided by protobuf, using protoc-gen-objc as a plugin. All .proto source in src/proto is compiled into Obj-C, and is output to src/gen_proto.