diff options
| author | Alberto Aguirre <alberto.aguirre@canonical.com> | 2017-04-14 08:18:37 -0500 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-05-08 20:53:57 +0200 |
| commit | ccab7d64f474f00e010b2c6601e63d8034c5552a (patch) | |
| tree | 2007c7528dd669cb70195aa2ec5524cf300b0359 /test cases/frameworks/5 protocol buffers | |
| parent | 1882548f056a49945de2c3b4b7d57d283cecb012 (diff) | |
| download | meson-ccab7d64f474f00e010b2c6601e63d8034c5552a.tar.gz | |
Add support for @CURRENT_SOURCE_DIR@ in generator arguments
Allow users to specify @CURRENT_SOURCE_DIR@ in generator arguments
to specify the current target source directory.
This is useful when creating protobuf generator objects in sub-directories
because protoc will then generate files in the expected location.
Fixes #1622.
Remove stray semicolon
Update documentation
Diffstat (limited to 'test cases/frameworks/5 protocol buffers')
4 files changed, 22 insertions, 0 deletions
diff --git a/test cases/frameworks/5 protocol buffers/asubdir/defs.proto b/test cases/frameworks/5 protocol buffers/asubdir/defs.proto new file mode 100644 index 000000000..f7956517c --- /dev/null +++ b/test cases/frameworks/5 protocol buffers/asubdir/defs.proto @@ -0,0 +1,3 @@ +message Dummy { + required string text = 1; +} diff --git a/test cases/frameworks/5 protocol buffers/asubdir/main.cpp b/test cases/frameworks/5 protocol buffers/asubdir/main.cpp new file mode 100644 index 000000000..f6566d52e --- /dev/null +++ b/test cases/frameworks/5 protocol buffers/asubdir/main.cpp @@ -0,0 +1,9 @@ +#include "defs.pb.h" + +int main(int argc, char **argv) { + GOOGLE_PROTOBUF_VERIFY_VERSION; + Dummy *d = new Dummy; + delete d; + google::protobuf::ShutdownProtobufLibrary(); + return 0; +} diff --git a/test cases/frameworks/5 protocol buffers/asubdir/meson.build b/test cases/frameworks/5 protocol buffers/asubdir/meson.build new file mode 100644 index 000000000..972716590 --- /dev/null +++ b/test cases/frameworks/5 protocol buffers/asubdir/meson.build @@ -0,0 +1,8 @@ +subdirgen = generator(protoc, \ + output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'], + arguments : ['--proto_path=@CURRENT_SOURCE_DIR@', '--cpp_out=@BUILD_DIR@', '@INPUT@']) + +generated = subdirgen.process('defs.proto') +e = executable('subdir-prog', 'main.cpp', generated, + dependencies : dep) +test('subdir-prototest', e) diff --git a/test cases/frameworks/5 protocol buffers/meson.build b/test cases/frameworks/5 protocol buffers/meson.build index c99e0a85a..58666f9b9 100644 --- a/test cases/frameworks/5 protocol buffers/meson.build +++ b/test cases/frameworks/5 protocol buffers/meson.build @@ -16,3 +16,5 @@ generated = gen.process('defs.proto') e = executable('prog', 'main.cpp', generated, dependencies : dep) test('prototest', e) + +subdir('asubdir') |
