scons: Add support for GLES.
[mesa.git] / src / mapi / glapi / SConscript
1 #######################################################################
2 # SConscript for glapi
3
4
5 Import('*')
6
7 if env['platform'] != 'winddk':
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 ])
30
31 glapi_sources = [
32 'glapi_dispatch.c',
33 'glapi_entrypoint.c',
34 'glapi_getproc.c',
35 'glapi_nop.c',
36 'glthread.c',
37 'glapi.c',
38 ]
39
40 mapi_sources = [
41 'u_current.c',
42 'u_execmem.c',
43 'u_thread.c',
44 ]
45 for s in mapi_sources:
46 o = env.SharedObject(s[:-2], '../mapi/' + s)
47 glapi_sources.append(o)
48
49 #
50 # Assembly sources
51 #
52 if env['gcc'] and env['platform'] != 'windows':
53 if env['machine'] == 'x86':
54 env.Append(CPPDEFINES = [
55 'USE_X86_ASM',
56 'USE_MMX_ASM',
57 'USE_3DNOW_ASM',
58 'USE_SSE_ASM',
59 ])
60 glapi_sources += [
61 'glapi_x86.S',
62 ]
63 elif env['machine'] == 'x86_64':
64 env.Append(CPPDEFINES = [
65 'USE_X86_64_ASM',
66 ])
67 glapi_sources += [
68 'glapi_x86-64.S'
69 ]
70 elif env['machine'] == 'ppc':
71 env.Append(CPPDEFINES = [
72 'USE_PPC_ASM',
73 'USE_VMX_ASM',
74 ])
75 glapi_sources += [
76 ]
77 elif env['machine'] == 'sparc':
78 glapi_sources += [
79 'glapi_sparc.S'
80 ]
81 else:
82 pass
83
84 glapi = env.ConvenienceLibrary(
85 target = 'glapi',
86 source = glapi_sources,
87 )
88 Export('glapi')