1import common
2
3Import('*')
4
5from sys import executable as python_cmd
6
7env = env.Clone()
8
9env.MSVC2013Compat()
10
11env.Prepend(CPPPATH = [
12    '#include',
13    '#src',
14    '#src/mapi',
15    '#src/mesa',
16    '#src/gallium/include',
17    '#src/gallium/auxiliary',
18    '#src/util',
19    '#src/util/format',
20    env.Dir('format'), # Build path corresponding to src/util/format
21])
22
23env.CodeGenerate(
24    target = 'format_srgb.c',
25    script = 'format_srgb.py',
26    source = [],
27    command = python_cmd + ' $SCRIPT > $TARGET'
28)
29
30env.CodeGenerate(
31    target = 'format/u_format_pack.h',
32    script = 'format/u_format_table.py',
33    source = ['format/u_format.csv'],
34    command = python_cmd + ' $SCRIPT $SOURCE --header > $TARGET'
35)
36
37env.Depends('format/u_format_pack.h', [
38    'format/u_format_parse.py',
39    'format/u_format_pack.py',
40])
41
42env.CodeGenerate(
43    target = 'format/u_format_table.c',
44    script = 'format/u_format_table.py',
45    source = ['format/u_format.csv'],
46    command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
47)
48
49env.Depends('format/u_format_table.c', [
50    'format/u_format_parse.py',
51    'format/u_format_pack.py',
52])
53
54# parse Makefile.sources
55source_lists = env.ParseSourceList('Makefile.sources')
56
57mesautil_sources = (
58    source_lists['MESA_UTIL_FILES'] +
59    source_lists['MESA_UTIL_GENERATED_FILES']
60)
61
62mesautilenv = env.Clone()
63
64if env['dri']:
65    mesautil_sources += source_lists['XMLCONFIG_FILES']
66
67    mesautilenv.AppendUnique(LIBS = [
68        'expat',
69    ])
70
71mesautil = mesautilenv.ConvenienceLibrary(
72    target = 'mesautil',
73    source = mesautil_sources,
74)
75
76env.Alias('mesautil', mesautil)
77Export('mesautil')
78
79
80u_atomic_test = env.Program(
81    target = 'u_atomic_test',
82    source = ['u_atomic_test.c'],
83)
84env.UnitTest("u_atomic_test", u_atomic_test)
85
86roundeven_test = env.Program(
87    target = 'roundeven_test',
88    source = ['roundeven_test.c'],
89)
90env.UnitTest("roundeven_test", roundeven_test)
91
92env.Prepend(LIBS = [mesautil])
93mesa_sha1_test = env.Program(
94    target = 'mesa-sha1_test',
95    source = ['mesa-sha1_test.c'],
96)
97env.UnitTest("mesa-sha1_test", mesa_sha1_test)
98