forked from ludocode/mpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConscript
35 lines (28 loc) · 1.24 KB
/
SConscript
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
import platform
Import('env', 'CPPFLAGS', 'LINKFLAGS')
# we add the C/C++ specific flags here. we can't use CCFLAGS/CXXFLAGS
# because as far as SCons is concerned, they are all C files; we're
# passing -x c++ to force the language.
if "c++" in CPPFLAGS:
CPPFLAGS += ["-Wmissing-declarations"]
LINKFLAGS += ["-lstdc++"]
else:
CPPFLAGS += ["-Wmissing-prototypes", "-Wc++-compat"]
srcs = env.Object(env.Glob('src/mpack/*.c') + env.Glob('test/*.c'),
CPPFLAGS=env['CPPFLAGS'] + CPPFLAGS)
prog = env.Program("mpack-test", srcs,
LINKFLAGS=env['LINKFLAGS'] + LINKFLAGS)
# only some architectures are supported by valgrind. we don't check for it
# though because we want to force mpack developers to install and use it if
# it's available.
if platform.machine() in ["i386", "x86_64"]:
valgrind = "valgrind --leak-check=full --error-exitcode=1 "
# travis version of valgrind is too old, doesn't support leak kinds
if "TRAVIS" not in env["ENV"]:
valgrind = valgrind + "--show-leak-kinds=all --errors-for-leak-kinds=all "
valgrind = valgrind + "--suppressions=tools/valgrind-suppressions "
else:
valgrind = ""
env.Default(env.AlwaysBuild(env.Alias("test",
[prog],
valgrind + Dir('.').path + "/mpack-test")))