I want to add this file, tutorial.proto, to my qmake Qt project, which I copied from a tutorial:
syntax="proto3";
package qtprotobuf.tutorial;
message EchoRequest {
string message = 1;
}
message EchoResponse {
string message = 1;
}
service EchoService {
rpc Echo(EchoRequest) returns (EchoResponse);
}
I tried to connect the ProtoBuff library itself and everything seemed to work, at least the project is coming together.
My pro file:
QT = websockets
TARGET = server
CONFIG += console
CONFIG -= app_bundle
CONFIG += c++17 cmdline
TEMPLATE = app
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
server.cpp
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
server.h
target.path = $$[QT_INSTALL_EXAMPLES]/websockets/echoserver
INSTALLS += target
LIBS += -lprotobuf
DISTFILES += \
tutorial.prot
This .pro file will: