8
APPNAME = 'glcompbench'
11
opt.tool_options('compiler_cc')
12
opt.tool_options('compiler_cxx')
14
opt.add_option('--no-debug', action='store_false', dest = 'debug', default = True, help='disable compiler debug information')
15
opt.add_option('--no-opt', action='store_false', dest = 'opt', default = True, help='disable compiler optimizations')
16
opt.add_option('--data-path', action='store', dest = 'data_path', help='the path to install the data to')
19
ctx.check_tool('compiler_cxx')
21
# Check required headers
22
req_headers = ['inttypes.h', 'stdint.h', 'sys/time.h']
23
for header in req_headers:
24
ctx.check_cxx(header_name = header, mandatory = True)
26
# Check for required libs
27
req_libs = [('m', 'm')]
28
for (lib, uselib) in req_libs:
29
ctx.check_cxx(lib = lib, uselib_store = uselib)
31
# Check required functions
32
req_funcs = [('gettimeofday', 'sys/time.h', []) ,('sqrt', 'math.h', ['m']),
33
('strtol', 'stdlib.h', []), ('strtoul', 'stdlib.h', [])]
34
for func, header, uselib in req_funcs:
35
ctx.check_cxx(function_name = func, header_name = header, uselib = uselib, mandatory = True)
37
# Check required packages
38
req_pkgs = [('egl', 'egl'), ('glesv2', 'glesv2'), ('x11', 'x11'),
39
('xdamage', 'xdamage'), ('xcomposite', 'xcomposite')]
40
for (pkg, uselib) in req_pkgs:
41
ctx.check_cfg(package = pkg, uselib_store = uselib, args = '--cflags --libs',
44
ctx.env.append_unique('CXXFLAGS', '-Wall -Wextra'.split(' '))
46
# Prepend -O# and -g flags so that they can be overriden by the CFLAGS environment variable
47
if Options.options.opt:
48
ctx.env.prepend_value('CXXFLAGS', '-O2')
49
if Options.options.debug:
50
ctx.env.prepend_value('CXXFLAGS', '-g')
52
if Options.options.data_path is None:
53
Options.options.data_path = os.path.join(ctx.env.PREFIX, 'share/glcompbench')
55
ctx.env.append_unique('GLCOMPBENCH_DATA_PATH', Options.options.data_path)
56
ctx.env.append_unique('DEFINES', 'GLCOMPBENCH_DATA_PATH="%s"' % Options.options.data_path)
57
ctx.env.append_unique('DEFINES', 'GLCOMPBENCH_VERSION="%s"' % VERSION)
59
ctx.msg("Prefix", ctx.env.PREFIX, color='PINK')
60
ctx.msg("Data path", Options.options.data_path, color='PINK')