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/
10 from SCons
.Builder
import Builder
12 def scons_env(env
, add
=''):
13 opath
= path
.dirname(path
.abspath('$TARGET'))
14 lstr
= 'thrift --cpp -o ' + opath
+ ' ' + add
+ ' $SOURCE'
15 cppbuild
= Builder(action
= lstr
)
16 env
.Append(BUILDERS
= {'ThriftCpp' : cppbuild
})
18 def gen_cpp(env
, dir, file):
20 suffixes
= ['_types.h', '_types.cpp']
21 targets
= map(lambda s
: 'gen-cpp/' + file + s
, suffixes
)
22 return env
.ThriftCpp(targets
, dir+file+'.thrift')