Open nickbroon opened 4 years ago
Looks like duplicate of #3206
The alternative approach I've also used is:
protobuf_sources = [
'Envelope.proto Message.proto Data.proto'
]
protoc = find_program('protoc')
generated_c = []
foreach protobuf_definition : protobuf_sources
generated_c += custom_target('c_' + protobuf_definition,
command: [protoc, '--proto_path=@CURRENT_SOURCE_DIR@', '--c_out=@OUTDIR@', '@INPUT@'],
input: protobuf_definition,
output: ['@BASENAME@.pb-c.c', '@BASENAME@.pb-c.h'],
install: true,
install_dir: [false, get_option('includedir') / 'sample' / 'protobuf']
)
endforeach
proto_c_dep = dependency('libprotobuf-c')
sample_proto_library = shared_library(
'sample-proto',
sources: [generated_c],
dependencies: [proto_c_dep],
install: true,
soversion: 1
)
Both the original example using a generator
but having to list all the output in a direct call to install_header
afterwards, and this example using custom_target
but inside a foreach
loop list of names instead of 'files', seem sub optimal and not really meson idiomatic.
Describe the bug There is no way to install headers produced by a generator
Perhaps an install and install_dir options (and some method to filter the output of the generator process) could support this.
To Reproduce
Expected behavior
Some way to install
Envelope.pb-c.h
andMessage.pb-c.h
produced by the generator. (But not Envelope.pb-c.c nor Message.pb-c.c)system parameters meson 0.49.2 ninja 1.8.2