summaryrefslogtreecommitdiffstats
path: root/pacman-c++/proto
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/proto')
-rw-r--r--pacman-c++/proto/pacman.proto18
-rw-r--r--pacman-c++/proto/proto.pro9
-rw-r--r--pacman-c++/proto/protobuf.pri33
3 files changed, 60 insertions, 0 deletions
diff --git a/pacman-c++/proto/pacman.proto b/pacman-c++/proto/pacman.proto
new file mode 100644
index 0000000..8e088e8
--- /dev/null
+++ b/pacman-c++/proto/pacman.proto
@@ -0,0 +1,18 @@
1package ProtoBuf;
2
3message KeyPressUpdate {
4 required uint32 newKey = 1;
5}
6
7message Init {
8 required uint32 color = 1;
9 required uint32 maxplayers = 2;
10}
11
12message MapUpdate {
13 repeated uint32 field = 1 [packed=true];
14 repeated uint32 round_points = 2;
15 repeated uint32 game_points = 3;
16 repeated uint32 eating_order = 4;
17}
18
diff --git a/pacman-c++/proto/proto.pro b/pacman-c++/proto/proto.pro
new file mode 100644
index 0000000..7c0b334
--- /dev/null
+++ b/pacman-c++/proto/proto.pro
@@ -0,0 +1,9 @@
1TEMPLATE = lib
2CONFIG += staticlib
3
4include(../common.pri)
5
6PROTOS = pacman.proto
7include(protobuf.pri)
8LIBS += -lprotobuf
9OTHER_FILES += $${PROTOS}
diff --git a/pacman-c++/proto/protobuf.pri b/pacman-c++/proto/protobuf.pri
new file mode 100644
index 0000000..718cb70
--- /dev/null
+++ b/pacman-c++/proto/protobuf.pri
@@ -0,0 +1,33 @@
1#
2# Qt qmake integration with Google Protocol Buffers compiler protoc
3#
4# To compile protocol buffers with qt qmake, specify PROTOS variable and
5# include this file
6#
7# Example:
8# PROTOS = a.proto b.proto
9# include(protobuf.pri)
10#
11# By default protoc looks for .proto files (including the imported ones) in
12# the current directory where protoc is run. If you need to include additional
13# paths specify the PROTOPATH variable
14#
15
16PROTOPATH += .
17PROTOPATHS =
18for(p, PROTOPATH):PROTOPATHS += --proto_path=$${p}
19
20protobuf_decl.name = protobuf header
21protobuf_decl.input = PROTOS
22protobuf_decl.output = ${QMAKE_FILE_BASE}.pb.h
23protobuf_decl.commands = protoc --cpp_out="." $${PROTOPATHS} $(INCPATH) ${QMAKE_FILE_IN}
24protobuf_decl.variable_out = GENERATED_FILES
25QMAKE_EXTRA_COMPILERS += protobuf_decl
26
27protobuf_impl.name = protobuf implementation
28protobuf_impl.input = PROTOS
29protobuf_impl.output = ${QMAKE_FILE_BASE}.pb.cc
30protobuf_impl.depends = ${QMAKE_FILE_BASE}.pb.h
31protobuf_impl.commands = $$escape_expand(\\n)
32protobuf_impl.variable_out = GENERATED_SOURCES
33QMAKE_EXTRA_COMPILERS += protobuf_impl