wscript 2.89 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

15

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

33

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

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

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

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

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

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

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


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

91

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