vendredi 2 juillet 2021

How to compile different dependent proto together

I have 4 different proto files as follows a.proto, b.proto, helper1.proto, helper2.proto. Now a.proto is proto which contains messages that i need to actually extract. Now I have a.proto which imports helper.proto but actually uses command import "xyz\helper1.proto; Similarly b.proto imports helper1 and helper2 as follows import "xyz\helper1.proto; and import "xyz\helper2.proto; . So basically If i try and compile all 4 file together by keeping them in a single folder it would result into a.proto and b.proto looking for helper files of helper1.pb.h and helper2.pb.h inside subfolder xyz. Is it possible to do cpp_out for different file in different directory ?

As of now What i did is put the 2 protos a.proto, b.proto in base folder and created a new folder xyz and kept helper1.proto, helper2.proto inside xyz folder. Compiled helper1.proto, helper2.proto using protoc first and then a.proto, b.proto later with output pb.cc and pb.h being created respectively in xyz folder for helper protos and and in base folder for a.proto and b.proto.

Is there a way to compile them all together because I can have several subfolders and multiple protos. If so what is the right way and command to do it using protoc ?

Aucun commentaire:

Enregistrer un commentaire