meson
meson copied to clipboard
Generator process() with preserve_path_from keyword argument bug
I have a generator (namely flatc for flatbuffers) that requires specifying the output directory for the generated file, otherwise, it will be the current build directory.
When you combine this with the generator process() functions preserve_path_from argument, you cannot then specify to the generator a correct output directory, and you cannot use '@BUILD_DIR@' as that is the current meson source files build directory.
e.g.
fbs_gen = generator(
flatc_exe,
arguments: [
'-o', '@BUILD_DIR@', # this is the issue here, as this will just be the current build directory, and will not keep the fragment from preserve_path_from
'-I', '@CURRENT_SOURCE_DIR@', '--cpp', '--keep-prefix', '--gen-mutable', '@INPUT@'
],
output: '@BASENAME@_generated.h'
)
fbs_srcs = files(
'kn/core/guid.fbs',
'kn/core/vector.fbs'
)
fbs_gen_files = fbs_gen.process(
fbs_srcs,
extra_args : meson.current_build_dir(),
preserve_path_from: meson.current_source_dir()
)
fbs_dep = declare_dependency(
sources: fbs_gen_files,
dependencies: flatbuffers_dep
)
Actually, I don't know how this would work even with @BUILD_DIR@ being fixed, or another one added, because I would have to be able to specify the output of the generator as output: '@FIXED_BUILD_DIR@/@BASENAME@_generated.h', but that wont work because:
meson.build:3:0: ERROR: "output" must not contain a directory separator.
When you combine this with the generator
process()functionspreserve_path_fromargument, you cannot then specify to the generator a correct output directory, and you cannot use'@BUILD_DIR@'as that is the current meson source files build directory.
This is exactly the problem I am facing now.