From 124ef03ca97dff4b3c0f7d62deee74f09cd82ae0 Mon Sep 17 00:00:00 2001 From: "smparkes@smparkes.net" Date: Fri, 20 Aug 2010 18:46:05 +0000 Subject: [PATCH] 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 --- cpp/SConscript | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cpp/SConscript b/cpp/SConscript index 8283952d9..fd03b3d2f 100644 --- a/cpp/SConscript +++ b/cpp/SConscript @@ -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)