alliedmodders / ambuild

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

Add a StaticLibrary() helper to Protoc. #152

Closed dvander closed 10 months ago

dvander commented 10 months ago

This also fixes a bug where protoc couldn't be invoked multiple times on the same inputs, because dependency files weren't shared outputs.

It's a little gross to use shared outputs here, but the alternative is putting every .d file in its own subdir, which is even grosser.

Usage:

cxx = builder.DetectCxx()
protoc = builder.DetectProtoc()
out = protoc.StaticLibrary('protos', builder, cxx, ['blah.proto'])

other_binary = builder.Library('mylibrary')
other_binary.compiler.sourcedeps += out.headers
other_binary.compiler.linkflags += [out.lib.binary]
...