2020-07-17 04:36:28 +08:00
|
|
|
import Cython
|
|
|
|
import distutils
|
2019-12-04 02:45:33 +08:00
|
|
|
import os
|
|
|
|
import subprocess
|
2020-07-17 04:36:28 +08:00
|
|
|
import sys
|
2019-12-04 02:45:33 +08:00
|
|
|
|
|
|
|
zmq = 'zmq'
|
|
|
|
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
|
|
|
|
2020-07-17 04:36:28 +08:00
|
|
|
# Rebuild cython extensions if python, distutils, or cython change
|
|
|
|
cython_dependencies = [Value(v) for v in (sys.version, distutils.__version__, Cython.__version__)]
|
|
|
|
Export('cython_dependencies')
|
|
|
|
|
2019-12-04 02:45:33 +08:00
|
|
|
cereal_dir = Dir('.')
|
|
|
|
|
|
|
|
cpppath = [
|
|
|
|
'#',
|
|
|
|
'#cereal',
|
|
|
|
"#cereal/messaging",
|
|
|
|
"#opendbc/can",
|
|
|
|
'/usr/lib/include',
|
|
|
|
]
|
|
|
|
|
|
|
|
AddOption('--test',
|
|
|
|
action='store_true',
|
|
|
|
help='build test files')
|
|
|
|
|
|
|
|
AddOption('--asan',
|
|
|
|
action='store_true',
|
|
|
|
help='turn on ASAN')
|
|
|
|
|
|
|
|
ccflags_asan = ["-fsanitize=address", "-fno-omit-frame-pointer"] if GetOption('asan') else []
|
|
|
|
ldflags_asan = ["-fsanitize=address"] if GetOption('asan') else []
|
|
|
|
|
|
|
|
env = Environment(
|
|
|
|
ENV=os.environ,
|
|
|
|
CC='clang',
|
|
|
|
CXX='clang++',
|
|
|
|
CCFLAGS=[
|
|
|
|
"-g",
|
|
|
|
"-fPIC",
|
|
|
|
"-O2",
|
2020-07-08 15:39:35 +08:00
|
|
|
"-Wunused",
|
2020-06-28 08:43:51 +08:00
|
|
|
"-Werror",
|
2019-12-04 02:45:33 +08:00
|
|
|
] + ccflags_asan,
|
|
|
|
LDFLAGS=ldflags_asan,
|
|
|
|
LINKFLAGS=ldflags_asan,
|
|
|
|
|
|
|
|
CFLAGS="-std=gnu11",
|
|
|
|
CXXFLAGS="-std=c++14",
|
|
|
|
CPPPATH=cpppath,
|
|
|
|
)
|
|
|
|
|
|
|
|
Export('env', 'zmq', 'arch')
|
|
|
|
|
|
|
|
cereal = [File('#cereal/libcereal.a')]
|
|
|
|
messaging = [File('#cereal/libmessaging.a')]
|
|
|
|
Export('cereal', 'messaging')
|
|
|
|
|
|
|
|
SConscript(['cereal/SConscript'])
|
|
|
|
SConscript(['opendbc/can/SConscript'])
|