Mark Slee | 89e2bb8 | 2007-03-01 00:20:36 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # Copyright (c) 2006- Facebook |
| 4 | # Distributed under the Thrift Software License |
| 5 | # |
| 6 | # See accompanying file LICENSE or visit the Thrift site at: |
| 7 | # http://developers.facebook.com/thrift/ |
| 8 | |
Mark Slee | e2bd58d | 2006-10-31 05:09:24 +0000 | [diff] [blame] | 9 | from SCons.Builder import Builder |
| 10 | |
| 11 | def scons_env(env): |
| 12 | cppbuild = Builder(action = 'thrift --cpp $SOURCE') |
| 13 | env.Append(BUILDERS = {'ThriftCpp' : cppbuild}) |
| 14 | |
| 15 | def gen_cpp(env, dir, file): |
| 16 | scons_env(env) |
| 17 | suffixes = ['_types.h', '_types.cpp'] |
| 18 | targets = map(lambda s: 'gen-cpp/' + file + s, suffixes) |
| 19 | return env.ThriftCpp(targets, dir+file+'.thrift') |