scons: add code to generate the various GL API files
[mesa.git] / src / glx / SConscript
1 Import('*')
2
3 from sys import executable as python_cmd
4
5 env = env.Clone()
6
7 env.Prepend(CPPPATH = [
8 '.', # the build/<platform>/glx/ directory
9 '#include',
10 '#include/GL/internal',
11 '#src/mesa',
12 '#src/mapi',
13 '#src/mapi/glapi',
14 #$(LIBDRM_CFLAGS)
15 #$(DRI2PROTO_CFLAGS)
16 #$(GLPROTO_CFLAGS)
17 #$(X11_INCLUDES)
18 ])
19
20 env.Append(CPPDEFINES = [
21 '_REENTRANT',
22 #('DEFAULT_DRIVER_DIR', 'DRI_DRIVER_SEARCH_DIR')
23 ])
24
25 env.Prepend(LIBS = [
26 glapi
27 ])
28
29 env.PkgUseModules('X11')
30 env.PkgUseModules('XCB')
31 env.PkgUseModules('DRM')
32
33 if env['HAVE_XF86VIDMODE']:
34 env.Append(CPPDEFINES = ['XF86VIDMODE'])
35 env.PkgUseModules('XF86VIDMODE')
36
37 if False: # XXX: SHARED_GLAPI
38 env.Append(CPPDEFINES = ['GLX_SHARED_GLAPI'])
39
40 sources = [
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 'render2.c',
64 'renderpix.c',
65 'single2.c',
66 'singlepix.c',
67 'vertarr.c',
68 'xfont.c',
69 'glx_pbuffer.c',
70 'glx_query.c',
71 'drisw_glx.c',
72 'dri_common.c',
73 'dri_glx.c',
74 'XF86dri.c',
75 'glxhash.c',
76 'dri2_glx.c',
77 'dri2.c',
78 'applegl_glx.c',
79 ]
80
81 libgl = env.SharedLibrary(
82 target ='GL',
83 source = sources,
84 )
85
86
87 # Generate GLX-specific .c and .h files here. Other GL API-related
88 # files are used, but they're generated in mapi/glapi/gen/ since they're
89 # used by other targets as well.
90
91 GLAPI = '#src/mapi/glapi/'
92
93 env.CodeGenerate(
94 target = 'indirect.c',
95 script = GLAPI + 'gen/glX_proto_send.py',
96 source = GLAPI + 'gen/gl_and_es_API.xml',
97 command = python_cmd + ' $SCRIPT -f $SOURCE -m proto > $TARGET'
98 )
99
100 env.CodeGenerate(
101 target = 'indirect_size.c',
102 script = GLAPI + 'gen/glX_proto_size.py',
103 source = GLAPI + 'gen/gl_API.xml',
104 command = python_cmd + ' $SCRIPT -f $SOURCE -m size_c --only-set > $TARGET'
105 )
106
107 env.CodeGenerate(
108 target = 'indirect_init.c',
109 script = GLAPI + 'gen/glX_proto_send.py',
110 source = GLAPI + 'gen/gl_API.xml',
111 command = python_cmd + ' $SCRIPT -f $SOURCE -m init_c > $TARGET'
112 )
113
114 headers = []
115
116 headers += env.CodeGenerate(
117 target = 'indirect_size.h',
118 script = GLAPI + 'gen/glX_proto_size.py',
119 source = GLAPI + 'gen/gl_API.xml',
120 command = python_cmd + ' $SCRIPT -f $SOURCE -m size_h --only-set -h _INDIRECT_SIZE_H > $TARGET'
121 )
122
123 headers += env.CodeGenerate(
124 target = 'indirect.h',
125 script = GLAPI + 'gen/glX_proto_send.py',
126 source = GLAPI + 'gen/gl_API.xml',
127 command = python_cmd + ' $SCRIPT -m init_h -f $SOURCE > $TARGET',
128 )
129
130
131 env.Depends(sources, headers)
132
133
134 libgl = env.InstallSharedLibrary(libgl, version=(1, 2))
135
136 env.Alias('glx', libgl)
137 env.Alias('libgl', libgl)