alliedmodders / ambuild

AlliedModders C++ Build System
BSD 3-Clause "New" or "Revised" License
60 stars 31 forks source link

Add initial protobuf support. #151

Closed dvander closed 10 months ago

dvander commented 10 months ago

This adds a new API, and bumps the API version to 2.2.4.

DetectProtoc() returns a Protoc object. The Generate method on this is a handy wrapper around builder.AddCommand. It returns a dictionary mapping where generated sources and headers are. Eg,

out = protoc.Generate(sources = ['blah.proto'], outputs = ['cpp', 'py'])

Will return a map that looks like:

{
    'cpp': {
        'sources': Entry('blah.pb.cc'),
        'headers': Entry('blah.pb.h'),
    },
    'python': {
        'sources': Entry('blah_pb2.py'),
    },
}
dvander commented 10 months ago

Documentation updated here: https://wiki.alliedmods.net/AMBuild_API