2020-01-17 10:22:00 -08:00
|
|
|
import os
|
2020-07-07 12:36:02 -07:00
|
|
|
import shutil
|
2020-01-17 10:22:00 -08:00
|
|
|
import subprocess
|
|
|
|
|
import sys
|
2020-12-14 00:46:07 -08:00
|
|
|
import sysconfig
|
2020-02-01 23:36:50 -08:00
|
|
|
import platform
|
2020-11-11 21:14:51 +01:00
|
|
|
import numpy as np
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2020-09-24 19:24:14 +02:00
|
|
|
TICI = os.path.isfile('/TICI')
|
2020-10-12 18:46:37 +02:00
|
|
|
Decider('MD5-timestamp')
|
2020-09-24 19:24:14 +02:00
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
AddOption('--test',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='build test files')
|
|
|
|
|
|
2021-10-29 18:21:57 +08:00
|
|
|
AddOption('--extras',
|
2021-06-28 14:30:44 -07:00
|
|
|
action='store_true',
|
2021-10-29 18:21:57 +08:00
|
|
|
help='build misc extras, like setup and installer files')
|
2021-06-28 14:30:44 -07:00
|
|
|
|
2021-04-14 16:17:30 +02:00
|
|
|
AddOption('--kaitai',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='Regenerate kaitai struct parsers')
|
|
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
AddOption('--asan',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='turn on ASAN')
|
|
|
|
|
|
2021-01-12 00:03:31 -08:00
|
|
|
AddOption('--ubsan',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='turn on UBSan')
|
|
|
|
|
|
2020-12-18 19:26:59 -08:00
|
|
|
AddOption('--clazy',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='build with clazy')
|
|
|
|
|
|
2021-01-05 12:50:23 -08:00
|
|
|
AddOption('--compile_db',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='build clang compilation database')
|
|
|
|
|
|
2021-05-28 23:08:08 -07:00
|
|
|
AddOption('--snpe',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='use SNPE on PC')
|
|
|
|
|
|
2021-01-18 14:32:29 +01:00
|
|
|
AddOption('--external-sconscript',
|
|
|
|
|
action='store',
|
|
|
|
|
metavar='FILE',
|
|
|
|
|
dest='external_sconscript',
|
|
|
|
|
help='add an external SConscript to the build')
|
|
|
|
|
|
2021-07-13 16:40:20 +02:00
|
|
|
AddOption('--no-thneed',
|
|
|
|
|
action='store_true',
|
|
|
|
|
dest='no_thneed',
|
|
|
|
|
help='avoid using thneed')
|
|
|
|
|
|
2020-08-31 15:02:01 +02:00
|
|
|
real_arch = arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
2020-02-01 23:36:50 -08:00
|
|
|
if platform.system() == "Darwin":
|
|
|
|
|
arch = "Darwin"
|
2020-09-24 19:24:14 +02:00
|
|
|
|
|
|
|
|
if arch == "aarch64" and TICI:
|
2020-03-31 16:34:55 -07:00
|
|
|
arch = "larch64"
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2020-10-16 15:16:17 -07:00
|
|
|
USE_WEBCAM = os.getenv("USE_WEBCAM") is not None
|
2021-09-20 05:43:54 +08:00
|
|
|
USE_FRAME_STREAM = os.getenv("USE_FRAME_STREAM") is not None
|
2020-03-26 19:19:47 -07:00
|
|
|
|
2021-01-04 14:17:14 -08:00
|
|
|
lenv = {
|
|
|
|
|
"PATH": os.environ['PATH'],
|
2021-10-07 16:32:44 -07:00
|
|
|
"LD_LIBRARY_PATH": [Dir(f"#third_party/acados/{arch}/lib").abspath],
|
2021-09-13 19:06:54 -07:00
|
|
|
"PYTHONPATH": Dir("#").abspath + ":" + Dir("#pyextra/").abspath,
|
|
|
|
|
|
2021-10-07 16:32:44 -07:00
|
|
|
"ACADOS_SOURCE_DIR": Dir("#third_party/acados/acados").abspath,
|
2021-11-12 17:09:08 +01:00
|
|
|
"ACADOS_PYTHON_INTERFACE_PATH": Dir("#pyextra/acados_template").abspath,
|
2021-10-07 16:32:44 -07:00
|
|
|
"TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer",
|
2021-01-04 14:17:14 -08:00
|
|
|
}
|
|
|
|
|
|
2021-09-13 19:06:54 -07:00
|
|
|
rpath = lenv["LD_LIBRARY_PATH"].copy()
|
|
|
|
|
|
2020-03-31 16:34:55 -07:00
|
|
|
if arch == "aarch64" or arch == "larch64":
|
2021-09-13 19:06:54 -07:00
|
|
|
lenv["LD_LIBRARY_PATH"] += ['/data/data/com.termux/files/usr/lib']
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2020-03-31 16:34:55 -07:00
|
|
|
if arch == "aarch64":
|
|
|
|
|
# android
|
|
|
|
|
lenv["ANDROID_DATA"] = os.environ['ANDROID_DATA']
|
|
|
|
|
lenv["ANDROID_ROOT"] = os.environ['ANDROID_ROOT']
|
|
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
cpppath = [
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party/opencl/include",
|
2020-01-17 10:22:00 -08:00
|
|
|
]
|
2020-03-31 16:34:55 -07:00
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
libpath = [
|
2021-02-04 19:11:29 +01:00
|
|
|
"/usr/local/lib",
|
2020-01-17 10:22:00 -08:00
|
|
|
"/usr/lib",
|
|
|
|
|
"/system/vendor/lib64",
|
|
|
|
|
"/system/comma/usr/lib",
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party/nanovg",
|
|
|
|
|
f"#third_party/acados/{arch}/lib",
|
2020-01-17 10:22:00 -08:00
|
|
|
]
|
|
|
|
|
|
2020-03-31 16:34:55 -07:00
|
|
|
if arch == "larch64":
|
2020-07-10 15:26:16 -07:00
|
|
|
libpath += [
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party/snpe/larch64",
|
|
|
|
|
"#third_party/libyuv/larch64/lib",
|
2020-07-10 15:26:16 -07:00
|
|
|
"/usr/lib/aarch64-linux-gnu"
|
|
|
|
|
]
|
2021-05-09 13:15:17 +08:00
|
|
|
cpppath += [
|
|
|
|
|
"#selfdrive/camerad/include",
|
|
|
|
|
]
|
2020-03-31 16:34:55 -07:00
|
|
|
cflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
|
|
|
|
cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
2021-09-13 19:06:54 -07:00
|
|
|
rpath += ["/usr/local/lib"]
|
2020-03-31 16:34:55 -07:00
|
|
|
else:
|
2021-09-13 19:06:54 -07:00
|
|
|
rpath = []
|
2020-07-10 15:26:16 -07:00
|
|
|
libpath += [
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party/snpe/aarch64",
|
|
|
|
|
"#third_party/libyuv/lib",
|
2020-09-22 14:46:37 -07:00
|
|
|
"/system/vendor/lib64"
|
2020-07-10 15:26:16 -07:00
|
|
|
]
|
2021-06-12 01:59:42 -07:00
|
|
|
cflags = ["-DQCOM", "-D_USING_LIBCXX", "-mcpu=cortex-a57"]
|
|
|
|
|
cxxflags = ["-DQCOM", "-D_USING_LIBCXX", "-mcpu=cortex-a57"]
|
2020-01-17 10:22:00 -08:00
|
|
|
else:
|
2020-06-11 18:21:59 -07:00
|
|
|
cflags = []
|
|
|
|
|
cxxflags = []
|
2021-01-04 14:17:14 -08:00
|
|
|
cpppath = []
|
2020-02-01 23:36:50 -08:00
|
|
|
|
|
|
|
|
if arch == "Darwin":
|
2021-05-02 14:21:49 -07:00
|
|
|
yuv_dir = "mac" if real_arch != "arm64" else "mac_arm64"
|
2020-02-01 23:36:50 -08:00
|
|
|
libpath = [
|
2021-10-07 16:32:44 -07:00
|
|
|
f"#third_party/libyuv/{yuv_dir}/lib",
|
2020-02-01 23:36:50 -08:00
|
|
|
"/usr/local/lib",
|
2021-05-02 14:21:49 -07:00
|
|
|
"/opt/homebrew/lib",
|
2020-12-18 13:29:20 +01:00
|
|
|
"/usr/local/opt/openssl/lib",
|
2021-05-02 14:21:49 -07:00
|
|
|
"/opt/homebrew/opt/openssl/lib",
|
2020-02-01 23:36:50 -08:00
|
|
|
"/System/Library/Frameworks/OpenGL.framework/Libraries",
|
|
|
|
|
]
|
2020-07-10 15:26:16 -07:00
|
|
|
cflags += ["-DGL_SILENCE_DEPRECATION"]
|
|
|
|
|
cxxflags += ["-DGL_SILENCE_DEPRECATION"]
|
2021-05-02 14:21:49 -07:00
|
|
|
cpppath += [
|
|
|
|
|
"/opt/homebrew/include",
|
|
|
|
|
"/usr/local/opt/openssl/include",
|
|
|
|
|
"/opt/homebrew/opt/openssl/include"
|
|
|
|
|
]
|
2020-02-01 23:36:50 -08:00
|
|
|
else:
|
|
|
|
|
libpath = [
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party/acados/x86_64/lib",
|
|
|
|
|
"#third_party/snpe/x86_64-linux-clang",
|
|
|
|
|
"#third_party/libyuv/x64/lib",
|
|
|
|
|
"#third_party/mapbox-gl-native-qt/x86_64",
|
2020-02-01 23:36:50 -08:00
|
|
|
"#cereal",
|
|
|
|
|
"#selfdrive/common",
|
|
|
|
|
"/usr/lib",
|
|
|
|
|
"/usr/local/lib",
|
|
|
|
|
]
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2021-09-13 19:06:54 -07:00
|
|
|
rpath += [
|
2021-10-07 16:32:44 -07:00
|
|
|
Dir("#third_party/snpe/x86_64-linux-clang").abspath,
|
2021-09-13 19:06:54 -07:00
|
|
|
Dir("#cereal").abspath,
|
|
|
|
|
Dir("#selfdrive/common").abspath
|
2020-07-10 15:26:16 -07:00
|
|
|
]
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2020-07-10 15:26:16 -07:00
|
|
|
if GetOption('asan'):
|
2021-01-12 00:03:31 -08:00
|
|
|
ccflags = ["-fsanitize=address", "-fno-omit-frame-pointer"]
|
|
|
|
|
ldflags = ["-fsanitize=address"]
|
|
|
|
|
elif GetOption('ubsan'):
|
|
|
|
|
ccflags = ["-fsanitize=undefined"]
|
|
|
|
|
ldflags = ["-fsanitize=undefined"]
|
2020-07-10 15:26:16 -07:00
|
|
|
else:
|
2021-01-12 00:03:31 -08:00
|
|
|
ccflags = []
|
|
|
|
|
ldflags = []
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2021-04-08 11:17:07 -07:00
|
|
|
# no --as-needed on mac linker
|
|
|
|
|
if arch != "Darwin":
|
2021-09-13 19:06:54 -07:00
|
|
|
ldflags += ["-Wl,--as-needed", "-Wl,--no-undefined"]
|
2021-04-08 11:17:07 -07:00
|
|
|
|
2021-07-29 13:13:47 +02:00
|
|
|
# Enable swaglog include in submodules
|
|
|
|
|
cflags += ["-DSWAGLOG"]
|
|
|
|
|
cxxflags += ["-DSWAGLOG"]
|
|
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
env = Environment(
|
|
|
|
|
ENV=lenv,
|
|
|
|
|
CCFLAGS=[
|
|
|
|
|
"-g",
|
|
|
|
|
"-fPIC",
|
|
|
|
|
"-O2",
|
2020-07-09 09:25:32 -07:00
|
|
|
"-Wunused",
|
2020-05-26 13:27:01 -07:00
|
|
|
"-Werror",
|
2021-11-02 12:08:53 -04:00
|
|
|
"-Wshadow",
|
2020-09-30 14:58:56 +02:00
|
|
|
"-Wno-unknown-warning-option",
|
2020-05-26 13:27:01 -07:00
|
|
|
"-Wno-deprecated-register",
|
2020-10-17 22:33:12 +02:00
|
|
|
"-Wno-register",
|
2020-05-26 13:27:01 -07:00
|
|
|
"-Wno-inconsistent-missing-override",
|
2020-09-30 14:58:56 +02:00
|
|
|
"-Wno-c99-designator",
|
|
|
|
|
"-Wno-reorder-init-list",
|
2021-11-17 13:46:38 -08:00
|
|
|
"-Wno-error=unused-but-set-variable",
|
2021-01-12 00:03:31 -08:00
|
|
|
] + cflags + ccflags,
|
2020-01-17 10:22:00 -08:00
|
|
|
|
|
|
|
|
CPPPATH=cpppath + [
|
|
|
|
|
"#",
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party/acados/include",
|
|
|
|
|
"#third_party/acados/include/blasfeo/include",
|
|
|
|
|
"#third_party/acados/include/hpipm/include",
|
|
|
|
|
"#third_party/catch2/include",
|
|
|
|
|
"#third_party/bzip2",
|
|
|
|
|
"#third_party/libyuv/include",
|
|
|
|
|
"#third_party/openmax/include",
|
|
|
|
|
"#third_party/json11",
|
|
|
|
|
"#third_party/curl/include",
|
|
|
|
|
"#third_party/libgralloc/include",
|
|
|
|
|
"#third_party/android_frameworks_native/include",
|
|
|
|
|
"#third_party/android_hardware_libhardware/include",
|
|
|
|
|
"#third_party/android_system_core/include",
|
|
|
|
|
"#third_party/linux/include",
|
|
|
|
|
"#third_party/snpe/include",
|
|
|
|
|
"#third_party/mapbox-gl-native-qt/include",
|
|
|
|
|
"#third_party/nanovg",
|
|
|
|
|
"#third_party/qrcode",
|
|
|
|
|
"#third_party",
|
2020-01-17 10:22:00 -08:00
|
|
|
"#cereal",
|
|
|
|
|
"#opendbc/can",
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
CC='clang',
|
|
|
|
|
CXX='clang++',
|
2021-01-12 00:03:31 -08:00
|
|
|
LINKFLAGS=ldflags,
|
2020-01-17 10:22:00 -08:00
|
|
|
|
|
|
|
|
RPATH=rpath,
|
|
|
|
|
|
|
|
|
|
CFLAGS=["-std=gnu11"] + cflags,
|
2020-10-17 22:33:12 +02:00
|
|
|
CXXFLAGS=["-std=c++1z"] + cxxflags,
|
2020-07-10 15:26:16 -07:00
|
|
|
LIBPATH=libpath + [
|
2020-01-17 10:22:00 -08:00
|
|
|
"#cereal",
|
2021-10-07 16:32:44 -07:00
|
|
|
"#third_party",
|
2020-11-26 16:14:02 -08:00
|
|
|
"#opendbc/can",
|
2020-11-11 21:14:51 +01:00
|
|
|
"#selfdrive/boardd",
|
2020-01-17 10:22:00 -08:00
|
|
|
"#selfdrive/common",
|
2020-11-11 21:14:51 +01:00
|
|
|
],
|
|
|
|
|
CYTHONCFILESUFFIX=".cpp",
|
2020-12-14 00:46:07 -08:00
|
|
|
COMPILATIONDB_USE_ABSPATH=True,
|
|
|
|
|
tools=["default", "cython", "compilation_db"],
|
2020-01-17 10:22:00 -08:00
|
|
|
)
|
2020-11-16 21:33:33 -08:00
|
|
|
|
2021-01-05 12:50:23 -08:00
|
|
|
if GetOption('compile_db'):
|
2020-12-14 00:46:07 -08:00
|
|
|
env.CompilationDatabase('compile_commands.json')
|
|
|
|
|
|
2021-06-01 17:12:32 -07:00
|
|
|
# Setup cache dir
|
|
|
|
|
cache_dir = '/data/scons_cache' if TICI else '/tmp/scons_cache'
|
|
|
|
|
CacheDir(cache_dir)
|
|
|
|
|
Clean(["."], cache_dir)
|
2020-01-17 10:22:00 -08:00
|
|
|
|
|
|
|
|
node_interval = 5
|
|
|
|
|
node_count = 0
|
|
|
|
|
def progress_function(node):
|
|
|
|
|
global node_count
|
|
|
|
|
node_count += node_interval
|
|
|
|
|
sys.stderr.write("progress: %d\n" % node_count)
|
|
|
|
|
|
|
|
|
|
if os.environ.get('SCONS_PROGRESS'):
|
|
|
|
|
Progress(progress_function, interval=node_interval)
|
|
|
|
|
|
|
|
|
|
SHARED = False
|
|
|
|
|
|
|
|
|
|
def abspath(x):
|
|
|
|
|
if arch == 'aarch64':
|
|
|
|
|
pth = os.path.join("/data/pythonpath", x[0].path)
|
|
|
|
|
env.Depends(pth, x)
|
|
|
|
|
return File(pth)
|
|
|
|
|
else:
|
|
|
|
|
# rpath works elsewhere
|
|
|
|
|
return x[0].path.rsplit("/", 1)[1][:-3]
|
|
|
|
|
|
2020-12-14 00:46:07 -08:00
|
|
|
# Cython build enviroment
|
|
|
|
|
py_include = sysconfig.get_paths()['include']
|
2020-11-11 21:14:51 +01:00
|
|
|
envCython = env.Clone()
|
2020-12-14 00:46:07 -08:00
|
|
|
envCython["CPPPATH"] += [py_include, np.get_include()]
|
2021-11-02 12:08:53 -04:00
|
|
|
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
|
2020-11-11 21:14:51 +01:00
|
|
|
|
2020-12-14 00:46:07 -08:00
|
|
|
envCython["LIBS"] = []
|
2020-11-11 21:14:51 +01:00
|
|
|
if arch == "Darwin":
|
2020-12-14 00:46:07 -08:00
|
|
|
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
|
2020-11-11 21:14:51 +01:00
|
|
|
elif arch == "aarch64":
|
2020-12-14 00:46:07 -08:00
|
|
|
envCython["LINKFLAGS"] = ["-shared"]
|
2020-12-14 01:23:57 -08:00
|
|
|
envCython["LIBS"] = [os.path.basename(py_include)]
|
2020-11-11 21:14:51 +01:00
|
|
|
else:
|
2020-12-14 00:46:07 -08:00
|
|
|
envCython["LINKFLAGS"] = ["-pthread", "-shared"]
|
2020-11-11 21:14:51 +01:00
|
|
|
|
|
|
|
|
Export('envCython')
|
|
|
|
|
|
2020-12-20 19:39:59 -08:00
|
|
|
# Qt build environment
|
2021-02-25 22:19:53 -08:00
|
|
|
qt_env = env.Clone()
|
2021-05-17 14:57:07 +02:00
|
|
|
qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick", "Qml", "QuickWidgets", "Location", "Positioning"]
|
2021-02-25 22:19:53 -08:00
|
|
|
if arch != "aarch64":
|
2021-03-22 14:27:37 -07:00
|
|
|
qt_modules += ["DBus"]
|
2020-12-20 19:39:59 -08:00
|
|
|
|
2021-02-25 22:19:53 -08:00
|
|
|
qt_libs = []
|
|
|
|
|
if arch == "Darwin":
|
2021-05-02 14:21:49 -07:00
|
|
|
if real_arch == "arm64":
|
|
|
|
|
qt_env['QTDIR'] = "/opt/homebrew/opt/qt@5"
|
|
|
|
|
else:
|
|
|
|
|
qt_env['QTDIR'] = "/usr/local/opt/qt@5"
|
2021-02-25 22:19:53 -08:00
|
|
|
qt_dirs = [
|
2021-03-09 17:33:45 -08:00
|
|
|
os.path.join(qt_env['QTDIR'], "include"),
|
2021-02-25 22:19:53 -08:00
|
|
|
]
|
2021-03-09 17:33:45 -08:00
|
|
|
qt_dirs += [f"{qt_env['QTDIR']}/include/Qt{m}" for m in qt_modules]
|
|
|
|
|
qt_env["LINKFLAGS"] += ["-F" + os.path.join(qt_env['QTDIR'], "lib")]
|
2021-02-25 22:19:53 -08:00
|
|
|
qt_env["FRAMEWORKS"] += [f"Qt{m}" for m in qt_modules] + ["OpenGL"]
|
|
|
|
|
elif arch == "aarch64":
|
|
|
|
|
qt_env['QTDIR'] = "/system/comma/usr"
|
|
|
|
|
qt_dirs = [
|
|
|
|
|
f"/system/comma/usr/include/qt",
|
|
|
|
|
]
|
|
|
|
|
qt_dirs += [f"/system/comma/usr/include/qt/Qt{m}" for m in qt_modules]
|
2021-02-25 01:03:37 -08:00
|
|
|
|
2021-02-25 22:19:53 -08:00
|
|
|
qt_libs = [f"Qt5{m}" for m in qt_modules]
|
|
|
|
|
qt_libs += ['EGL', 'GLESv3', 'c++_shared']
|
|
|
|
|
else:
|
|
|
|
|
qt_env['QTDIR'] = "/usr"
|
|
|
|
|
qt_dirs = [
|
|
|
|
|
f"/usr/include/{real_arch}-linux-gnu/qt5",
|
|
|
|
|
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.12.8/QtGui",
|
2020-12-20 19:39:59 -08:00
|
|
|
]
|
2021-02-25 22:19:53 -08:00
|
|
|
qt_dirs += [f"/usr/include/{real_arch}-linux-gnu/qt5/Qt{m}" for m in qt_modules]
|
|
|
|
|
|
|
|
|
|
qt_libs = [f"Qt5{m}" for m in qt_modules]
|
|
|
|
|
if arch == "larch64":
|
|
|
|
|
qt_libs += ["GLESv2", "wayland-client"]
|
|
|
|
|
elif arch != "Darwin":
|
|
|
|
|
qt_libs += ["GL"]
|
|
|
|
|
|
|
|
|
|
qt_env.Tool('qt')
|
|
|
|
|
qt_env['CPPPATH'] += qt_dirs + ["#selfdrive/ui/qt/"]
|
|
|
|
|
qt_flags = [
|
|
|
|
|
"-D_REENTRANT",
|
|
|
|
|
"-DQT_NO_DEBUG",
|
|
|
|
|
"-DQT_WIDGETS_LIB",
|
|
|
|
|
"-DQT_GUI_LIB",
|
2021-03-24 19:30:52 -07:00
|
|
|
"-DQT_QUICK_LIB",
|
|
|
|
|
"-DQT_QUICKWIDGETS_LIB",
|
|
|
|
|
"-DQT_QML_LIB",
|
2021-07-02 14:01:59 +02:00
|
|
|
"-DQT_CORE_LIB",
|
|
|
|
|
"-DQT_MESSAGELOGCONTEXT",
|
2021-02-25 22:19:53 -08:00
|
|
|
]
|
|
|
|
|
qt_env['CXXFLAGS'] += qt_flags
|
|
|
|
|
qt_env['LIBPATH'] += ['#selfdrive/ui']
|
|
|
|
|
qt_env['LIBS'] = qt_libs
|
|
|
|
|
|
|
|
|
|
if GetOption("clazy"):
|
|
|
|
|
checks = [
|
|
|
|
|
"level0",
|
|
|
|
|
"level1",
|
|
|
|
|
"no-range-loop",
|
|
|
|
|
"no-non-pod-global-static",
|
|
|
|
|
]
|
|
|
|
|
qt_env['CXX'] = 'clazy'
|
|
|
|
|
qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0]
|
|
|
|
|
qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks)
|
2020-12-20 19:39:59 -08:00
|
|
|
|
2021-09-20 05:43:54 +08:00
|
|
|
Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED', 'USE_WEBCAM', 'USE_FRAME_STREAM')
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2021-07-29 13:13:47 +02:00
|
|
|
SConscript(['selfdrive/common/SConscript'])
|
|
|
|
|
Import('_common', '_gpucommon', '_gpu_libs')
|
|
|
|
|
|
|
|
|
|
if SHARED:
|
|
|
|
|
common, gpucommon = abspath(common), abspath(gpucommon)
|
|
|
|
|
else:
|
|
|
|
|
common = [_common, 'json11']
|
|
|
|
|
gpucommon = [_gpucommon] + _gpu_libs
|
|
|
|
|
|
|
|
|
|
Export('common', 'gpucommon')
|
|
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
# cereal and messaging are shared with the system
|
|
|
|
|
SConscript(['cereal/SConscript'])
|
|
|
|
|
if SHARED:
|
|
|
|
|
cereal = abspath([File('cereal/libcereal_shared.so')])
|
|
|
|
|
messaging = abspath([File('cereal/libmessaging_shared.so')])
|
|
|
|
|
else:
|
|
|
|
|
cereal = [File('#cereal/libcereal.a')]
|
|
|
|
|
messaging = [File('#cereal/libmessaging.a')]
|
2021-01-08 14:54:25 +01:00
|
|
|
visionipc = [File('#cereal/libvisionipc.a')]
|
|
|
|
|
|
2021-07-29 13:13:47 +02:00
|
|
|
Export('cereal', 'messaging', 'visionipc')
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2021-04-08 13:09:11 +02:00
|
|
|
# Build rednose library and ekf models
|
|
|
|
|
|
|
|
|
|
rednose_config = {
|
|
|
|
|
'generated_folder': '#selfdrive/locationd/models/generated',
|
|
|
|
|
'to_build': {
|
2021-04-20 11:56:43 +02:00
|
|
|
'live': ('#selfdrive/locationd/models/live_kf.py', True, ['live_kf_constants.h']),
|
|
|
|
|
'car': ('#selfdrive/locationd/models/car_kf.py', True, []),
|
2021-04-08 13:09:11 +02:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 16:25:51 +01:00
|
|
|
if arch not in ["aarch64", "larch64"]:
|
2021-04-08 13:09:11 +02:00
|
|
|
rednose_config['to_build'].update({
|
2021-04-20 11:56:43 +02:00
|
|
|
'gnss': ('#selfdrive/locationd/models/gnss_kf.py', True, []),
|
|
|
|
|
'loc_4': ('#selfdrive/locationd/models/loc_kf.py', True, []),
|
|
|
|
|
'pos_computer_4': ('#rednose/helpers/lst_sq_computer.py', False, []),
|
|
|
|
|
'pos_computer_5': ('#rednose/helpers/lst_sq_computer.py', False, []),
|
|
|
|
|
'feature_handler_5': ('#rednose/helpers/feature_handler.py', False, []),
|
|
|
|
|
'lane': ('#xx/pipeline/lib/ekf/lane_kf.py', True, []),
|
2021-04-08 13:09:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Export('rednose_config')
|
|
|
|
|
SConscript(['rednose/SConscript'])
|
2020-12-20 19:39:59 -08:00
|
|
|
|
|
|
|
|
# Build openpilot
|
|
|
|
|
|
|
|
|
|
SConscript(['cereal/SConscript'])
|
2021-03-24 14:44:39 +01:00
|
|
|
SConscript(['panda/board/SConscript'])
|
2020-01-17 10:22:00 -08:00
|
|
|
SConscript(['opendbc/can/SConscript'])
|
|
|
|
|
|
2021-10-07 16:32:44 -07:00
|
|
|
SConscript(['third_party/SConscript'])
|
2020-12-20 19:39:59 -08:00
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
SConscript(['common/SConscript'])
|
|
|
|
|
SConscript(['common/kalman/SConscript'])
|
2020-06-09 16:44:26 -07:00
|
|
|
SConscript(['common/transformations/SConscript'])
|
2020-01-17 10:22:00 -08:00
|
|
|
|
2020-06-11 18:21:59 -07:00
|
|
|
SConscript(['selfdrive/camerad/SConscript'])
|
|
|
|
|
SConscript(['selfdrive/modeld/SConscript'])
|
2020-02-01 23:36:50 -08:00
|
|
|
|
2020-01-17 10:22:00 -08:00
|
|
|
SConscript(['selfdrive/controls/lib/cluster/SConscript'])
|
2021-09-13 19:06:54 -07:00
|
|
|
SConscript(['selfdrive/controls/lib/lateral_mpc_lib/SConscript'])
|
2021-07-07 19:42:26 -07:00
|
|
|
SConscript(['selfdrive/controls/lib/longitudinal_mpc_lib/SConscript'])
|
2020-01-17 10:22:00 -08:00
|
|
|
|
|
|
|
|
SConscript(['selfdrive/boardd/SConscript'])
|
|
|
|
|
SConscript(['selfdrive/proclogd/SConscript'])
|
2020-08-25 10:53:04 +02:00
|
|
|
SConscript(['selfdrive/clocksd/SConscript'])
|
2020-01-17 10:22:00 -08:00
|
|
|
|
|
|
|
|
SConscript(['selfdrive/loggerd/SConscript'])
|
|
|
|
|
|
2020-05-14 10:53:19 -07:00
|
|
|
SConscript(['selfdrive/locationd/SConscript'])
|
2020-08-26 11:30:30 +02:00
|
|
|
SConscript(['selfdrive/sensord/SConscript'])
|
2020-08-31 15:02:01 +02:00
|
|
|
SConscript(['selfdrive/ui/SConscript'])
|
2020-05-14 10:53:19 -07:00
|
|
|
|
2020-08-26 17:09:23 +02:00
|
|
|
if arch != "Darwin":
|
2020-01-17 10:22:00 -08:00
|
|
|
SConscript(['selfdrive/logcatd/SConscript'])
|
2020-08-20 17:23:58 +02:00
|
|
|
|
2021-10-26 14:46:31 +02:00
|
|
|
if GetOption('test'):
|
|
|
|
|
SConscript('panda/tests/safety/SConscript')
|
|
|
|
|
|
2021-01-18 14:32:29 +01:00
|
|
|
external_sconscript = GetOption('external_sconscript')
|
|
|
|
|
if external_sconscript:
|
|
|
|
|
SConscript([external_sconscript])
|