Protocol Buffers Tutorial
Java:
Compiled Environment Download:
https://github.com/google/protobuf/releases/tag/v3.0.0
https://developers.google.com/protocol-buffers/docs/proto3
Install:
$ ./configure
$ make
$ make check
$ make install
Check version:
$ protoc --version
Protocol Buffers Output
https://developers.google.com/protocol-buffers/
To Objective-C(.h .m)
$ protoc --proto_path=src --objc_out=build/gen src/foo.proto src/bar/baz.proto
To Java(.java)
$ protoc --proto_path=src_dir --java_out=dst_dir src_dir/xxx.proto
--proto_path可以縮寫為: -I
Objective-C:
Download:
Install:
$ objectivec/DevTools/full_mac_build.sh
Building:
There are two ways to include the Runtime sources in your project:
Add objectivec/\*.h
& objectivec/GPBProtocolBuffers.m
to your project.
or
Add objectivec/\*.h
& objectivec/\*.m
except for
objectivec/GPBProtocolBuffers.m
to your project.
If the target is using ARC, remember to turn off ARC (-fno-objc-arc
) for the
.m
files.
The files generated by protoc
for the *.proto
files (\*.pbobjc.h' and
*.pbobjc.m`) are then also added to the target.