wscript 3.11 KB
Newer Older
1
2
#!/usr/bin/env python
# encoding: utf-8
3
4
import sys
sys.path.insert(0, './waf_tools')
5

6
7
VERSION = '0.0.1'
APPNAME = 'limbo'
8
9
10
11

srcdir = '.'
blddir = 'build'

12
import glob
13
import limbo
14
from waflib.Build import BuildContext
15

16

17
18
19
20
21
def options(opt):
        opt.load('compiler_cxx boost waf_unit_test')
        opt.load('compiler_c')
        opt.load('eigen')
        opt.load('tbb')
22
        opt.load('mkl')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
23
        opt.load('sferes')
24
        opt.load('limbo')
25
26
        opt.load('openmp')
        #opt.load('ode')
27
        opt.add_option('--exp', type='string', help='exp(s) to build, separate by comma', dest='exp')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
28
29
        opt.add_option('--qsub', type='string', help='config file (json) to submit to torque', dest='qsub')
        opt.add_option('--oar', type='string', help='config file (json) to submit to oar', dest='oar')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
30
        opt.load('xcode')
31
32
33
        for i in glob.glob('exp/*'):
                opt.recurse(i)

34

35
def configure(conf):
36
        conf.load('compiler_cxx boost waf_unit_test')
37
38
39
        conf.load('compiler_c')
        conf.load('eigen')
        conf.load('tbb')
40
        conf.load('mkl')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
41
        conf.load('sferes')
42
        conf.load('openmp')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
43
        conf.load('xcode')
44

45
46
47
        if conf.env.CXX_NAME in ["icc", "icpc"]:
            common_flags = "-Wall -std=c++11"
            opt_flags = " -O3 -xHost  -march=native -mtune=native -unroll -fma -g"
48
        else:
49
50
51
52
53
            if int(conf.env['CC_VERSION'][0]+conf.env['CC_VERSION'][1]) < 47:
                common_flags = "-Wall -std=c++0x"
            else:
                common_flags = "-Wall -std=c++11"
            opt_flags = " -O3 -march=native -g"
54

55
        conf.check_boost(lib='serialization filesystem \
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
56
            system unit_test_framework program_options \
57
            graph thread', min_version='1.39')
58
59
        conf.check_eigen()
        conf.check_tbb()
60
61
        conf.check_openmp()
        conf.check_mkl()
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
62
        conf.check_sferes()
63
        #conf.check_ode()
64
        if conf.is_defined('USE_TBB'):
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
65
                common_flags += " -DUSE_TBB"
66

Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
67
        if conf.is_defined('USE_SFERES'):
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
68
                common_flags += " -DUSE_SFERES -DSFERES_FAST_DOMSORT"
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
69

70
        if conf.env['CXXFLAGS_ODE']:
71
                common_flags += ' ' + conf.env['CXXFLAGS_ODE']
72

73
74
        all_flags = common_flags + opt_flags
        conf.env['CXXFLAGS'] = conf.env['CXXFLAGS'] + all_flags.split(' ')
75
76
        print conf.env['CXXFLAGS']

Jean-Baptiste Mouret's avatar
misc    
Jean-Baptiste Mouret committed
77
78
79
80
81
82
        if conf.options.exp:
                for i in conf.options.exp.split(','):
                        print 'configuring for exp: ' + i
                        conf.recurse('exp/' + i)


83
def build(bld):
84
85
86
87
88
    bld.recurse('src/')
    if bld.options.exp:
        for i in bld.options.exp.split(','):
            print 'Building exp: ' + i
            bld.recurse('exp/' + i)
89
90
        from waflib.Tools import waf_unit_test
        bld.add_post_fun(waf_unit_test.summary)
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
91

92

93
94
95
96
def build_extensive_tests(ctx):
    ctx.recurse('src/tests')


97
def shutdown(ctx):
98
99
    if ctx.options.qsub:
        limbo.qsub(ctx.options.qsub)
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
100
101
    if ctx.options.oar:
        limbo.oar(ctx.options.oar)
102
103
104
105
106


class BuildExtensiveTestsContext(BuildContext):
    cmd = 'build_extensive_tests'
    fun = 'build_extensive_tests'