wscript 4.22 KB
Newer Older
1
2
3
4
5
6
7
8

from waflib import Logs

def configure(ctx):
    ctx.load(ctx.options.cpp)

    if ctx.options.flags:
        ctx.env.append_unique("CXXFLAGS", ctx.options.flags.split( ))
Ondrej Vysocky's avatar
Ondrej Vysocky committed
9
10
11
12
13
14
15
    ctx.env.append_unique("CXXFLAGS", [ "-std=c++14", "-fPIC"])                 #no openMP
#    if ctx.options.withgcc:
#        ctx.env.append_unique("CXXFLAGS", [ "-fopenmp" ])                       #GCC
#        ctx.env.append_unique("DEFINES", [ "HAVE_OMP_H" ])                      #with openMP
#    else:
#        ctx.env.append_unique("CXXFLAGS", [ "-qopenmp" ])                       #Intel
#        ctx.env.append_unique("DEFINES", [ "HAVE_OMP_H" ])                      #with openMP
16
17
18
19
20
21
22

    if ctx.options.debug:
        ctx.env.append_unique("DEFINES", [ "__MERIC_DEBUG__" ])
    if ctx.options.verbose:
        ctx.env.append_unique("DEFINES", [ "VERBOSE" ])
    if ctx.options.dummy:
        ctx.env.append_unique("DEFINES", [ "USE_DUMMY" ])
Ondrej Vysocky's avatar
Ondrej Vysocky committed
23
        ctx.env.append_unique("CXXFLAGS", [ "-I"+ctx.path.abspath()+"/include/"])
24
    else:
Ondrej Vysocky's avatar
Ondrej Vysocky committed
25
#        ctx.env.append_unique("DEFINES", [ "HAVE_HDEEM_H" ])	# if problem with searching
26
27
28
29
30
31
32
        ctx.check_cc(header_name="hdeem.h", execute=False, mandatory=True)
    ctx.check_cc(header_name="linux/perf_event.h", execute=False, mandatory=False)
    ctx.check_cc(header_name="cpufreq.h", execute=False, mandatory=False)
    ctx.check_cc(header_name="x86_adapt.h", execute=False, mandatory=False)
    ctx.check_cc(header_name="papi.h", execute=False, mandatory=False)
#    ctx.check_cc(header_name="cilk/cilk_api.h", execute=False, mandatory=False)

Ondrej Vysocky's avatar
Ondrej Vysocky committed
33
34
35
36
#    ctx.env.append_unique("DEFINES", [ "HAVE_LINUX_PERF_EVENT_H" ]) #if problem with searching
#    ctx.env.append_unique("DEFINES", [ "HAVE_X86_ADAPT_H" ])	#if problem with searching


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    ctx.find_program(ctx.options.mpi, var="MPICXX", mandatory=False)
    if ctx.env.MPICXX:
        ctx.setenv("mpi", ctx.env.derive())
        ctx.env.CXX = list(ctx.env.MPICXX)
        ctx.env.append_unique("DEFINES", [ "HAVE_MPI_H" ])

    ctx.msg("Compiler flags", " ".join(ctx.env["CXXFLAGS"]))

    if not ctx.env.MPICXX:
        Logs.warn("MPI compiler not found. Only shared memory parallelization is supported")

def build(ctx):

    ctx.objects(
        source =
            ctx.path.ant_glob('src/basis/*.cpp') +
            ctx.path.ant_glob('src/store/*.cpp') +
            ctx.path.ant_glob('src/meric/*.cpp') +
            ctx.path.ant_glob('src/wrapper/*.cpp'),
        target = "basis",
    )

    ctx.stlib(
        source       = ctx.path.ant_glob('src/meric/shared/*.cpp'),
        target       = "meric",
        use          = "basis",
        install_path = "lib"
    )

    ctx.shlib(
        source       = ctx.path.ant_glob('src/meric/shared/*.cpp'),
        target       = "meric",
        use          = "basis",
        install_path = "lib"
    )

    if not ctx.env.MPICXX:
        return

    ctx.stlib(
        source       = ctx.path.ant_glob('src/meric/distributed/*.cpp'),
        target       = "mericmpi",
        use          = "basis",
        install_path = "lib",
        env          = ctx.all_envs["mpi"]
    )

    ctx.shlib(
        source       = ctx.path.ant_glob('src/meric/distributed/*.cpp'),
        target       = "mericmpi",
        use          = "basis",
        install_path = "lib",
        env          = ctx.all_envs["mpi"]
    )


def options(opt):
Ondrej Vysocky's avatar
Ondrej Vysocky committed
94
95
96
97
98
99
100
    opt.add_option(
        "--withgcc",
        action="store_true",
        default=False,
        help="use GCC instead of Intel compiler"
    )

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
    opt.add_option(
        "--verbose",
        action="store_true",
        default=False,
        help="verbose"
    )
    
    opt.add_option(
        "--dummy",
        action="store_true",
        default=False,
        help="use dummy HDEEM wrapper"
    )

    opt.add_option(
        "--debug",
        action="store_true",
        default=False,
        help="active debug output"
    )

    opt.add_option(
        "--cpp",
        action="store",
        default="g++",
        help="C++ compiler"
    )

    opt.add_option(
        "--mpi",
        action="store",
        default="mpic++",
        help="MPI C++ compiler"
    )

    opt.add_option(
        "--flags",
        action="store",
        default="-O2",
        help="Compiler flags (-std=c++14, -fPIC and -qopenmp are default)"
    )