forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConscript
42 lines (37 loc) · 1.03 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
36
37
38
39
40
41
42
import platform
CC = 'gcc'
system = platform.system()
if system == 'Darwin':
# gcc installed by homebrew has version suffix (e.g. gcc-12) in order to be
# distinguishable from system one - which acts as a symlink to clang
CC += '-13'
env = Environment(
CC=CC,
CFLAGS=[
'-nostdlib',
'-fno-builtin',
'-std=gnu11',
'-Wfatal-errors',
'-Wno-pointer-to-int-cast',
],
CPPPATH=[".", "../../board/"],
)
if system == "Darwin":
env.PrependENVPath('PATH', '/opt/homebrew/bin')
if GetOption('ubsan'):
flags = [
"-fsanitize=undefined",
"-fno-sanitize-recover=undefined",
]
env['CFLAGS'] += flags
env['LINKFLAGS'] += flags
panda = env.SharedObject("panda.os", "panda.c")
libpanda = env.SharedLibrary("libpanda.so", [panda])
if GetOption('coverage'):
env.Append(
CFLAGS=["-fprofile-arcs", "-ftest-coverage", "-fprofile-abs-path",],
LIBS=["gcov"],
)
# GCC note file is generated by compiler, ensure we build it, and allow scons to clean it up
AlwaysBuild(panda)
env.SideEffect("panda.gcno", panda)