~glmark2-dev/glmark2/libmatrix-util

« back to all changes in this revision

Viewing changes to wscript

  • Committer: Alexandros Frantzis
  • Date: 2010-07-12 10:06:29 UTC
  • Revision ID: git-v1:32841650dbc96bb732093df311cbc7425515e5ab
Use waf for build system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import commands
 
2
import subprocess
 
3
import os
 
4
import Options
 
5
import Scripting
 
6
 
 
7
blddir = 'build'
 
8
 
 
9
top = '.'
 
10
VERSION = '0.1.0'
 
11
APPNAME = 'glmark2'
 
12
 
 
13
# Produce '.tar.gz' with ./waf dist
 
14
Scripting.g_gz = 'gz'
 
15
 
 
16
def set_options(opt):
 
17
        opt.tool_options('compiler_cxx')
 
18
 
 
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')
 
22
 
 
23
def configure(conf):
 
24
        conf.check_tool('compiler_cxx')
 
25
        conf.check_tool('misc')
 
26
        
 
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)
 
31
                
 
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)
 
36
 
 
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)
 
41
                
 
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',
 
46
                                mandatory = True)
 
47
                                
 
48
        conf.env.append_unique('CXXFLAGS', '-Wall -Wextra -pedantic'.split(' '))
 
49
 
 
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')
 
55
 
 
56
        if Options.options.data_path is None:
 
57
                Options.options.data_path = os.path.join(conf.env.PREFIX, 'share/glmark2')
 
58
 
 
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)
 
61
 
 
62
        print("Data path: %s" % Options.options.data_path)
 
63
        print("Prefix   : %s" % conf.env.PREFIX)
 
64
 
 
65
def build(bld):
 
66
        bld.recurse('src')
 
67
        bld.recurse('data')