2019-12-03 10:45:33 -08:00
|
|
|
import os
|
|
|
|
import subprocess
|
2020-11-26 16:11:23 -08:00
|
|
|
import sysconfig
|
2021-08-30 17:53:14 -07:00
|
|
|
import numpy as np
|
2019-12-03 10:45:33 -08:00
|
|
|
|
|
|
|
zmq = 'zmq'
|
|
|
|
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
|
|
|
|
|
|
|
cereal_dir = Dir('.')
|
|
|
|
|
2020-11-26 16:11:23 -08:00
|
|
|
python_path = sysconfig.get_paths()['include']
|
2019-12-03 10:45:33 -08:00
|
|
|
cpppath = [
|
2020-11-26 16:11:23 -08:00
|
|
|
'#',
|
|
|
|
'#cereal',
|
|
|
|
"#cereal/messaging",
|
|
|
|
"#opendbc/can",
|
|
|
|
'/usr/lib/include',
|
|
|
|
python_path
|
2019-12-03 10:45:33 -08:00
|
|
|
]
|
|
|
|
|
|
|
|
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 00:39:35 -07:00
|
|
|
"-Wunused",
|
2020-06-27 17:43:51 -07:00
|
|
|
"-Werror",
|
2021-11-02 06:40:00 -07:00
|
|
|
"-Wshadow",
|
2019-12-03 10:45:33 -08:00
|
|
|
] + ccflags_asan,
|
|
|
|
LDFLAGS=ldflags_asan,
|
|
|
|
LINKFLAGS=ldflags_asan,
|
2020-11-26 16:11:23 -08:00
|
|
|
LIBPATH=[
|
|
|
|
"#opendbc/can/",
|
|
|
|
],
|
2019-12-03 10:45:33 -08:00
|
|
|
CFLAGS="-std=gnu11",
|
2020-10-17 12:41:35 -07:00
|
|
|
CXXFLAGS="-std=c++1z",
|
2019-12-03 10:45:33 -08:00
|
|
|
CPPPATH=cpppath,
|
2020-11-26 16:11:23 -08:00
|
|
|
CYTHONCFILESUFFIX=".cpp",
|
|
|
|
tools=["default", "cython"]
|
2019-12-03 10:45:33 -08:00
|
|
|
)
|
|
|
|
|
2021-01-30 17:20:13 -08:00
|
|
|
QCOM_REPLAY = False
|
2021-08-30 17:53:14 -07:00
|
|
|
common = ''
|
|
|
|
Export('env', 'zmq', 'arch', 'QCOM_REPLAY', 'common')
|
2019-12-03 10:45:33 -08:00
|
|
|
|
|
|
|
cereal = [File('#cereal/libcereal.a')]
|
|
|
|
messaging = [File('#cereal/libmessaging.a')]
|
|
|
|
Export('cereal', 'messaging')
|
|
|
|
|
2020-11-26 16:11:23 -08:00
|
|
|
|
|
|
|
envCython = env.Clone()
|
2021-08-30 17:53:14 -07:00
|
|
|
envCython["CPPPATH"] += [np.get_include()]
|
2021-11-02 06:40:00 -07:00
|
|
|
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
|
2020-11-26 16:11:23 -08:00
|
|
|
|
|
|
|
python_libs = []
|
|
|
|
if arch == "Darwin":
|
|
|
|
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
|
|
|
|
elif arch == "aarch64":
|
|
|
|
envCython["LINKFLAGS"] = ["-shared"]
|
|
|
|
|
|
|
|
python_libs.append(os.path.basename(python_path))
|
|
|
|
else:
|
|
|
|
envCython["LINKFLAGS"] = ["-pthread", "-shared"]
|
|
|
|
|
|
|
|
envCython["LIBS"] = python_libs
|
|
|
|
|
|
|
|
Export('envCython')
|
|
|
|
|
|
|
|
|
2019-12-03 10:45:33 -08:00
|
|
|
SConscript(['cereal/SConscript'])
|
|
|
|
SConscript(['opendbc/can/SConscript'])
|