I was having a look at the port of protobuf-c to meson and one issue they build an executable that is passed as a command line param to the generator in this format:
gen_protobuf_c = generator(protoc,
output : ['@[email protected]', '@[email protected]'],
arguments : ['--proto_path=@CURRENT_SOURCE_DIR@', '--plugin=protoc-gen-c=@0@'.format(protoc_gen_c.full_path()), '--cpp_out=@BUILD_DIR@', @INPUT@'])
When I try to use the generator it does not find the protoc_gen_c yet, I think we need a way to tell the generator that the executable has to be ready before calling it.
Isn't there a 'dependencies' keyword for generator?
As far as I can see there isn't: https://mesonbuild.com/Reference-manual.html#generator
The reason is that you're using .full_path(), which you're forced to because generator() only takes a single argument as the input. If you were using a custom_target() you could put that in the list of inputs (which will add a dependency on it) and then use it as @INPUT0@, etc in the arguments.
The problem I see by using custom_target is that I do not have a process method, so the inputs are basically hardcoded
We could probably add a depends kwarg (or something better-named) which you can refer to in arguments with @DEPEND@ similar to @INPUT@.
sounds good to me
@nirbheek I tried to have a look at the patch but I have not much knowledge of the internals of meson. Any chance you could make a patch for this? would be awesome to have protobuf-c with meson
Hi, protobuf-c maintainer here. I'd still like to switch protobuf-c from autotools/cmake to meson at some point, but if I recall correctly we were stuck on this issue. Any progress?
Thanks!
Can you test if #5407 fixes it for you?
@jpakkane Just tested and that does appear to fix it. Thank you!
Most helpful comment
We could probably add a
dependskwarg (or something better-named) which you can refer to in arguments with@DEPEND@similar to@INPUT@.