1Import('*')
2
3if not env['x11'] or not env['xcb'] or not env['drm']:
4    Return()
5
6from sys import executable as python_cmd
7
8env = env.Clone()
9
10env.Prepend(CPPPATH = [
11	'.',           # the build/<platform>/glx/ directory
12	'#include',
13	'#include/GL/internal',
14	'#src/',
15	'#src/loader',
16	'#src/mesa',
17	'#src/mapi',
18	'#src/mapi/glapi',
19	#$(LIBDRM_CFLAGS)
20	#$(DRI2PROTO_CFLAGS)
21	#$(GLPROTO_CFLAGS)
22	#$(X11_INCLUDES)
23])
24
25env.Append(CPPDEFINES = [
26    '_REENTRANT',
27])
28
29env.Prepend(LIBS = [
30    libloader,
31    mesautil,
32    glapi
33])
34
35env.PkgUseModules('X11')
36env.PkgUseModules('XCB')
37env.PkgUseModules('DRM')
38env.PkgUseModules('XF86VIDMODE')
39
40sources = [
41    'clientattrib.c',
42    'clientinfo.c',
43    'create_context.c',
44    'compsize.c',
45    'eval.c',
46    'glx_error.c',
47    'glxconfig.c',
48    'glxcmds.c',
49    'glxcurrent.c',
50    'glxext.c',
51    'glxextensions.c',
52    'indirect_glx.c',
53    'indirect.c',
54    'indirect_init.c',
55    'indirect_size.c',
56    'indirect_window_pos.c',
57    'indirect_texture_compression.c',
58    'indirect_transpose_matrix.c',
59    'indirect_vertex_array.c',
60    'indirect_vertex_program.c',
61    'pixel.c',
62    'pixelstore.c',
63    'query_renderer.c',
64    'render2.c',
65    'renderpix.c',
66    'single2.c',
67    'singlepix.c',
68    'vertarr.c',
69    'xfont.c',
70    'glx_pbuffer.c',
71    'glx_query.c',
72    'drisw_glx.c',
73    'dri_common.c',
74    'dri_glx.c',
75    'XF86dri.c',
76    'glxhash.c',
77    'dri2_glx.c',
78    'dri2.c',
79    'dri_common_query_renderer.c',
80    'dri_common_interop.c',
81    #'dri3_glx.c',
82    'applegl_glx.c',
83]
84
85libgl = env.SharedLibrary(
86    target ='GL',
87    source = sources,
88)
89
90
91# Generate GLX-specific .c and .h files here.  Other GL API-related
92# files are used, but they're generated in mapi/glapi/gen/ since they're
93# used by other targets as well.
94
95GLAPI = '#src/mapi/glapi/'
96sources = [GLAPI + 'gen/gl_API.xml'] + env.Glob(GLAPI + 'gen/*.xml')
97
98env.CodeGenerate(
99    target = 'indirect.c',
100    script = GLAPI + 'gen/glX_proto_send.py',
101    source = sources,
102    command = python_cmd + ' $SCRIPT -f $SOURCE -m proto > $TARGET'
103    )
104
105env.CodeGenerate(
106    target = 'indirect_size.c',
107    script = GLAPI + 'gen/glX_proto_size.py',
108    source = sources,
109    command = python_cmd + ' $SCRIPT -f $SOURCE -m size_c --only-set > $TARGET'
110)
111
112env.CodeGenerate(
113    target = 'indirect_init.c',
114    script = GLAPI + 'gen/glX_proto_send.py',
115    source = sources,
116    command = python_cmd + ' $SCRIPT -f $SOURCE -m init_c > $TARGET'
117)
118
119env.CodeGenerate(
120    target = 'indirect_size.h',
121    script = GLAPI + 'gen/glX_proto_size.py',
122    source = sources,
123    command = python_cmd + ' $SCRIPT -f $SOURCE -m size_h --only-set --header-tag _INDIRECT_SIZE_H > $TARGET'
124)
125
126env.CodeGenerate(
127    target = 'indirect.h',
128    script = GLAPI + 'gen/glX_proto_send.py',
129    source = sources,
130    command = python_cmd + ' $SCRIPT -m init_h -f $SOURCE > $TARGET',
131    )
132
133
134libgl = env.InstallSharedLibrary(libgl, version=(1, 2))
135
136env.Alias('glx', libgl)
137env.Alias('libgl', libgl)
138