scons: Get GLSL code building correctly when cross compiling.
[mesa.git] / SConstruct
index 4a0fb94debc9fbbf2e5a99263355cf398e32f381..e71fcd673a0234fffecf464cf4a0f2741e0a899d 100644 (file)
@@ -32,7 +32,7 @@ import common
 default_statetrackers = 'mesa'
 
 if common.default_platform in ('linux', 'freebsd', 'darwin'):
-       default_drivers = 'softpipe,failover,i915simple,trace,identity'
+       default_drivers = 'softpipe,failover,i915simple,trace,identity,llvmpipe'
        default_winsys = 'xlib'
 elif common.default_platform in ('winddk',):
        default_drivers = 'softpipe,i915simple,trace,identity'
@@ -44,9 +44,9 @@ else:
 opts = Variables('config.py')
 common.AddOptions(opts)
 opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
-                     ['mesa', 'python']))
+                     ['mesa', 'python', 'xorg']))
 opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
-                     ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300', 'identity']))
+                     ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
 opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
                      ['xlib', 'intel', 'gdi', 'radeon']))
 
@@ -160,6 +160,25 @@ Export('env')
 # TODO: Build several variants at the same time?
 # http://www.scons.org/wiki/SimultaneousVariantBuilds
 
+if env['platform'] != common.default_platform:
+    # GLSL code has to be built twice -- one for the host OS, another for the target OS...
+
+    host_env = Environment(
+        # options are ignored
+        # default tool is used
+        toolpath = ['#scons'], 
+        ENV = os.environ,
+    )
+
+    host_env['platform'] = common.default_platform
+
+    SConscript(
+        'src/glsl/SConscript',
+        variant_dir = env['build'] + '/host',
+        duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
+        exports={'env':host_env},
+    )
+
 SConscript(
        'src/SConscript',
        variant_dir = env['build'],