4097a7fe13894a556c381ec1ec8244b3ead5f849
[mesa.git] / src / mapi / glapi / SConscript
1 #######################################################################
2 # SConscript for glapi
3
4
5 Import('*')
6
7 env = env.Clone()
8
9 env.Append(CPPDEFINES = [
10 'MAPI_MODE_UTIL',
11 ])
12
13 if env['platform'] == 'windows':
14 env.Append(CPPDEFINES = [
15 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
16 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
17 ])
18 if env['gles']:
19 env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])
20 else:
21 # prevent _glapi_* from being declared __declspec(dllimport)
22 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
23
24 env.Append(CPPPATH = [
25 '#/src/mapi',
26 '#/src/mesa',
27 ])
28
29 glapi_sources = [
30 'glapi_dispatch.c',
31 'glapi_entrypoint.c',
32 'glapi_getproc.c',
33 'glapi_nop.c',
34 'glthread.c',
35 'glapi.c',
36 ]
37
38 mapi_sources = [
39 'u_current.c',
40 'u_execmem.c',
41 ]
42 for s in mapi_sources:
43 o = env.SharedObject(s[:-2], '../mapi/' + s)
44 glapi_sources.append(o)
45
46 #
47 # Assembly sources
48 #
49 if env['gcc'] and env['platform'] not in ('darwin', 'windows'):
50 if env['machine'] == 'x86':
51 env.Append(CPPDEFINES = [
52 'USE_X86_ASM',
53 ])
54 glapi_sources += [
55 'glapi_x86.S',
56 ]
57 elif env['machine'] == 'x86_64':
58 env.Append(CPPDEFINES = [
59 'USE_X86_64_ASM',
60 ])
61 glapi_sources += [
62 'glapi_x86-64.S'
63 ]
64 elif env['machine'] == 'sparc':
65 env.Append(CPPDEFINES = [
66 'USE_SPARC_ASM',
67 ])
68 glapi_sources += [
69 'glapi_sparc.S'
70 ]
71 else:
72 pass
73
74 if env['toolchain'] == 'crossmingw':
75 # compile these files without -gstabs option
76 glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_dispatch.c")
77 glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_getproc.c")
78
79 glapi = env.ConvenienceLibrary(
80 target = 'glapi',
81 source = glapi_sources,
82 )
83 Export('glapi')