Status: New
Labels: Type-Defect Priority-Medium

New issue 187 by dima: Command-line argument to override the "optimize_for" option

The project I'm working has C++ and Java code that need to share a few
.proto files. However, in C++, we only build the lite version of the
protobuf library, while the Java code needs to have the full version. Since
the "optimize_for" option can only be specified in the .proto files
themselves, that makes sharing of .proto files very difficult.

This is not specific to C++ or Java: in general, it may be useful to
codegen multiple source files with different optimization settings from the
same .proto file.

I suggest that protoc have an "--optimize_for" command-line argument that
overrides any such options in the .proto files. I'm attaching a patch that
solves this in a very hacky way; hopefully, someone will know the proper
way to fix this.

        optimize_for.patch  2.3 KB

You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to