scons: Revamp how to specify targets to build.
[mesa.git] / src / gallium / targets / libgl-xlib / SConscript
index 92e508ee50c9b8ad3c420a4d49d62f40313de7e1..582760eac93c3d28b218ec736531888d3387a7e7 100644 (file)
@@ -3,24 +3,10 @@
 
 Import('*')
 
-if env['platform'] != 'linux':
-    Return()
-
-if 'mesa' not in env['statetrackers']:
-    print 'warning: Mesa state tracker disabled: skipping build of xlib libGL.so'
-    Return()
-
-if env['dri']:
-    print 'warning: DRI enabled: skipping build of xlib libGL.so'
-    Return()
-
-if not set(('softpipe', 'llvmpipe', 'cell')).intersection(env['drivers']):
-    print 'warning: no supported pipe driver: skipping build of xlib libGL.so'
-    Return()
-
 env = env.Clone()
 
 env.Append(CPPPATH = [
+    '#/src/mapi',
     '#/src/mesa',
     '#/src/mesa/main',
     '#src/gallium/state_trackers/glx/xlib',
@@ -28,37 +14,50 @@ env.Append(CPPPATH = [
 
 env.Append(CPPDEFINES = ['USE_XSHM'])
 
+env.Prepend(LIBS = env['X11_LIBS'])
+
+env.Prepend(LIBS = [
+    st_xlib,
+    ws_xlib,
+    trace,
+    rbug,
+    identity,
+    glapi,
+    mesa,
+    glsl,
+    gallium,
+    'talloc'
+])
+
 sources = [
     'xlib.c',
 ]
 
-drivers = [trace]
-    
-if 'softpipe' in env['drivers']:
+if True:
     env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
-    sources += ['xlib_softpipe.c', 'xlib_sw_winsys.c']
-    drivers += [softpipe]
+    env.Prepend(LIBS = [softpipe])
 
-if 'llvmpipe' in env['drivers']:
-    env.Tool('llvm')
-    if 'LLVM_VERSION' in env:
-        env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-        env.Tool('udis86')
-        sources += ['xlib_llvmpipe.c', 'xlib_sw_winsys.c']
-        drivers += [llvmpipe]
+if True:
+    env.Append(CPPDEFINES = 'GALLIUM_GALAHAD')
+    env.Prepend(LIBS = [galahad])
+
+if env['llvm']:
+    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+    env.Prepend(LIBS = [llvmpipe])
     
-if 'cell' in env['drivers']:
+if False:
+    # TODO: Detect Cell SDK
     env.Append(CPPDEFINES = 'GALLIUM_CELL')
-    sources += ['xlib_cell.c']
-    drivers += [cell]
+    env.Prepend(LIBS = [cell])
 
 # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
 libgl = env.SharedLibrary(
     target ='GL',
     source = sources,
-    LIBS = st_xlib + glapi + mesa + glsl + drivers + gallium + env['LIBS'],
 )
 
-if not env['dri']:
-    # Only install this libGL.so if DRI not enabled
-    env.InstallSharedLibrary(libgl, version=(1, 5))
+if True:
+    # XXX: Only install this libGL.so if DRI not enabled
+    libgl = env.InstallSharedLibrary(libgl, version=(1, 5))
+
+env.Alias('libgl-xlib', libgl)