From 34c03719a304bbbf684ad99110f49c18c99d9542 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 18 Dec 2017 21:10:14 +0200 Subject: Added documentation. --- docs/markdown/snippets/gen-subdirs.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/markdown/snippets/gen-subdirs.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/gen-subdirs.md b/docs/markdown/snippets/gen-subdirs.md new file mode 100644 index 0000000..fdb5945 --- /dev/null +++ b/docs/markdown/snippets/gen-subdirs.md @@ -0,0 +1,21 @@ +## Generator outputs can preserve directory structure + +Normally when generating files with a generator, Meson flattens the +input files so they all go in the same directory. Some code +generators, such as Protocol Buffers, require that the generated files +have the same directory layout as the input files used to generate +them. This can now be achieved like this: + +```meson +g = generator(...) # Compiles protobuf sources +generated = gen.process('com/mesonbuild/one.proto', + 'com/mesonbuild/two.proto', + preserve_path_from : meson.current_source_dir()) + +This would cause the following files to be generated inside the target +private directory: + + com/mesonbuild/one.pb.h + com/mesonbuild/one.pb.cc + com/mesonbuild/two.pb.h + com/mesonbuild/two.pb.cc -- cgit v1.1