mirror of https://gitlab.com/ita1024/waf.git
Issue 1184
This commit is contained in:
parent
d3210ea74b
commit
b52d97adff
|
@ -1,3 +1,8 @@
|
|||
NEW IN WAF 1.7.5
|
||||
----------------
|
||||
* Fixed the kde4 library detection on Fedora
|
||||
* New tool for protocol buffers (protoc.py) #1184
|
||||
|
||||
NEW IN WAF 1.7.4
|
||||
----------------
|
||||
* Fixed a regression in the Node,Task and Context classes
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package udp.tc.tests;
|
||||
|
||||
option java_package = "com.udp.tc.tests";
|
||||
option java_outer_classname = "MessageProtos";
|
||||
option cc_generic_services = false;
|
||||
option java_generic_services = false;
|
||||
option py_generic_services = false;
|
||||
|
||||
message Message {
|
||||
required int32 test = 1;
|
||||
optional uint32 blah = 2;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
top = '.'
|
||||
out = 'build'
|
||||
|
||||
def options(opt):
|
||||
opt.load('compiler_cxx')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx protoc')
|
||||
|
||||
def build(bld):
|
||||
bld(
|
||||
features = 'cxx cxxshlib',
|
||||
source = ['inc/message.proto'],
|
||||
target = 'somelib',
|
||||
includes = ['.', 'inc'])
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# Philipp Bender, 2012
|
||||
# Matt Clarkson, 2012
|
||||
|
||||
from waflib.Task import Task
|
||||
from waflib.TaskGen import extension
|
||||
|
||||
"""
|
||||
A simple tool to integrate protocol buffers into your build system.
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx cxx protoc')
|
||||
|
||||
def build(bld):
|
||||
bld(
|
||||
features = 'cxx cxxprogram'
|
||||
source = 'main.cpp file1.proto proto/file2.proto',
|
||||
include = '. proto',
|
||||
target = 'executable')
|
||||
|
||||
"""
|
||||
|
||||
class protoc(Task):
|
||||
run_str = '${PROTOC} ${PROTOC_FLAGS} ${PROTOC_ST:INCPATHS} ${SRC[0].abspath()}'
|
||||
color = 'BLUE'
|
||||
ext_out = ['.h', 'pb.cc']
|
||||
|
||||
@extension('.proto')
|
||||
def process_protoc(self, node):
|
||||
cpp_node = node.change_ext('.pb.cc')
|
||||
hpp_node = node.change_ext('.pb.h')
|
||||
self.create_task('protoc', node, [cpp_node, hpp_node])
|
||||
self.source.append(cpp_node)
|
||||
|
||||
if 'cxx' in self.features and not self.env.PROTOC_FLAGS:
|
||||
self.env.PROTOC_FLAGS = '--cpp_out=.'
|
||||
|
||||
use = getattr(self, 'use', '')
|
||||
if not 'PROTOBUF' in use:
|
||||
self.use = self.to_list(use) + ['PROTOBUF']
|
||||
|
||||
def configure(conf):
|
||||
conf.check_cfg(package="protobuf", uselib_store="PROTOBUF", args=['--cflags', '--libs'])
|
||||
conf.find_program('protoc', var='PROTOC')
|
||||
conf.env.PROTOC_ST = '-I%s'
|
||||
|
Loading…
Reference in New Issue