g3dvl: Add sobel contour detector
[mesa/nouveau-pmpeg.git] / SConstruct
blob4a3fef0805942f904618ebcff889dcc41b408d0f
1 #######################################################################
2 # Top-level SConstruct
4 # For example, invoke scons as
6 # scons build=debug llvm=yes machine=x86
8 # to set configuration variables. Or you can write those options to a file
9 # named config.py:
11 # # config.py
12 # build='debug'
13 # llvm=True
14 # machine='x86'
16 # Invoke
18 # scons -h
20 # to get the full list of options. See scons manpage for more info.
23 import os
24 import os.path
25 import sys
26 import SCons.Util
28 import common
30 #######################################################################
31 # Configuration options
33 opts = Variables('config.py')
34 common.AddOptions(opts)
36 env = Environment(
37 options = opts,
38 tools = ['gallium'],
39 toolpath = ['#scons'],
40 ENV = os.environ,
43 # XXX: This creates a many problems as it saves...
44 #opts.Save('config.py', env)
46 # Backwards compatability with old target configuration variable
47 try:
48 targets = ARGUMENTS['targets']
49 except KeyError:
50 pass
51 else:
52 targets = targets.split(',')
53 print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
54 print
55 print ' scons %s' % ' '.join(targets)
56 print
57 COMMAND_LINE_TARGETS.append(targets)
60 Help(opts.GenerateHelpText(env))
62 # fail early for a common error on windows
63 if env['gles']:
64 try:
65 import libxml2
66 except ImportError:
67 raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
69 #######################################################################
70 # Environment setup
72 # Includes
73 env.Prepend(CPPPATH = [
74 '#/include',
76 env.Append(CPPPATH = [
77 '#/src/gallium/include',
78 '#/src/gallium/auxiliary',
79 '#/src/gallium/drivers',
80 '#/src/gallium/winsys',
83 if env['msvc']:
84 env.Append(CPPPATH = ['#include/c99'])
86 # for debugging
87 #print env.Dump()
90 #######################################################################
91 # Invoke host SConscripts
93 # For things that are meant to be run on the native host build machine, instead
94 # of the target machine.
97 # Create host environent
98 if env['crosscompile'] and not env['embedded']:
99 host_env = Environment(
100 options = opts,
101 # no tool used
102 tools = [],
103 toolpath = ['#scons'],
104 ENV = os.environ,
107 # Override options
108 host_env['platform'] = common.host_platform
109 host_env['machine'] = common.host_machine
110 host_env['toolchain'] = 'default'
111 host_env['llvm'] = False
113 host_env.Tool('gallium')
115 host_env['hostonly'] = True
116 assert host_env['crosscompile'] == False
118 if host_env['msvc']:
119 host_env.Append(CPPPATH = ['#include/c99'])
121 target_env = env
122 env = host_env
123 Export('env')
125 SConscript(
126 'src/SConscript',
127 variant_dir = host_env['build_dir'],
128 duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
131 env = target_env
133 Export('env')
135 #######################################################################
136 # Invoke SConscripts
138 # TODO: Build several variants at the same time?
139 # http://www.scons.org/wiki/SimultaneousVariantBuilds
141 SConscript(
142 'src/SConscript',
143 variant_dir = env['build_dir'],
144 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
148 ########################################################################
149 # List all aliases
151 try:
152 from SCons.Node.Alias import default_ans
153 except ImportError:
154 pass
155 else:
156 aliases = default_ans.keys()
157 aliases.sort()
158 env.Help('\n')
159 env.Help('Recognized targets:\n')
160 for alias in aliases:
161 env.Help(' %s\n' % alias)