[thrift] Output dir selection + updated TSCons
Summary: Allows setting the output directory via the new '-o dir' cmdline option.
TSCons is updated to use this to put the output in the right place no matter
the cwd, so doing dependent builds from different directories won't break.
Reviewed By: martin
Test Plan: mkdir /tmp/honk; thrift -cpp -java -javabean -php -phpi -py -rb -xsd -perl -erl -ocaml -hs -cocoa -o /tmp/honk Tablet.thrift
Revert: svn
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665311 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/TSCons.py b/lib/py/src/TSCons.py
index 2049033..ac992fa 100644
--- a/lib/py/src/TSCons.py
+++ b/lib/py/src/TSCons.py
@@ -6,10 +6,12 @@
# See accompanying file LICENSE or visit the Thrift site at:
# http://developers.facebook.com/thrift/
+from os import path
from SCons.Builder import Builder
def scons_env(env, add=''):
- lstr = 'thrift --cpp ' + add + ' $SOURCE'
+ opath = path.dirname(path.abspath('$TARGET'))
+ lstr = 'thrift --cpp -o ' + opath + ' ' + add + ' $SOURCE'
cppbuild = Builder(action = lstr)
env.Append(BUILDERS = {'ThriftCpp' : cppbuild})