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':
75 force
= ARGUMENTS
['force_scons']
76 if force
.lower() not in {'false', 'off', 'none', '0', 'n'}:
77 print("WARNING: Scons is deprecated for non-windows platforms (including cygwin) "
78 "please use meson instead.", file=sys
.stderr
)
80 print("ERROR: Scons is deprecated for non-windows platforms (including cygwin) "
81 "please use meson instead. If you really need to use scons you "
82 "can add `force_scons=1` to the scons command line.", file=sys
.stderr
)
85 print("WARNING: Scons support is in the process of being deprecated on "
86 "on windows platforms (including mingw). If you haven't already "
87 "please try using meson for windows builds. Be sure to report any "
88 "issues you run into", file=sys
.stderr
)
91 #######################################################################
94 with
open("VERSION") as f
:
95 mesa_version
= f
.read().strip()
96 env
.Append(CPPDEFINES
= [
97 ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version
),
98 ('PACKAGE_BUGREPORT', '\\"https://gitlab.freedesktop.org/mesa/mesa/issues\\"'),
102 env
.Prepend(CPPPATH
= [
105 env
.Append(CPPPATH
= [
106 '#/src/gallium/include',
107 '#/src/gallium/auxiliary',
108 '#/src/gallium/drivers',
109 '#/src/gallium/winsys',
116 # Add a check target for running tests
117 check
= env
.Alias('check')
118 env
.AlwaysBuild(check
)
121 #######################################################################
122 # Invoke host SConscripts
124 # For things that are meant to be run on the native host build machine, instead
125 # of the target machine.
128 # Create host environent
129 if env
['crosscompile'] and not env
['embedded']:
130 host_env
= Environment(
134 toolpath
= ['#scons'],
139 host_env
['platform'] = common
.host_platform
140 host_env
['machine'] = common
.host_machine
141 host_env
['toolchain'] = 'default'
142 host_env
['llvm'] = False
144 host_env
.Tool('gallium')
146 host_env
['hostonly'] = True
147 assert host_env
['crosscompile'] == False
155 variant_dir
= host_env
['build_dir'],
156 duplicate
= 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
163 #######################################################################
166 # TODO: Build several variants at the same time?
167 # http://www.scons.org/wiki/SimultaneousVariantBuilds
171 variant_dir
= env
['build_dir'],
172 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
176 ########################################################################
180 from SCons
.Node
.Alias
import default_ans
184 aliases
= sorted(default_ans
.keys())
186 env
.Help('Recognized targets:\n')
187 for alias
in aliases
:
188 env
.Help(' %s\n' % alias
)