~fsx/protobluff

781dfd72915cab44634150618a554826acdaa003 — Frank Smit 11 months ago 9adee86
Meson: Add examples.
A examples/decoding/meson.build => examples/decoding/meson.build +9 -0
@@ 0,0 1,9 @@
gen = protoc.process('person.proto')
exe = executable(
    'decoding_example_exe',
    'example.c',
    gen,
    link_with: libprotobluff,
    include_directories: public_includes,
)
test('example/decoding', exe)

A examples/encoding/meson.build => examples/encoding/meson.build +9 -0
@@ 0,0 1,9 @@
gen = protoc.process('person.proto')
exe = executable(
    'encoding_example_exe',
    'example.c',
    gen,
    link_with: libprotobluff,
    include_directories: public_includes,
)
test('example/encoding', exe)

A examples/meson.build => examples/meson.build +18 -0
@@ 0,0 1,18 @@
protoc_prog = find_program('protoc', required: true)
protoc_gen_protobluff_path = protoc_gen_protobluff.full_path()

protoc = generator(
  protoc_prog,
  output: ['@BASENAME@.pb.c', '@BASENAME@.pb.h'],
  arguments: [
    f'--plugin=@protoc_gen_protobluff_path@',
    '--proto_path=@CURRENT_SOURCE_DIR@',
    '--protobluff_out=@BUILD_DIR@',
    '@INPUT@',
  ],
  depends: protoc_gen_protobluff,
)

subdir('decoding')
subdir('encoding')
subdir('messages')

A examples/messages/meson.build => examples/messages/meson.build +9 -0
@@ 0,0 1,9 @@
gen = protoc.process('person.proto')
exe = executable(
    'messages_example_exe',
    'example.c',
    gen,
    link_with: libprotobluff,
    include_directories: public_includes,
)
test('example/messages', exe)

M meson.build => meson.build +1 -0
@@ 23,6 23,7 @@ internal_includes = include_directories('src')

subdir('include')
subdir('src')
subdir('examples')

if libcheck.found()
  subdir('tests')