1 #######################################################################
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
20 # to get the full list of options. See scons manpage for more info.
30 #######################################################################
31 # Minimal scons version
33 EnsureSConsVersion(2, 4)
34 EnsurePythonVersion(2, 7)
37 #######################################################################
38 # Configuration options
40 opts = Variables('config.py')
41 common.AddOptions(opts)
46 toolpath = ['#scons'],
50 # XXX: This creates a many problems as it saves...
51 #opts.Save('config.py', env)
53 # Backwards compatability with old target configuration variable
55 targets = ARGUMENTS['targets']
59 targets = targets.split(',')
60 print('scons: warning: targets option is deprecated; pass the targets on their own such as')
62 print(' scons %s' % ' '.join(targets))
64 COMMAND_LINE_TARGETS.append(targets)
67 Help(opts.GenerateHelpText(env))
69 #######################################################################
72 with open("VERSION") as f:
73 mesa_version = f.read().strip()
74 env.Append(CPPDEFINES = [
75 ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version),
76 ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'),
80 env.Prepend(CPPPATH = [
83 env.Append(CPPPATH = [
84 '#/src/gallium/include',
85 '#/src/gallium/auxiliary',
86 '#/src/gallium/drivers',
87 '#/src/gallium/winsys',
94 # Add a check target for running tests
95 check = env.Alias('check')
96 env.AlwaysBuild(check)
99 #######################################################################
100 # Invoke host SConscripts
102 # For things that are meant to be run on the native host build machine, instead
103 # of the target machine.
106 # Create host environent
107 if env['crosscompile'] and not env['embedded']:
108 host_env = Environment(
112 toolpath = ['#scons'],
117 host_env['platform'] = common.host_platform
118 host_env['machine'] = common.host_machine
119 host_env['toolchain'] = 'default'
120 host_env['llvm'] = False
122 host_env.Tool('gallium')
124 host_env['hostonly'] = True
125 assert host_env['crosscompile'] == False
133 variant_dir = host_env['build_dir'],
134 duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
141 #######################################################################
144 # TODO: Build several variants at the same time?
145 # http://www.scons.org/wiki/SimultaneousVariantBuilds
149 variant_dir = env['build_dir'],
150 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
154 ########################################################################
158 from SCons.Node.Alias import default_ans
162 aliases = sorted(default_ans.keys())
164 env.Help('Recognized targets:\n')
165 for alias in aliases:
166 env.Help(' %s\n' % alias)