-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSConstruct
83 lines (68 loc) · 2.29 KB
/
SConstruct
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
##
# @author Alexander Breuer (alex.breuer AT uni-jena.de)
#
# @section DESCRIPTION
# Entry-point for builds.
##
import SCons
print( '####################################' )
print( '### Tsunami Lab ###' )
print( '### ###' )
print( '### https://scalable.uni-jena.de ###' )
print( '####################################' )
print()
print('runnning build script')
# configuration
vars = Variables()
vars.AddVariables(
EnumVariable( 'mode',
'compile modes, option \'san\' enables address and undefined behavior sanitizers',
'release',
allowed_values=('release', 'debug', 'release+san', 'debug+san' )
)
)
# exit in the case of unknown variables
if vars.UnknownVariables():
print( "build configuration corrupted, don't know what to do with: " + str(vars.UnknownVariables().keys()) )
exit(1)
# create environment
env = Environment( variables = vars )
# generate help message
Help( vars.GenerateHelpText( env ) )
# add default flags
env.Append( CXXFLAGS = [ '-std=c++11',
'-Wall',
'-Wextra',
'-Wpedantic',
'-Werror' ] )
# set optimization mode
if 'debug' in env['mode']:
env.Append( CXXFLAGS = [ '-g',
'-O0' ] )
else:
env.Append( CXXFLAGS = [ '-O2' ] )
# add sanitizers
if 'san' in env['mode']:
env.Append( CXXFLAGS = [ '-g',
'-fsanitize=float-divide-by-zero',
'-fsanitize=bounds',
'-fsanitize=address',
'-fsanitize=undefined',
'-fno-omit-frame-pointer' ] )
env.Append( LINKFLAGS = [ '-g',
'-fsanitize=address',
'-fsanitize=undefined' ] )
# add Catch2
env.Append( CXXFLAGS = [ '-isystem', 'submodules/Catch2/single_include' ] )
# get source files
VariantDir( variant_dir = 'build/src',
src_dir = 'src' )
env.sources = []
env.tests = []
Export('env')
SConscript( 'build/src/SConscript' )
Import('env')
env.Program( target = 'build/tsunami_lab',
source = env.sources + env.standalone )
env.Program( target = 'build/tests',
source = env.sources + env.tests )