scons: Add missing dependencies to src/mapi/glapi/gen/*.xml
[mesa.git] / src / mapi / glapi / SConscript
1 #######################################################################
2 # SConscript for glapi
3
4
5 from sys import executable as python_cmd
6
7 Import('*')
8
9 env = env.Clone()
10
11 env.Append(CPPDEFINES = [
12 'MAPI_MODE_UTIL',
13 ])
14
15 if env['platform'] == 'windows':
16 env.Append(CPPDEFINES = [
17 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
18 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
19 ])
20 if env['gles']:
21 env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])
22 else:
23 # prevent _glapi_* from being declared __declspec(dllimport)
24 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
25
26 env.Append(CPPPATH = [
27 '#/src/mapi',
28 '#/src/mesa',
29 Dir('..'), # src/mapi build path
30 ])
31
32 glapi_sources = [
33 'glapi_dispatch.c',
34 'glapi_entrypoint.c',
35 'glapi_getproc.c',
36 'glapi_nop.c',
37 'glthread.c',
38 'glapi.c',
39 ]
40
41 mapi_sources = [
42 'u_current.c',
43 'u_execmem.c',
44 ]
45 for s in mapi_sources:
46 o = env.SharedObject(s[:-2], '../' + s)
47 glapi_sources.append(o)
48
49 #
50 # Assembly sources
51 #
52 if (env['gcc'] or env['clang']) and \
53 env['platform'] not in ('cygwin', 'darwin', 'windows'):
54 GLAPI = '#src/mapi/glapi/'
55 sources = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml')
56
57 if env['machine'] == 'x86':
58 env.Append(CPPDEFINES = [
59 'USE_X86_ASM',
60 ])
61 glapi_sources += [
62 'glapi_x86.S',
63 ]
64 env.CodeGenerate(
65 target = 'glapi_x86.S',
66 script = GLAPI + 'gen/gl_x86_asm.py',
67 source = sources,
68 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
69 )
70 elif env['machine'] == 'x86_64':
71 env.Append(CPPDEFINES = [
72 'USE_X86_64_ASM',
73 ])
74 glapi_sources += [
75 'glapi_x86-64.S'
76 ]
77 env.CodeGenerate(
78 target = 'glapi_x86-64.S',
79 script = GLAPI + 'gen/gl_x86-64_asm.py',
80 source = sources,
81 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
82 )
83 elif env['machine'] == 'sparc':
84 env.Append(CPPDEFINES = [
85 'USE_SPARC_ASM',
86 ])
87 glapi_sources += [
88 'glapi_sparc.S'
89 ]
90 env.CodeGenerate(
91 target = 'glapi_sparc.S',
92 script = GLAPI + 'gen/gl_SPARC_asm.py',
93 source = sources,
94 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
95 )
96 else:
97 pass
98
99 glapi = env.ConvenienceLibrary(
100 target = 'glapi',
101 source = glapi_sources,
102 )
103 Export('glapi')