-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
100 lines (74 loc) · 2.84 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
94
95
96
97
98
99
100
#!/usr/bin/env python
# coding: utf-8
top = '.'
out = 'build'
from waflib import Utils
import imp
def waftool(name):
return imp.load_module('waf_' + name, *imp.find_module(name, ['./latcommon/waftools']))
version = waftool('version')
compiler = waftool('compiler')
deps = waftool('deps')
def options(ctx):
ctx.recurse('latcommon')
ctx.add_option('--build-docs', action='store_true', default=False, help='build documentation')
ctx.add_option('--testu01', action='store', help='prefix under which TestU01 is installed')
ctx.add_option('--gmp', action='store', help='prefix under which GMP is installed')
def configure(ctx):
ctx.recurse('latcommon')
if not ctx.env.LATCOMMON_SUFFIX:
ctx.fatal('Please specify the NTL number types with --ntltypes (try ./waf --help)')
if ctx.options.testu01:
deps.add_deps_path(ctx, 'TESTU01', ctx.options.testu01)
if ctx.options.gmp:
deps.add_deps_path(ctx, 'GMP', ctx.options.gmp)
ctx.version_file()
ctx_check = deps.shared_or_static(ctx, ctx.check)
# GMP
ctx_check(features='cxx cxxprogram', header_name='gmp.h')
ctx_check(features='cxx cxxprogram', lib='gmp', uselib_store='GMP')
# TestU01
ctx_check(features='cxx cxxprogram', header_name='ulcg.h')
ctx_check(features='cxx cxxprogram', lib='testu01', uselib_store='TESTU01', use='GMP')
# mylib (part of TestU01)
ctx_check(features='cxx cxxprogram', header_name='num.h')
ctx_check(features='cxx cxxprogram', lib='mylib', uselib_store='MYLIB')
# Doxygen
if ctx.options.build_docs:
ctx.env.BUILD_DOCS = True
if not ctx.find_program('doxygen', var='DOXYGEN', mandatory=False):
ctx.fatal('Doxygen is required for building documentation.\n' +
'Get it from http://www.stack.nl/~dimitri/doxygen/')
# version
ctx.define('LATMRG_VERSION', ctx.set_version())
ctx.msg("Setting LatMRG version", version.VERSION)
# build variants
env = ctx.env.derive()
env.detach()
# release (default)
ctx.env.append_unique('CXXFLAGS', ['-O2'])
ctx.define('NDEBUG', 1)
ctx.setenv('debug', env)
ctx.env.append_unique('CXXFLAGS', ['-g'])
ctx.define('DEBUG', 1)
def distclean(ctx):
ctx.recurse('latcommon')
verfile = ctx.path.find_node('VERSION')
if verfile:
verfile.delete()
from waflib import Scripting
Scripting.distclean(ctx)
def build(ctx):
if ctx.variant:
print("Building variant `%s'" % (ctx.variant,))
ctx.recurse('latcommon')
ctx.recurse('src')
ctx.recurse('progs')
ctx.recurse('test')
if ctx.env.BUILD_DOCS:
ctx.recurse('doc')
# build variants
from waflib.Build import BuildContext
class debug(BuildContext):
cmd = 'debug'
variant = 'debug'