Move mm.c code into util module.
[mesa.git] / SConstruct
index 01732b0c5287f7e4734eb0cb26cff52e1bc01e40..b20f88a303e9ecaf3204b80625ed4ee1442a8565 100644 (file)
@@ -11,7 +11,7 @@ import sys
 #
 # 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:
@@ -19,7 +19,7 @@ import sys
 #   # config.py
 #   debug=1
 #   dri=0
-#   x86=1
+#   machine='x86'
 # 
 # Invoke
 #
@@ -32,10 +32,13 @@ import sys
 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
@@ -53,6 +56,7 @@ else:
 # replicate options values in local variables
 debug = env['debug']
 dri = env['dri']
+llvm = env['llvm']
 machine = env['machine']
 
 # derived options
@@ -64,6 +68,7 @@ Export([
        'debug', 
        'x86', 
        'dri', 
+       'llvm',
        'platform',
        'gcc',
        'msvc',
@@ -93,19 +98,8 @@ if gcc:
        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:
@@ -117,9 +111,9 @@ env.Append(CPPPATH = [
        '#/include',
        '#/src/mesa',
        '#/src/mesa/main',
-       '#/src/mesa/pipe',
-       
-       '/usr/X11R6/include',
+       '#/src/gallium/include',
+       '#/src/gallium/auxiliary',
+       '#/src/gallium/drivers',
 ])
 
 
@@ -135,14 +129,28 @@ if x86:
                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:
@@ -154,6 +162,14 @@ 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 = [
@@ -209,6 +225,8 @@ build_topdir = 'build'
 build_subdir = platform
 if dri:
        build_subdir += "-dri"
+if llvm:
+       build_subdir += "-llvm"
 if x86:
        build_subdir += "-x86"
 if debug:
@@ -219,7 +237,7 @@ build_dir = os.path.join(build_topdir, build_subdir)
 # 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
 )