-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSConstruct
executable file
·128 lines (107 loc) · 3.18 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
from SCons.Script import *
from os import access, environ, X_OK
import platform
#CacheDir('.scons-cache')
Decider('MD5-timestamp')
SetOption('implicit_cache', True)
SourceCode('.', None)
########################################################################
#
# various command-line options
#
def pathIsExecutable(key, val, env):
found = env.WhereIs(val)
if found: val = found
PathVariable.PathIsFile(key, val, env)
if not access(val, X_OK):
raise SCons.Errors.UserError('Path for option %s is not executable: %s' % (key, val))
opts = Variables(['.scons-options'], ARGUMENTS)
opts.Add(BoolVariable('DEBUG', 'Compile with extra information for debugging', False))
opts.Add(BoolVariable('OPTIMIZE', 'Compile with optimization', False))
opts.Add(BoolVariable('NATIVECAML', 'Use the native-code OCaml compiler', True))
opts.Add(BoolVariable('PROFILE', 'Turn on performance profiling', False))
opts.Add(BoolVariable('VALGRIND', "Run tests under Valgrinds's memory checker", False))
opts.Add(PathVariable('LLVM_CONFIG', 'Path to llvm-config executable', WhereIs('llvm-config'), pathIsExecutable))
if platform.system() == 'Darwin':
Is64 = False
else:
Is64 = platform.architecture()[0] == '64bit'
env = Environment(
ENV = {'PATH' : os.environ['PATH']},
CCFLAGS = ['-Isrc/lib', '-I'+os.environ['UNWIND_INCLUDE_PATH'], '-I'+os.environ['GLOG_INCLUDE_PATH']],
options=opts,
Is64=Is64,
)
env["CC"] = os.getenv("CC") or env["CC"]
env["CXX"] = os.getenv("CXX") or env["CXX"]
def builder_unit_test(target, source, env):
app = str(source[0].abspath)
if os.spawnl(os.P_WAIT, app, app)==0:
open(str(target[0]),'w').write("PASSED\n")
else:
return 1
# Create a builder for tests
bld = Builder(action = builder_unit_test)
env.Append(BUILDERS = {'Test' : bld})
########################################################################
#
# basic LaTeX document rendering
#
env.AppendUnique(
COMMONLATEXFLAGS=['-file-line-error', '-interaction=batchmode'],
LATEXFLAGS='$COMMONLATEXFLAGS',
PDFLATEXFLAGS='$COMMONLATEXFLAGS',
BIBTEXFLAGS='-terse',
)
########################################################################
#
# shared compiliation flags
#
flags = [
'-Wall',
'-Wextra',
'-Wno-conversion',
'-Wno-sign-conversion',
'-Wno-sign-compare',
'-Wundef',
'-pedantic',
'-Wformat=2',
'-std=c++11',
'-Werror',
'${("", "-g")[DEBUG]}',
'${("", "-O")[OPTIMIZE]}',
]
if env['CXX'] == 'clang++':
flags.extend([
#'-Weverything', #TODO: add back in
'-Wno-mismatched-tags',
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-weak-vtables',
'-Wno-global-constructors',
'-Wno-exit-time-destructors',
'-Wno-float-equal', # necessary for sync
'-Wno-padded', #may turn off once in a while
])
env.AppendUnique(
CCFLAGS=flags,
LINKFLAGS=flags,
)
########################################################################
#
# subsidiary scons scripts
#
SConscript(
dirs=[
# our stuff
# 'MonitorPass',
'FPPass',
'FastBlameAnalysis',
'FastBlameAnalysis2',
# 'src',
# 'BlameAnalysis/backward',
# 'BlameAnalysis/forward',
'tests',
],
exports='env',
)