~glcompbench-dev/glcompbench/trunk

« back to all changes in this revision

Viewing changes to wscript

  • Committer: Alexandros Frantzis
  • Date: 2011-01-17 18:15:21 UTC
  • Revision ID: alexandros.frantzis@linaro.org-20110117181521-rng36csayyf0obtv
Initial commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
import Options
 
3
 
 
4
out = 'build'
 
5
top = '.'
 
6
 
 
7
VERSION = '11.01'
 
8
APPNAME = 'glcompbench'
 
9
 
 
10
def options(opt):
 
11
    opt.tool_options('compiler_cc')
 
12
    opt.tool_options('compiler_cxx')
 
13
 
 
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')
 
17
 
 
18
def configure(ctx):
 
19
    ctx.check_tool('compiler_cxx')
 
20
 
 
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)
 
25
 
 
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)
 
30
 
 
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)
 
36
 
 
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',
 
42
                mandatory = True)
 
43
 
 
44
    ctx.env.append_unique('CXXFLAGS', '-Wall -Wextra'.split(' '))
 
45
 
 
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')
 
51
 
 
52
    if Options.options.data_path is None:
 
53
        Options.options.data_path = os.path.join(ctx.env.PREFIX, 'share/glcompbench')
 
54
 
 
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)
 
58
 
 
59
    ctx.msg("Prefix", ctx.env.PREFIX, color='PINK')
 
60
    ctx.msg("Data path", Options.options.data_path, color='PINK')
 
61
 
 
62
def build(ctx):
 
63
    ctx.recurse('src')
 
64
    ctx.recurse('data')
 
65
 
 
66
def dist(ctx):
 
67
    ctx.algo = 'tar.gz'