aboutsummaryrefslogtreecommitdiffstats
path: root/progs/SConstruct
blob: 4d268cc6d7bc0c34ef1f9a5f5287689bfb292028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import os.path
import sys

env = Environment(
    tools = ['generic'],
    toolpath = ['../scons'],
    ENV = os.environ,
)


# Use Mesa's headers and libs
if 1:
    build_topdir = 'build'
    build_subdir = env['platform']
    if env['machine'] != 'generic':
        build_subdir += '-' + env['machine']
    if env['debug']:
        build_subdir += "-debug"
    if env['profile']:
        build_subdir += "-profile"
    build_dir = os.path.join(build_topdir, build_subdir)

    env.Append(CPPDEFINES = ['GLEW_STATIC'])
    env.Append(CPPPATH = ['#../include'])
    env.Append(LIBPATH = [
        '#../' + build_dir + '/glew/',
        '#../' + build_dir + '/glut/glx',
    ])


conf = Configure(env)

# OpenGL
if env['platform'] == 'windows':
    env.Prepend(LIBS = ['glu32', 'opengl32'])
else:
    env.Prepend(LIBS = ['GLU', 'GL'])

# Glut
env['GLUT'] = False
if conf.CheckCHeader('GL/glut.h'):
    if env['platform'] == 'windows':
        env['GLUT_LIB'] = 'glut32'
    else:
        env['GLUT_LIB'] = 'glut'
    env['GLUT'] = True

# GLEW
env['GLEW'] = False
if conf.CheckCHeader('GL/glew.h'):
    env['GLEW_LIB'] = 'glew'
    env['GLEW'] = True
    env.Prepend(LIBS = ['glew'])

conf.Finish()


Export('env')

SConscript(
    'SConscript',
    build_dir = env['build'],
    duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
)