progs/xdemos: Use temporary variables.
[mesa.git] / progs / SConstruct
1 import os
2 import os.path
3 import sys
4
5 env = Environment(
6 tools = ['generic'],
7 toolpath = ['../scons'],
8 ENV = os.environ,
9 )
10
11
12 # Use Mesa's headers and libs
13 if 1:
14 build_topdir = 'build'
15 build_subdir = env['platform']
16 if env['machine'] != 'generic':
17 build_subdir += '-' + env['machine']
18 if env['debug']:
19 build_subdir += "-debug"
20 if env['profile']:
21 build_subdir += "-profile"
22 build_dir = os.path.join(build_topdir, build_subdir)
23
24 env.Append(CPPDEFINES = ['GLEW_STATIC'])
25 env.Append(CPPPATH = ['#../include'])
26 env.Append(LIBPATH = [
27 '#../' + build_dir + '/glew/',
28 '#../' + build_dir + '/glut/glx',
29 ])
30
31
32 conf = Configure(env)
33
34 # OpenGL
35 if env['platform'] == 'windows':
36 env.Prepend(LIBS = ['glu32', 'opengl32'])
37 else:
38 env.Prepend(LIBS = ['GLU', 'GL'])
39
40 # Glut
41 env['GLUT'] = False
42 if conf.CheckCHeader('GL/glut.h'):
43 if env['platform'] == 'windows':
44 env['GLUT_LIB'] = 'glut32'
45 else:
46 env['GLUT_LIB'] = 'glut'
47 env['GLUT'] = True
48
49 # GLEW
50 env['GLEW'] = False
51 if conf.CheckCHeader('GL/glew.h'):
52 env['GLEW_LIB'] = 'glew'
53 env['GLEW'] = True
54 env.Prepend(LIBS = ['glew'])
55
56 conf.Finish()
57
58
59 Export('env')
60
61 SConscript(
62 'SConscript',
63 build_dir = env['build'],
64 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
65 )