changeset 380:2a1259ce2b95

Moved the check for the SWIG environment variable from darwin-config.py to Sconstruct so all platforms can use it. You should now be able to specify CXXFLAGS either by command line or by setting your CXXFLAGS environment variable.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 12 Jan 2010 17:22:43 +0000
parents 1ae78e506bd7
children e00d9af76f0a
files SConstruct build/darwin-config.py
diffstat 2 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/SConstruct	Tue Jan 12 16:49:06 2010 +0000
+++ b/SConstruct	Tue Jan 12 17:22:43 2010 +0000
@@ -114,7 +114,9 @@
 else:
 	profile = 0
 
-#set the default installation directories.
+#**************************************************************************
+#set the installation directories.
+#**************************************************************************
 prefix = GetOption('prefix')
 if prefix is None:
 	if sys.platform == 'win32':
@@ -204,15 +206,37 @@
 			conf.CheckHeader(h)
 
 #**************************************************************************
-#set variables based on command line options
+#set variables based on command line and environment options
 #**************************************************************************
+
+if os.environ.has_key('SWIG'):
+	env['SWIG'] = os.environ['SWIG']
+
+haveusercxxflags = False
+
+if os.environ.has_key('CXXFLAGS'):
+	usercxxflags = Split(os.environ['CXXFLAGS'])
+	haveusercxxflags = True
+elif ARGUMENTS.get('CXXFLAGS'):
+	usercxxflags = Split(ARGUMENTS.get('CXXFLAGS'))
+	haveusercxxflags = True
+
 if debug:
-	env.AppendUnique(CXXFLAGS=['-ggdb', '-O0', '-D_DEBUG'])
+	if haveusercxxflags:
+		env.AppendUnique(usercxxflags)
+	else:	
+		env.AppendUnique(CXXFLAGS=['-O0', '-Wall', '-Wno-unused'])
+		
+	env.AppendUnique(CXXFLAGS=['-ggdb', '-D_DEBUG'])
 	engine_var_dir = os.path.join('build','engine','debug')
 	tests_var_dir = os.path.join('build','tests','debug')
 	print "Building DEBUG binaries..."
 else:
-	env.AppendUnique(CXXFLAGS=['-O2'])
+	if haveusercxxflags:
+		env.AppendUnique(usercxxflags)
+	else:	
+		env.AppendUnique(CXXFLAGS=['-O2', '-Wall', '-Wno-unused'])
+	
 	engine_var_dir = os.path.join('build','engine','release')
 	tests_var_dir = os.path.join('build','tests','release')
 	print "Building RELEASE binaries..."
@@ -228,15 +252,9 @@
 if rend_grid:
 	env.Append(CPPDEFINES = ['RENDER_GRID'])
 if profile:
-	env.Append(CPPFLAGS = ['-pg'])
+	env.Append(CXXFLAGS = ['-pg'])
 	env.Append(LINKFLAGS = ['-pg'])
 	
-#last but not least get any CXXFLAGS passed to scons via command line
-if ARGUMENTS.get('CXXFLAGS'):
-	env.AppendUnique(CXXFLAGS = Split(ARGUMENTS.get('CXXFLAGS'))) 
-else:
-	env.AppendUnique(CXXFLAGS=['-Wall', '-Wno-unused'])
-
 #**************************************************************************
 #global compiler flags used for ALL targets
 #**************************************************************************
--- a/build/darwin-config.py	Tue Jan 12 16:49:06 2010 +0000
+++ b/build/darwin-config.py	Tue Jan 12 17:22:43 2010 +0000
@@ -19,9 +19,6 @@
 	env.Append(CPPPATH = include_dirs)
 	env.Append(LIBPATH = lib_dirs)
 
-	if os.environ.has_key('SWIG'):
-		env['SWIG'] = os.environ['SWIG']
-
 	return env
 	
 def addExtras(env, opengl):