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
)
84 #######################################################################
87 with
open("VERSION") as f
:
88 mesa_version
= f
.read().strip()
89 env
.Append(CPPDEFINES
= [
90 ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version
),
91 ('PACKAGE_BUGREPORT', '\\"https://gitlab.freedesktop.org/mesa/mesa/issues\\"'),
95 env
.Prepend(CPPPATH
= [
98 env
.Append(CPPPATH
= [
99 '#/src/gallium/include',
100 '#/src/gallium/auxiliary',
101 '#/src/gallium/drivers',
102 '#/src/gallium/winsys',
109 # Add a check target for running tests
110 check
= env
.Alias('check')
111 env
.AlwaysBuild(check
)
114 #######################################################################
115 # Invoke host SConscripts
117 # For things that are meant to be run on the native host build machine, instead
118 # of the target machine.
121 # Create host environent
122 if env
['crosscompile'] and not env
['embedded']:
123 host_env
= Environment(
127 toolpath
= ['#scons'],
132 host_env
['platform'] = common
.host_platform
133 host_env
['machine'] = common
.host_machine
134 host_env
['toolchain'] = 'default'
135 host_env
['llvm'] = False
137 host_env
.Tool('gallium')
139 host_env
['hostonly'] = True
140 assert host_env
['crosscompile'] == False
148 variant_dir
= host_env
['build_dir'],
149 duplicate
= 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
156 #######################################################################
159 # TODO: Build several variants at the same time?
160 # http://www.scons.org/wiki/SimultaneousVariantBuilds
164 variant_dir
= env
['build_dir'],
165 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
169 ########################################################################
173 from SCons
.Node
.Alias
import default_ans
177 aliases
= sorted(default_ans
.keys())
179 env
.Help('Recognized targets:\n')
180 for alias
in aliases
:
181 env
.Help(' %s\n' % alias
)