Allow a few build-time arguments to the C++ build

Add DEBUG and PIC flags to scons so you can now build without debug, e.g.,
  scons DEBUG=false lib
or with -fPIC forced, e.g,.
  scons PIC=true lib

Defaults haven't changed.


git-svn-id: https://zxing.googlecode.com/svn/trunk@1550 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2010-08-20 18:46:05 +00:00
parent dd1336d0cf
commit 124ef03ca9

View file

@ -1,13 +1,21 @@
Decider('MD5')
env = Environment()
vars = Variables()
vars.Add(BoolVariable('DEBUG', 'Set to disable optimizations', 1))
vars.Add(BoolVariable('PIC', 'Set to 1 for to always generate PIC code', 0))
env = Environment(variables = vars)
debug = True
debug = env['DEBUG']
compile_options = {}
flags = []
if debug:
#compile_options['CPPDEFINES'] = "-DDEBUG"
flags.append("-O0 -g3 -Wall")
flags.append("-O0 -g3 -ggdb -Wall")
else:
flags.append("-O -g3 -Wall")
if env['PIC']:
flags.append("-fPIC")
compile_options['CXXFLAGS'] = ' '.join(flags)