1 # Based on: http://code.google.com/p/ostinato/source/browse/protobuf.pri
3 # Qt qmake integration with Google Protocol Buffers compiler protoc
5 # To compile protocol buffers with qt qmake, specify PROTOS variable and
9 # PROTOS = a.proto b.proto
10 # include(protobuf.pri)
12 # Set PROTO_PATH if you need to set the protoc --proto_path search path
13 # Set PROTOC to the path to the protoc compiler if it is not in your $PATH
16 isEmpty(PROTO_DIR):PROTO_DIR = .
17 isEmpty(PROTOC):PROTOC = protoc
20 for(p, PROTO_PATH):PROTOPATHS += --proto_path=$${p}
22 protobuf_decl.name = protobuf header
23 protobuf_decl.input = PROTOS
24 protobuf_decl.output = $${PROTO_DIR}/${QMAKE_FILE_BASE}.pb.h
25 protobuf_decl.commands = $${PROTOC} --cpp_out="$${PROTO_DIR}" $${PROTOPATHS} --proto_path=${QMAKE_FILE_IN_PATH} ${QMAKE_FILE_NAME}
26 protobuf_decl.variable_out = GENERATED_FILES
27 QMAKE_EXTRA_COMPILERS += protobuf_decl
29 protobuf_impl.name = protobuf implementation
30 protobuf_impl.input = PROTOS
31 protobuf_impl.output = $${PROTO_DIR}/${QMAKE_FILE_BASE}.pb.cc
32 protobuf_impl.depends = $${PROTO_DIR}/${QMAKE_FILE_BASE}.pb.h
33 protobuf_impl.commands = $$escape_expand(\\n)
34 protobuf_impl.variable_out = GENERATED_SOURCES
35 QMAKE_EXTRA_COMPILERS += protobuf_impl