comparison SConstruct @ 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 64738befdf3b
children e00d9af76f0a
comparison
equal deleted inserted replaced
379:1ae78e506bd7 380:2a1259ce2b95
112 if GetOption('enable-profile'): 112 if GetOption('enable-profile'):
113 profile = 1 113 profile = 1
114 else: 114 else:
115 profile = 0 115 profile = 0
116 116
117 #set the default installation directories. 117 #**************************************************************************
118 #set the installation directories.
119 #**************************************************************************
118 prefix = GetOption('prefix') 120 prefix = GetOption('prefix')
119 if prefix is None: 121 if prefix is None:
120 if sys.platform == 'win32': 122 if sys.platform == 'win32':
121 prefix = '\\fife' 123 prefix = '\\fife'
122 elif sys.platform == 'darwin': 124 elif sys.platform == 'darwin':
202 if required_headers: 204 if required_headers:
203 for h in required_headers: 205 for h in required_headers:
204 conf.CheckHeader(h) 206 conf.CheckHeader(h)
205 207
206 #************************************************************************** 208 #**************************************************************************
207 #set variables based on command line options 209 #set variables based on command line and environment options
208 #************************************************************************** 210 #**************************************************************************
211
212 if os.environ.has_key('SWIG'):
213 env['SWIG'] = os.environ['SWIG']
214
215 haveusercxxflags = False
216
217 if os.environ.has_key('CXXFLAGS'):
218 usercxxflags = Split(os.environ['CXXFLAGS'])
219 haveusercxxflags = True
220 elif ARGUMENTS.get('CXXFLAGS'):
221 usercxxflags = Split(ARGUMENTS.get('CXXFLAGS'))
222 haveusercxxflags = True
223
209 if debug: 224 if debug:
210 env.AppendUnique(CXXFLAGS=['-ggdb', '-O0', '-D_DEBUG']) 225 if haveusercxxflags:
226 env.AppendUnique(usercxxflags)
227 else:
228 env.AppendUnique(CXXFLAGS=['-O0', '-Wall', '-Wno-unused'])
229
230 env.AppendUnique(CXXFLAGS=['-ggdb', '-D_DEBUG'])
211 engine_var_dir = os.path.join('build','engine','debug') 231 engine_var_dir = os.path.join('build','engine','debug')
212 tests_var_dir = os.path.join('build','tests','debug') 232 tests_var_dir = os.path.join('build','tests','debug')
213 print "Building DEBUG binaries..." 233 print "Building DEBUG binaries..."
214 else: 234 else:
215 env.AppendUnique(CXXFLAGS=['-O2']) 235 if haveusercxxflags:
236 env.AppendUnique(usercxxflags)
237 else:
238 env.AppendUnique(CXXFLAGS=['-O2', '-Wall', '-Wno-unused'])
239
216 engine_var_dir = os.path.join('build','engine','release') 240 engine_var_dir = os.path.join('build','engine','release')
217 tests_var_dir = os.path.join('build','tests','release') 241 tests_var_dir = os.path.join('build','tests','release')
218 print "Building RELEASE binaries..." 242 print "Building RELEASE binaries..."
219 243
220 if opengl: 244 if opengl:
226 if rend_camzone: 250 if rend_camzone:
227 env.Append(CPPDEFINES = ['RENDER_CAMZONES']) 251 env.Append(CPPDEFINES = ['RENDER_CAMZONES'])
228 if rend_grid: 252 if rend_grid:
229 env.Append(CPPDEFINES = ['RENDER_GRID']) 253 env.Append(CPPDEFINES = ['RENDER_GRID'])
230 if profile: 254 if profile:
231 env.Append(CPPFLAGS = ['-pg']) 255 env.Append(CXXFLAGS = ['-pg'])
232 env.Append(LINKFLAGS = ['-pg']) 256 env.Append(LINKFLAGS = ['-pg'])
233 257
234 #last but not least get any CXXFLAGS passed to scons via command line
235 if ARGUMENTS.get('CXXFLAGS'):
236 env.AppendUnique(CXXFLAGS = Split(ARGUMENTS.get('CXXFLAGS')))
237 else:
238 env.AppendUnique(CXXFLAGS=['-Wall', '-Wno-unused'])
239
240 #************************************************************************** 258 #**************************************************************************
241 #global compiler flags used for ALL targets 259 #global compiler flags used for ALL targets
242 #************************************************************************** 260 #**************************************************************************
243 env.Append(CPPPATH='#engine/core') 261 env.Append(CPPPATH='#engine/core')
244 262