#
# For example, invoke scons as
#
-# scons debug=1 dri=0 x86=1
+# scons debug=1 dri=0 machine=x86
#
# to set configuration variables. Or you can write those options to a file
# named config.py:
# # config.py
# debug=1
# dri=0
-# x86=1
+# machine='x86'
#
# Invoke
#
opts = Options('config.py')
opts.Add(BoolOption('debug', 'build debug version', False))
opts.Add(BoolOption('dri', 'build dri drivers', False))
+opts.Add(BoolOption('llvm', 'use llvm', False))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', 'x86',
allowed_values=('generic', 'x86', 'x86-64')))
-env = Environment(options = opts)
+env = Environment(
+ options = opts,
+ ENV = os.environ)
Help(opts.GenerateHelpText(env))
# for debugging
# replicate options values in local variables
debug = env['debug']
dri = env['dri']
+llvm = env['llvm']
machine = env['machine']
# derived options
'debug',
'x86',
'dri',
+ 'llvm',
'platform',
'gcc',
'msvc',
env.Append(CFLAGS = '-fmessage-length=0')
env.Append(CXXFLAGS = '-fmessage-length=0')
-# Defines
-env.Append(CPPDEFINES = [
- '_POSIX_SOURCE',
- ('_POSIX_C_SOURCE', '199309L'),
- '_SVID_SOURCE',
- '_BSD_SOURCE',
- '_GNU_SOURCE',
-
- 'PTHREADS',
- 'HAVE_ALIAS',
- 'HAVE_POSIX_MEMALIGN',
-])
+# Defines
if debug:
env.Append(CPPDEFINES = ['DEBUG'])
else:
'#/include',
'#/src/mesa',
'#/src/mesa/main',
- '#/src/mesa/pipe',
-
- '/usr/X11R6/include',
+ '#/src/gallium/include',
+ '#/src/gallium/auxiliary',
+ '#/src/gallium/drivers',
])
env.Append(CFLAGS = '-m32')
env.Append(CXXFLAGS = '-m32')
-env.Append(LIBPATH = ['/usr/X11R6/lib'])
-env.Append(LIBS = [
- 'm',
- 'pthread',
- 'expat',
- 'dl',
-])
+# Posix
+if platform in ('posix', 'linux', 'freebsd', 'darwin'):
+ env.Append(CPPDEFINES = [
+ '_POSIX_SOURCE',
+ ('_POSIX_C_SOURCE', '199309L'),
+ '_SVID_SOURCE',
+ '_BSD_SOURCE',
+ '_GNU_SOURCE',
+
+ 'PTHREADS',
+ 'HAVE_POSIX_MEMALIGN',
+ ])
+ env.Append(CPPPATH = ['/usr/X11R6/include'])
+ env.Append(LIBPATH = ['/usr/X11R6/lib'])
+ env.Append(LIBS = [
+ 'm',
+ 'pthread',
+ 'expat',
+ 'dl',
+ ])
+
# DRI
if dri:
'GLX_INDIRECT_RENDERING',
])
+# LLVM
+if llvm:
+ # See also http://www.scons.org/wiki/UsingPkgConfig
+ env.ParseConfig('llvm-config --cflags --ldflags --libs')
+ env.Append(CPPDEFINES = ['MESA_LLVM'])
+ env.Append(CXXFLAGS = ['-Wno-long-long'])
+
+
# libGL
if 1:
env.Append(LIBS = [
build_subdir = platform
if dri:
build_subdir += "-dri"
+if llvm:
+ build_subdir += "-llvm"
if x86:
build_subdir += "-x86"
if debug:
# http://www.scons.org/wiki/SimultaneousVariantBuilds
SConscript(
- 'src/mesa/SConscript',
+ 'src/SConscript',
build_dir = build_dir,
duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
)