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