Protocol Buffers配置和编译步骤小结

Tutorial

Java:

Compiled Environment Download:

https://github.com/google/protobuf/releases/download/v3.0.0-beta-3/protobuf-java-3.0.0-beta-3.zip

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 --java_out=build/gen src/foo.proto

--proto_path可以缩写为: -I

Objective-C:

Download:

https://github.com/google/protobuf/releases/download/v3.0.0-beta-3/protobuf-objectivec-3.0.0-beta-3.zip

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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容