build: Move src/mapi/mapi/* to src/mapi/
[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'] and env['platform'] not in ('cygwin', 'darwin', 'windows'):
53 GLAPI = '#src/mapi/glapi/'
54
55 if env['machine'] == 'x86':
56 env.Append(CPPDEFINES = [
57 'USE_X86_ASM',
58 ])
59 glapi_sources += [
60 'glapi_x86.S',
61 ]
62 env.CodeGenerate(
63 target = 'glapi_x86.S',
64 script = GLAPI + 'gen/gl_x86_asm.py',
65 source = GLAPI + 'gen/gl_and_es_API.xml',
66 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
67 )
68 elif env['machine'] == 'x86_64':
69 env.Append(CPPDEFINES = [
70 'USE_X86_64_ASM',
71 ])
72 glapi_sources += [
73 'glapi_x86-64.S'
74 ]
75 env.CodeGenerate(
76 target = 'glapi_x86-64.S',
77 script = GLAPI + 'gen/gl_x86-64_asm.py',
78 source = GLAPI + 'gen/gl_and_es_API.xml',
79 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
80 )
81 elif env['machine'] == 'sparc':
82 env.Append(CPPDEFINES = [
83 'USE_SPARC_ASM',
84 ])
85 glapi_sources += [
86 'glapi_sparc.S'
87 ]
88 env.CodeGenerate(
89 target = 'glapi_sparc.S',
90 script = GLAPI + 'gen/gl_SPARC_asm.py',
91 source = GLAPI + 'gen/gl_and_es_API.xml',
92 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
93 )
94 else:
95 pass
96
97 if env['toolchain'] == 'crossmingw':
98 # compile these files without -gstabs option
99 glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_dispatch.c")
100 glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_getproc.c")
101
102 glapi = env.ConvenienceLibrary(
103 target = 'glapi',
104 source = glapi_sources,
105 )
106 Export('glapi')