Add option to avoid thneed (#21577)

* add option to avoid thneed

* cleaner

Co-authored-by: Willem Melching <willem.melching@gmail.com>

* fix USE_THNEED in modeld

* cleanup

Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 2f22207ecef15bdd43e7b93860c5abcff7a245d5
This commit is contained in:
robbederks
2021-07-13 16:40:20 +02:00
committed by GitHub
parent d136144d45
commit 319a000fe5
3 changed files with 14 additions and 7 deletions
+8 -6
View File
@@ -26,14 +26,17 @@ thneed_src = [
"runners/thneedmodel.cc",
]
use_thneed = not GetOption('no_thneed')
if arch == "aarch64" or arch == "larch64":
libs += ['gsl', 'CB']
libs += ['gnustl_shared'] if arch == "aarch64" else ['pthread', 'dl']
common_src += thneed_src
dlsym_offset = get_dlsym_offset()
lenv['CXXFLAGS'].append("-DUSE_THNEED")
lenv['CXXFLAGS'].append(f"-DDLSYM_OFFSET={dlsym_offset}")
if use_thneed:
common_src += thneed_src
dlsym_offset = get_dlsym_offset()
lenv['CXXFLAGS'].append("-DUSE_THNEED")
lenv['CXXFLAGS'].append(f"-DDLSYM_OFFSET={dlsym_offset}")
else:
libs += ['pthread']
@@ -58,7 +61,7 @@ else:
common_model = lenv.Object(common_src)
# build thneed model
if arch == "aarch64" or arch == "larch64":
if use_thneed and arch in ("aarch64", "larch64"):
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs)
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} ../../models/supercombo.dlc ../../models/supercombo.thneed --binary"
@@ -75,4 +78,3 @@ lenv.Program('_modeld', [
"modeld.cc",
"models/driving.cc",
]+common_model, LIBS=libs)