r1196@dev030 (orig r59951): mvaradachari | 2007-09-17 13:40:16 -0700
[amiethrift.git] / lib / py / src / TSCons.py
blob20490332e10d31d90214ca10b7f79b2171d05bb9
1 #!/usr/bin/env python
3 # Copyright (c) 2006- Facebook
4 # Distributed under the Thrift Software License
6 # See accompanying file LICENSE or visit the Thrift site at:
7 # http://developers.facebook.com/thrift/
9 from SCons.Builder import Builder
11 def scons_env(env, add=''):
12 lstr = 'thrift --cpp ' + add + ' $SOURCE'
13 cppbuild = Builder(action = lstr)
14 env.Append(BUILDERS = {'ThriftCpp' : cppbuild})
16 def gen_cpp(env, dir, file):
17 scons_env(env)
18 suffixes = ['_types.h', '_types.cpp']
19 targets = map(lambda s: 'gen-cpp/' + file + s, suffixes)
20 return env.ThriftCpp(targets, dir+file+'.thrift')