diff --git a/options.pri b/options.pri index 02f00fc..bdec39b 100644 --- a/options.pri +++ b/options.pri @@ -1,3 +1,3 @@ QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS] -std=c++11 -CONFIG(debug, debug|release): QMAKE_CXXFLAGS_WARN_ON += -Wall -W -Wextra -Werror -Wno-error +CONFIG(debug, debug|release): QMAKE_CXXFLAGS_WARN_ON += -Wall -W -Wextra -Werror CONFIG(debug, debug|release): QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations diff --git a/protobuf.pri b/protobuf.pri index 58cb08c..4d5bf32 100644 --- a/protobuf.pri +++ b/protobuf.pri @@ -1,5 +1,6 @@ # # Qt qmake integration with Google Protocol Buffers compiler protoc +# Author: Srivats P. # # To compile protocol buffers with qt qmake, specify PROTOS variable and # include this file @@ -17,6 +18,8 @@ PROTOPATH += . PROTOPATHS = for(p, PROTOPATH):PROTOPATHS += --proto_path=$${p} +PROTO_CC += $$replace(PROTOS, \.proto, .pb.cc) + protobuf_decl.name = protobuf header protobuf_decl.input = PROTOS protobuf_decl.output = ${QMAKE_FILE_BASE}.pb.h @@ -29,5 +32,20 @@ protobuf_impl.input = PROTOS protobuf_impl.output = ${QMAKE_FILE_BASE}.pb.cc protobuf_impl.depends = ${QMAKE_FILE_BASE}.pb.h protobuf_impl.commands = $$escape_expand(\\n) -protobuf_impl.variable_out = GENERATED_SOURCES +protobuf_impl.variable_out = GENERATED_FILES QMAKE_EXTRA_COMPILERS += protobuf_impl + +# protobuf generated code emits compiler warnings, so use -Wno-error to +# compile 'em; if and when protobuf generates clean code, make the following +# changes - +# - protobuf_impl.variable_out = GENERATED_FILES +# + protobuf_impl.variable_out = GENERATED_SOURCES +# - QMAKE_EXTRA_COMPILERS += protobuf_cc +# - #QMAKE_EXTRA_COMPILERS += protobuf_cc +protobuf_cc.name = protobuf cc compilation +protobuf_cc.input = PROTO_CC +protobuf_cc.output = ${QMAKE_FILE_BASE}.o +protobuf_cc.dependency_type = TYPE_C +protobuf_cc.commands = $(CXX) -c $(CXXFLAGS) -Wno-error $(INCPATH) -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} +protobuf_cc.variable_out = OBJECTS +QMAKE_EXTRA_COMPILERS += protobuf_cc