Hello, I recently discovered Meson and love that C++ finally has a decent build system! Thank you Jussi (and others)!
As part of a new project I am working on, I am trying to integrate Google's flatbuffers into my build as an in-tree submodule. This means I need to build it (CMake), then use it as a generator to convert my IDL files to source, so I can include them in my executable target. (See below)
My current attempt is to use a custom target that builds flatc via a script. I'm struggling to understand how I can then use that in a generator to process the IDL files.
I could just require flatc as an installed dependency, but I have other custom use cases like this and I want to understand how it's done in Meson. I would have loved to use wrap, but obviously I can't here without converting flatbuffer's build system to Meson (which I may submit a pull request in the future).
Any advice would be appreciated. And if there's a better way to do this, please let me know. Thanks!
flatc_target = custom_target('flatc',
output : ['flatc'],
command : [build_flatc, '@SOURCE_DIR@', '@BUILD_DIR@'])
flatc = find_program('flatc')
gen = generator(flatc,
output : '@BASENAME@_generated.h',
arguments : ['--cpp', '@INPUT@'])
gen_src = gen.process('test.fbs')