Skip to content

Add option for a flat directory layout #3873

@jpakkane

Description

@jpakkane

Currently if you have protobuf files in a hierarchical tree and then compile them with something like:

protoc -I proto_subdir --cpp_out outdir proto_subdir/dummy_service.proto
protoc -I proto_subdir --cpp_out outdir proto_subdir/messages/dummy_messages.proto 

this results in files

outdir/dummy_service.pb.*
outdir/messages/dummy_messages.pb.*

And inside dummy_service.pb.cc there is this:

#include "messages/dummy_messages2.pb.h"

Besides looking like Java, this forces a directory layout on generated sources which makes integration difficult.

It would be nice to add a flag to the protoc compiler, say --flat-layout which would do the following:

  • output all files to cpp_out subdir without any extra directory segments
  • change #include statements to not have extra directory segments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions