Update doc revision and pdf cover.
[apps/low-level-can-service.git] / libs / nanopb / tests / common / SConscript
1 # Build the common files needed by multiple test cases
2
3 Import('env')
4
5 # Protocol definitions for the encode/decode_unittests
6 env.NanopbProto("unittestproto")
7
8 # Protocol definitions for basic_buffer/stream tests
9 env.NanopbProto("person")
10
11 #--------------------------------------------
12 # Binaries of the pb_decode.c and pb_encode.c
13 # These are built using more strict warning flags.
14 strict = env.Clone()
15 strict.Append(CFLAGS = strict['CORECFLAGS'])
16 strict.Object("pb_decode.o", "$NANOPB/pb_decode.c")
17 strict.Object("pb_encode.o", "$NANOPB/pb_encode.c")
18 strict.Object("pb_common.o", "$NANOPB/pb_common.c")
19
20 #-----------------------------------------------
21 # Binaries of pb_decode etc. with malloc support
22 # Uses malloc_wrappers.c to count allocations.
23 malloc_env = env.Clone()
24 malloc_env.Append(CPPDEFINES = {'PB_ENABLE_MALLOC': 1,
25                                 'PB_SYSTEM_HEADER': '\\"malloc_wrappers_syshdr.h\\"'})
26 malloc_env.Append(CPPPATH = ["$COMMON"])
27
28 if 'SYSHDR' in malloc_env:
29     malloc_env.Append(CPPDEFINES = {'PB_OLD_SYSHDR': malloc_env['SYSHDR']})
30
31 # Disable libmudflap, because it will confuse valgrind
32 # and other memory leak detection tools.
33 if '-fmudflap' in env["CCFLAGS"]:
34     malloc_env["CCFLAGS"].remove("-fmudflap")
35     malloc_env["LINKFLAGS"].remove("-fmudflap")
36     malloc_env["LIBS"].remove("mudflap")
37
38 malloc_strict = malloc_env.Clone()
39 malloc_strict.Append(CFLAGS = malloc_strict['CORECFLAGS'])
40 malloc_strict.Object("pb_decode_with_malloc.o", "$NANOPB/pb_decode.c")
41 malloc_strict.Object("pb_encode_with_malloc.o", "$NANOPB/pb_encode.c")
42 malloc_strict.Object("pb_common_with_malloc.o", "$NANOPB/pb_common.c")
43
44 malloc_env.Object("malloc_wrappers.o", "malloc_wrappers.c")
45 malloc_env.Depends("$NANOPB/pb.h", ["malloc_wrappers_syshdr.h", "malloc_wrappers.h"])
46
47 Export("malloc_env")
48