13
# Produce '.tar.gz' with ./waf dist
17
opt.tool_options('compiler_cxx')
19
opt.add_option('--no-debug', action='store_false', dest = 'debug', default = True, help='disable compiler debug information')
20
opt.add_option('--no-opt', action='store_false', dest = 'opt', default = True, help='disable compiler optimizations')
21
opt.add_option('--data-path', action='store', dest = 'data_path', help='the path to install the data to')
24
conf.check_tool('compiler_cxx')
25
conf.check_tool('misc')
27
# Check required headers
28
req_headers = ['stdlib.h', 'string.h', 'unistd.h', 'fcntl.h']
29
for header in req_headers:
30
conf.check_cxx(header_name = header, mandatory = True)
32
# Check for required libs
33
req_libs = [('m', 'm')]
34
for (lib, uselib) in req_libs:
35
conf.check_cxx(lib = lib, uselib_store = uselib)
37
# Check required functions
38
req_funcs = [('memset', 'string.h', []) ,('sqrt', 'math.h', ['m'])]
39
for func, header, uselib in req_funcs:
40
conf.check_cxx(function_name = func, header_name = header, uselib = uselib, mandatory = True)
42
# Check required packages
43
req_pkgs = [('sdl', 'sdl'), ('gl', 'gl')]
44
for (pkg, uselib) in req_pkgs:
45
conf.check_cfg(package = pkg, uselib_store = uselib, args = '--cflags --libs',
48
conf.env.append_unique('CXXFLAGS', '-Wall -Wextra -pedantic'.split(' '))
50
# Prepend -O# and -g flags so that they can be overriden by the CFLAGS environment variable
51
if Options.options.opt:
52
conf.env.prepend_value('CXXFLAGS', '-O2')
53
if Options.options.debug:
54
conf.env.prepend_value('CXXFLAGS', '-g')
56
if Options.options.data_path is None:
57
Options.options.data_path = os.path.join(conf.env.PREFIX, 'share/glmark2')
59
conf.env.append_unique('GLMARK_DATA_PATH', Options.options.data_path)
60
conf.env.append_unique('CXXDEFINES', 'GLMARK_DATA_PATH="%s"' % Options.options.data_path)
62
print("Data path: %s" % Options.options.data_path)
63
print("Prefix : %s" % conf.env.PREFIX)