aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/frameworks/5 protocol buffers
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/frameworks/5 protocol buffers')
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/asubdir/defs.proto5
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/asubdir/main.cpp9
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/asubdir/meson.build8
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/defs.proto5
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/main.cpp9
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/meson.build22
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/sidedir/meson.build7
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp16
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto7
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto10
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/withpath/meson.build13
-rw-r--r--meson/test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp16
12 files changed, 127 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/5 protocol buffers/asubdir/defs.proto b/meson/test cases/frameworks/5 protocol buffers/asubdir/defs.proto
new file mode 100644
index 000000000..dad575470
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/asubdir/defs.proto
@@ -0,0 +1,5 @@
+syntax = "proto3";
+
+message Dummy {
+ string text = 1;
+}
diff --git a/meson/test cases/frameworks/5 protocol buffers/asubdir/main.cpp b/meson/test cases/frameworks/5 protocol buffers/asubdir/main.cpp
new file mode 100644
index 000000000..f6566d52e
--- /dev/null
+++ b/meson/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/meson/test cases/frameworks/5 protocol buffers/asubdir/meson.build b/meson/test cases/frameworks/5 protocol buffers/asubdir/meson.build
new file mode 100644
index 000000000..972716590
--- /dev/null
+++ b/meson/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/meson/test cases/frameworks/5 protocol buffers/defs.proto b/meson/test cases/frameworks/5 protocol buffers/defs.proto
new file mode 100644
index 000000000..dad575470
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/defs.proto
@@ -0,0 +1,5 @@
+syntax = "proto3";
+
+message Dummy {
+ string text = 1;
+}
diff --git a/meson/test cases/frameworks/5 protocol buffers/main.cpp b/meson/test cases/frameworks/5 protocol buffers/main.cpp
new file mode 100644
index 000000000..f6566d52e
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/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/meson/test cases/frameworks/5 protocol buffers/meson.build b/meson/test cases/frameworks/5 protocol buffers/meson.build
new file mode 100644
index 000000000..046847a89
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/meson.build
@@ -0,0 +1,22 @@
+project('protocol buffer test', 'cpp', default_options: ['cpp_std=c++11'])
+
+protoc = find_program('protoc', required : false)
+dep = dependency('protobuf', required : false)
+
+if not protoc.found() or not dep.found()
+ error('MESON_SKIP_TEST: protoc tool and/or protobuf pkg-config dependency not found')
+endif
+
+
+gen = generator(protoc, \
+ output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
+ arguments : ['--proto_path=@CURRENT_SOURCE_DIR@', '--cpp_out=@BUILD_DIR@', '@INPUT@'])
+
+generated = gen.process('defs.proto')
+e = executable('prog', 'main.cpp', generated,
+ dependencies : dep)
+test('prototest', e)
+
+subdir('asubdir')
+subdir('withpath')
+subdir('sidedir')
diff --git a/meson/test cases/frameworks/5 protocol buffers/sidedir/meson.build b/meson/test cases/frameworks/5 protocol buffers/sidedir/meson.build
new file mode 100644
index 000000000..ce9b7be1c
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/sidedir/meson.build
@@ -0,0 +1,7 @@
+# Generated source defined in one directory but
+# used in another.
+
+e = executable('sideprog', 'sideprog.cpp', generated,
+ override_options : ['unity=off'],
+ dependencies : dep)
+test('sideprog', e)
diff --git a/meson/test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp b/meson/test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp
new file mode 100644
index 000000000..83af4b256
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp
@@ -0,0 +1,16 @@
+#include"com/mesonbuild/simple.pb.h"
+#include"com/mesonbuild/subsite/complex.pb.h"
+
+#include<memory>
+
+int main(int argc, char **argv) {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+ {
+ subdirectorial::SimpleMessage *s = new subdirectorial::SimpleMessage();
+ s->set_the_integer(3);
+ subdirectorial::ComplexMessage c;
+ c.set_allocated_sm(s);
+ }
+ google::protobuf::ShutdownProtobufLibrary();
+ return 0;
+}
diff --git a/meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto b/meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto
new file mode 100644
index 000000000..336779f3d
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+package subdirectorial;
+
+message SimpleMessage {
+ int32 the_integer = 1;
+}
diff --git a/meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto b/meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto
new file mode 100644
index 000000000..8dc32c205
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto
@@ -0,0 +1,10 @@
+syntax = "proto3";
+
+package subdirectorial;
+
+import "com/mesonbuild/simple.proto";
+
+message ComplexMessage {
+ string a_message = 1;
+ SimpleMessage sm = 2;
+}
diff --git a/meson/test cases/frameworks/5 protocol buffers/withpath/meson.build b/meson/test cases/frameworks/5 protocol buffers/withpath/meson.build
new file mode 100644
index 000000000..68a738179
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/withpath/meson.build
@@ -0,0 +1,13 @@
+# Testing protobuf files that are deeply hierarchical
+# and must preserve their path segments in output files
+# because protoc will always put it in there.
+
+generated = gen.process('com/mesonbuild/simple.proto',
+ 'com/mesonbuild/subsite/complex.proto',
+ preserve_path_from : meson.current_source_dir(),
+ )
+
+e = executable('pathprog', 'pathprog.cpp', generated,
+ override_options : ['unity=off'],
+ dependencies : dep)
+test('pathprog', e)
diff --git a/meson/test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp b/meson/test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp
new file mode 100644
index 000000000..83af4b256
--- /dev/null
+++ b/meson/test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp
@@ -0,0 +1,16 @@
+#include"com/mesonbuild/simple.pb.h"
+#include"com/mesonbuild/subsite/complex.pb.h"
+
+#include<memory>
+
+int main(int argc, char **argv) {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+ {
+ subdirectorial::SimpleMessage *s = new subdirectorial::SimpleMessage();
+ s->set_the_integer(3);
+ subdirectorial::ComplexMessage c;
+ c.set_allocated_sm(s);
+ }
+ google::protobuf::ShutdownProtobufLibrary();
+ return 0;
+}