~fsx/protobluff

4632f9619659fcb6f55c9deb1d15e3d08ac1b49c — Frank Smit 11 months ago 781dfd7
Meson: Make example and generator optional.
3 files changed, 21 insertions(+), 17 deletions(-)

M examples/meson.build
M meson.build
M src/meson.build
M examples/meson.build => examples/meson.build +0 -15
@@ 1,18 1,3 @@
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')

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

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

protoc_prog = find_program('protoc', required: false)
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,
)

if protoc_prog.found()
  subdir('examples')
endif

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

M src/meson.build => src/meson.build +3 -1
@@ 1,6 1,8 @@
pkg = import('pkgconfig')

subdir('generator')
if libprotoc.found()
  subdir('generator')
endif

core_sources = [
  'core/allocator.c',