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