summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/5 protocol buffers
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/frameworks/5 protocol buffers')
-rw-r--r--test cases/frameworks/5 protocol buffers/asubdir/defs.proto5
-rw-r--r--test cases/frameworks/5 protocol buffers/asubdir/main.cpp9
-rw-r--r--test cases/frameworks/5 protocol buffers/asubdir/meson.build8
-rw-r--r--test cases/frameworks/5 protocol buffers/defs.proto5
-rw-r--r--test cases/frameworks/5 protocol buffers/main.cpp9
-rw-r--r--test cases/frameworks/5 protocol buffers/meson.build22
-rw-r--r--test cases/frameworks/5 protocol buffers/sidedir/meson.build7
-rw-r--r--test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp16
-rw-r--r--test cases/frameworks/5 protocol buffers/test.json3
-rw-r--r--test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto7
-rw-r--r--test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto10
-rw-r--r--test cases/frameworks/5 protocol buffers/withpath/meson.build13
-rw-r--r--test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp16
13 files changed, 130 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 0000000..dad5754
--- /dev/null
+++ b/test cases/frameworks/5 protocol buffers/asubdir/defs.proto
@@ -0,0 +1,5 @@
+syntax = "proto3";
+
+message Dummy {
+ 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 0000000..f6566d5
--- /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 0000000..9727165
--- /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/defs.proto b/test cases/frameworks/5 protocol buffers/defs.proto
new file mode 100644
index 0000000..dad5754
--- /dev/null
+++ b/test cases/frameworks/5 protocol buffers/defs.proto
@@ -0,0 +1,5 @@
+syntax = "proto3";
+
+message Dummy {
+ string text = 1;
+}
diff --git a/test cases/frameworks/5 protocol buffers/main.cpp b/test cases/frameworks/5 protocol buffers/main.cpp
new file mode 100644
index 0000000..f6566d5
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/meson.build b/test cases/frameworks/5 protocol buffers/meson.build
new file mode 100644
index 0000000..046847a
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/sidedir/meson.build b/test cases/frameworks/5 protocol buffers/sidedir/meson.build
new file mode 100644
index 0000000..ce9b7be
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp b/test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp
new file mode 100644
index 0000000..83af4b2
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/test.json b/test cases/frameworks/5 protocol buffers/test.json
new file mode 100644
index 0000000..6ace9de
--- /dev/null
+++ b/test cases/frameworks/5 protocol buffers/test.json
@@ -0,0 +1,3 @@
+{
+ "skip_on_jobname": ["azure", "cygwin", "macos", "msys2"]
+}
diff --git a/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto b/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto
new file mode 100644
index 0000000..336779f
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto b/test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto
new file mode 100644
index 0000000..8dc32c2
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/withpath/meson.build b/test cases/frameworks/5 protocol buffers/withpath/meson.build
new file mode 100644
index 0000000..68a7381
--- /dev/null
+++ b/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/test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp b/test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp
new file mode 100644
index 0000000..83af4b2
--- /dev/null
+++ b/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;
+}