From d138a358ebd0e67302a409a346777fc15aeb5b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Wed, 30 Aug 2023 15:01:03 -0700 Subject: [PATCH] scons: fix multithreaded builds (#29716) * common_python export * Single scons call * transformations_python --- SConstruct | 3 --- common/SConscript | 14 ++++++++++++-- common/kalman/SConscript | 4 +++- common/transformations/SConscript | 5 ++--- .../controls/lib/longitudinal_mpc_lib/SConscript | 4 ++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/SConstruct b/SConstruct index 478bc885a..f213a5e0b 100644 --- a/SConstruct +++ b/SConstruct @@ -417,9 +417,6 @@ SConscript([ SConscript(['third_party/SConscript']) -SConscript(['common/kalman/SConscript']) -SConscript(['common/transformations/SConscript']) - SConscript(['selfdrive/boardd/SConscript']) SConscript(['selfdrive/controls/lib/lateral_mpc_lib/SConscript']) SConscript(['selfdrive/controls/lib/longitudinal_mpc_lib/SConscript']) diff --git a/common/SConscript b/common/SConscript index c70343499..d22aca128 100644 --- a/common/SConscript +++ b/common/SConscript @@ -32,5 +32,15 @@ if GetOption('extras'): ['tests/test_runner.cc', 'tests/test_util.cc', 'tests/test_swaglog.cc', 'tests/test_ratekeeper.cc'], LIBS=[_common, 'json11', 'zmq', 'pthread']) -# Cython -envCython.Program('params_pyx.so', 'params_pyx.pyx', LIBS=envCython['LIBS'] + [_common, 'zmq', 'json11']) +# Cython bindings +params_python = envCython.Program('params_pyx.so', 'params_pyx.pyx', LIBS=envCython['LIBS'] + [_common, 'zmq', 'json11']) + +SConscript([ + 'kalman/SConscript', + 'transformations/SConscript' +]) + +Import('simple_kalman_python', 'transformations_python') +common_python = [params_python, simple_kalman_python, transformations_python] + +Export('common_python') diff --git a/common/kalman/SConscript b/common/kalman/SConscript index d60354c98..7cba4a9a6 100644 --- a/common/kalman/SConscript +++ b/common/kalman/SConscript @@ -1,3 +1,5 @@ Import('envCython') -envCython.Program('simple_kalman_impl.so', 'simple_kalman_impl.pyx') +simple_kalman_python = envCython.Program('simple_kalman_impl.so', 'simple_kalman_impl.pyx') + +Export('simple_kalman_python') diff --git a/common/transformations/SConscript b/common/transformations/SConscript index ee9b9a2b7..4ac73a165 100644 --- a/common/transformations/SConscript +++ b/common/transformations/SConscript @@ -1,6 +1,5 @@ Import('env', 'envCython') transformations = env.Library('transformations', ['orientation.cc', 'coordinates.cc']) -Export('transformations') - -envCython.Program('transformations.so', 'transformations.pyx') +transformations_python = envCython.Program('transformations.so', 'transformations.pyx') +Export('transformations', 'transformations_python') diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript index 5ce47eab1..79afa1d91 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript @@ -1,4 +1,4 @@ -Import('env', 'envCython', 'arch', 'messaging_python') +Import('env', 'envCython', 'arch', 'messaging_python', 'common_python') gen = "c_generated_code" @@ -66,7 +66,7 @@ lenv.Clean(generated_files, Dir(gen)) generated_long = lenv.Command(generated_files, source_list, f"cd {Dir('.').abspath} && python3 long_mpc.py") -lenv.Depends(generated_long, messaging_python) +lenv.Depends(generated_long, [messaging_python, common_python]) lenv["CFLAGS"].append("-DACADOS_WITH_QPOASES") lenv["CXXFLAGS"].append("-DACADOS_WITH_QPOASES")