Integrate Google Protocol Buffers .proto files to Visual C++ 2010

前端 未结 2 968
梦谈多话
梦谈多话 2020-12-31 07:07

I\'ve added a custom build step to my Visual Studio project files which generates the google protobuf .h/.cc files from th

2条回答
  •  再見小時候
    2020-12-31 07:21

    Follow these detailed instructions to specify Custom Build Tool.

    Considering your proto file resides together with .h/.cpp files in standard project configuration, here are values to be inserted in Custom Build Tool:

    Command Line: 
    path\to\protoc --proto_path=$(ProjectDir) --cpp_out=$(ProjectDir) %(FullPath)
    Outputs: 
    $(ProjectDir)%(Filename).pb.h;$(ProjectDir)%(Filename).pb.cc
    

    Please note usage of item metadata macros, which replaced some of deprecated macros (like $(InputDir) and $(InputName)).

    Now Protocol Buffers compiler will be run only when Input file (i.e. %(FullPath)) is newer than "Outputs".

提交回复
热议问题