gallium: Add support for SWR compilation
[mesa.git] / src / gallium / targets / libgl-xlib / SConscript
1 #######################################################################
2 # SConscript for xlib winsys
3
4 Import('*')
5
6 env = env.Clone()
7
8 env.Append(CPPPATH = [
9 '#/src/mapi',
10 '#/src/mesa',
11 '#/src/mesa/main',
12 '#src/gallium/state_trackers/glx/xlib',
13 Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
14 ])
15
16 env.Append(CPPDEFINES = ['USE_XSHM'])
17
18 env.Prepend(LIBS = env['X11_LIBS'])
19 env.Prepend(LIBPATH = env['X11_LIBPATH'])
20
21 # when GLES is enabled, gl* and _glapi_* belong to bridge_glapi and
22 # shared_glapi respectively
23 if env['gles']:
24 env.Prepend(LIBPATH = [shared_glapi.dir])
25 glapi = [bridge_glapi, 'glapi']
26
27 env.Prepend(LIBS = [
28 st_xlib,
29 ws_xlib,
30 glapi,
31 mesautil,
32 compiler,
33 mesa,
34 glsl,
35 nir,
36 gallium,
37 ])
38
39 sources = [
40 'xlib.c',
41 ]
42
43 if True:
44 env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_SOFTPIPE'])
45 env.Prepend(LIBS = [trace, rbug, softpipe])
46
47 if env['llvm']:
48 env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE'])
49 env.Prepend(LIBS = [llvmpipe])
50
51 if env['swr']:
52 env.Append(CPPDEFINES = 'HAVE_SWR')
53 env.Prepend(LIBS = [swr])
54
55 if env['platform'] != 'darwin':
56 # Disallow undefined symbols, except with Address Sanitizer, since libasan
57 # is not linked on shared libs, as it should be LD_PRELOAD'ed instead
58 if not env['asan']:
59 env.Append(SHLINKFLAGS = [
60 '-Wl,-z,defs',
61 ])
62 env.Append(SHLINKFLAGS = [
63 # Restrict exported symbols
64 '-Wl,--version-script=%s' % File("libgl-xlib.sym").srcnode().path,
65 ])
66
67 # libGL.so.1.5
68 libgl_1_5 = env.SharedLibrary(
69 target ='GL',
70 source = sources,
71 SHLIBSUFFIX = env['SHLIBSUFFIX'] + '.1.5',
72 )
73
74 # libGL.so.1
75 libgl = env.subst('${SHLIBPREFIX}GL${SHLIBSUFFIX}')
76 libgl_1 = libgl + '.1'
77 env.Command(libgl_1, libgl_1_5, "ln -sf ${SOURCE.file} ${TARGET}")
78 env.Command(libgl, libgl_1, "ln -sf ${SOURCE.file} ${TARGET}")
79
80 env.Alias('libgl-xlib', libgl)