wscript 2.85 KB
Newer Older
1
2
3
#!/usr/bin/env python
# encoding: utf-8

4
5
VERSION = '0.0.1'
APPNAME = 'limbo'
6
7
8
9

srcdir = '.'
blddir = 'build'

10
import glob
11
import limbo
12

13

14
15
16
17
18
def options(opt):
        opt.load('compiler_cxx boost waf_unit_test')
        opt.load('compiler_c')
        opt.load('eigen')
        opt.load('tbb')
19
        opt.load('mkl')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
20
        opt.load('sferes')
21
        opt.load('limbo')
22
23
        opt.load('openmp')
        #opt.load('ode')
24
        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
25
26
        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
27
        opt.load('xcode')
28
29
30
        for i in glob.glob('exp/*'):
                opt.recurse(i)

31

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

42
43
44
        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"
45
        else:
46
47
48
49
50
            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"
51

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

Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
64
        if conf.is_defined('USE_SFERES'):
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
65
                common_flags += " -DUSE_SFERES -DSFERES_FAST_DOMSORT"
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
66

67
        if conf.env['CXXFLAGS_ODE']:
68
                common_flags += ' ' + conf.env['CXXFLAGS_ODE']
69

70
71
        all_flags = common_flags + opt_flags
        conf.env['CXXFLAGS'] = conf.env['CXXFLAGS'] + all_flags.split(' ')
72
73
        print conf.env['CXXFLAGS']

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


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

89

90
def shutdown(ctx):
91
92
    if ctx.options.qsub:
        limbo.qsub(ctx.options.qsub)
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
93
94
    if ctx.options.oar:
        limbo.oar(ctx.options.oar)