akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 1 | #! /usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
| 4 | |
| 5 | from waflib.Task import Task |
| 6 | from waflib.TaskGen import extension |
| 7 | class protoc(Task): |
| 8 | run_str='${PROTOC} ${PROTOC_FLAGS} ${PROTOC_ST:INCPATHS} ${SRC[0].abspath()}' |
| 9 | color='BLUE' |
| 10 | ext_out=['.h','pb.cc'] |
| 11 | @extension('.proto') |
| 12 | def process_protoc(self,node): |
| 13 | cpp_node=node.change_ext('.pb.cc') |
| 14 | hpp_node=node.change_ext('.pb.h') |
| 15 | self.create_task('protoc',node,[cpp_node,hpp_node]) |
| 16 | self.source.append(cpp_node) |
| 17 | if'cxx'in self.features and not self.env.PROTOC_FLAGS: |
| 18 | self.env.PROTOC_FLAGS='--cpp_out=%s'%node.parent.get_bld().abspath() |
| 19 | use=getattr(self,'use','') |
| 20 | if not'PROTOBUF'in use: |
| 21 | self.use=self.to_list(use)+['PROTOBUF'] |
| 22 | def configure(conf): |
| 23 | conf.check_cfg(package="protobuf",uselib_store="PROTOBUF",args=['--cflags','--libs']) |
| 24 | conf.find_program('protoc',var='PROTOC') |
| 25 | conf.env.PROTOC_ST='-I%s' |