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.
23 from __future__
import print_function
31 #######################################################################
32 # Minimal scons version
34 EnsureSConsVersion(2, 4)
35 EnsurePythonVersion(2, 7)
38 #######################################################################
39 # Configuration options
41 opts
= Variables('config.py')
42 common
.AddOptions(opts
)
47 toolpath
= ['#scons'],
51 # XXX: This creates a many problems as it saves...
52 #opts.Save('config.py', env)
54 # Backwards compatability with old target configuration variable
56 targets
= ARGUMENTS
['targets']
60 targets
= targets
.split(',')
61 print('scons: warning: targets option is deprecated; pass the targets on their own such as')
63 print(' scons %s' % ' '.join(targets
))
65 COMMAND_LINE_TARGETS
.append(targets
)
68 Help(opts
.GenerateHelpText(env
))
71 #######################################################################
72 # Print a deprecation warning for using scons on non-windows
74 if common
.host_platform
!= 'windows' and env
['platform'] != 'windows':
75 if env
['force_scons']:
76 print("WARNING: Scons is deprecated for non-windows platforms (including cygwin) "
77 "please use meson instead.", file=sys
.stderr
)
79 print("ERROR: Scons is deprecated for non-windows platforms (including cygwin) "
80 "please use meson instead. If you really need to use scons you "
81 "can add `force_scons=1` to the scons command line.", file=sys
.stderr
)
84 print("WARNING: Scons support is in the process of being deprecated on "
85 "on windows platforms (including mingw). If you haven't already "
86 "please try using meson for windows builds. Be sure to report any "
87 "issues you run into", file=sys
.stderr
)
90 #######################################################################
93 with
open("VERSION") as f
:
94 mesa_version
= f
.read().strip()
95 env
.Append(CPPDEFINES
= [
96 ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version
),
97 ('PACKAGE_BUGREPORT', '\\"https://gitlab.freedesktop.org/mesa/mesa/issues\\"'),
101 env
.Prepend(CPPPATH
= [
104 env
.Append(CPPPATH
= [
105 '#/src/gallium/include',
106 '#/src/gallium/auxiliary',
107 '#/src/gallium/drivers',
108 '#/src/gallium/winsys',
115 # Add a check target for running tests
116 check
= env
.Alias('check')
117 env
.AlwaysBuild(check
)
120 #######################################################################
121 # Invoke host SConscripts
123 # For things that are meant to be run on the native host build machine, instead
124 # of the target machine.
127 # Create host environent
128 if env
['crosscompile'] and not env
['embedded']:
129 host_env
= Environment(
133 toolpath
= ['#scons'],
138 host_env
['platform'] = common
.host_platform
139 host_env
['machine'] = common
.host_machine
140 host_env
['toolchain'] = 'default'
141 host_env
['llvm'] = False
143 host_env
.Tool('gallium')
145 host_env
['hostonly'] = True
146 assert host_env
['crosscompile'] == False
154 variant_dir
= host_env
['build_dir'],
155 duplicate
= 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
162 #######################################################################
165 # TODO: Build several variants at the same time?
166 # http://www.scons.org/wiki/SimultaneousVariantBuilds
170 variant_dir
= env
['build_dir'],
171 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
175 ########################################################################
179 from SCons
.Node
.Alias
import default_ans
183 aliases
= sorted(default_ans
.keys())
185 env
.Help('Recognized targets:\n')
186 for alias
in aliases
:
187 env
.Help(' %s\n' % alias
)