cereal/SConscript

79 lines
2.8 KiB
Python
Raw Normal View History

Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
Import('env', 'envCython', 'arch', 'zmq', 'QCOM_REPLAY')
2019-11-12 08:49:08 +08:00
2020-07-30 04:38:36 +08:00
import shutil
cereal_dir = Dir('.')
gen_dir = Dir('gen')
messaging_dir = Dir('messaging')
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
# Build cereal
env.Command(["gen/c/include/c++.capnp.h", "gen/c/include/java.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS")
2020-07-30 04:38:36 +08:00
env.Command(['gen/cpp/car.capnp.c++', 'gen/cpp/log.capnp.c++', 'gen/cpp/car.capnp.h', 'gen/cpp/log.capnp.h'],
['car.capnp', 'log.capnp'],
f"capnpc --src-prefix={cereal_dir.path} $SOURCES -o c++:{gen_dir.path}/cpp/")
2020-07-30 04:38:36 +08:00
2019-11-22 12:34:47 +08:00
if shutil.which('capnpc-java'):
2020-07-30 04:38:36 +08:00
env.Command(['gen/java/Car.java', 'gen/java/Log.java'],
['car.capnp', 'log.capnp'],
f"capnpc $SOURCES --src-prefix={cereal_dir.path} -o java:{gen_dir.path}/java/")
2019-11-14 02:01:01 +08:00
2019-11-22 09:48:01 +08:00
# TODO: remove non shared cereal and messaging
2019-11-22 23:09:46 +08:00
cereal_objects = env.SharedObject([
2020-07-30 04:38:36 +08:00
'gen/cpp/car.capnp.c++',
'gen/cpp/log.capnp.c++',
])
2019-11-12 08:49:08 +08:00
2019-11-22 23:09:46 +08:00
env.Library('cereal', cereal_objects)
2020-05-08 12:06:32 +08:00
env.SharedLibrary('cereal_shared', cereal_objects)
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
# Build messaging
2020-07-30 04:38:36 +08:00
services_h = env.Command(['services.h'],
['service_list.yaml', 'services.py'],
'python3 ' + cereal_dir.path + '/services.py > $TARGET')
2019-11-21 00:33:24 +08:00
2019-11-22 23:09:46 +08:00
messaging_objects = env.SharedObject([
2019-11-21 01:44:47 +08:00
'messaging/messaging.cc',
'messaging/impl_zmq.cc',
'messaging/impl_msgq.cc',
'messaging/msgq.cc',
2020-06-12 08:44:19 +08:00
'messaging/socketmaster.cc',
2019-11-22 23:09:46 +08:00
])
2019-11-21 01:44:47 +08:00
2019-11-22 23:09:46 +08:00
messaging_lib = env.Library('messaging', messaging_objects)
Depends('messaging/impl_zmq.cc', services_h)
2019-11-21 01:44:47 +08:00
2019-11-21 04:06:15 +08:00
# note, this rebuilds the deps shared, zmq is statically linked to make APK happy
2019-11-22 23:09:46 +08:00
# TODO: get APK to load system zmq to remove the static link
if arch == "aarch64":
zmq_static = FindFile("libzmq.a", "/usr/lib")
2020-06-12 08:44:19 +08:00
shared_lib_shared_lib = [zmq_static, 'm', 'stdc++', "gnustl_shared", "kj", "capnp"]
env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib)
2019-11-21 01:44:47 +08:00
env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq'])
Depends('messaging/bridge.cc', services_h)
2019-11-21 01:44:47 +08:00
envCython.Program('messaging/messaging_pyx.so', 'messaging/messaging_pyx.pyx', LIBS=envCython["LIBS"]+[messaging_lib, "zmq"])
2019-11-21 01:44:47 +08:00
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
# Build Vision IPC
vipc_sources = [
'visionipc/ipc.cc',
'visionipc/visionipc_server.cc',
'visionipc/visionipc_client.cc',
'visionipc/visionbuf.cc',
]
if arch in ["aarch64", "larch64"] and (not QCOM_REPLAY):
vipc_sources += ['visionipc/visionbuf_ion.cc']
else:
vipc_sources += ['visionipc/visionbuf_cl.cc']
vipc_objects = env.SharedObject(vipc_sources)
vipc = env.Library('visionipc', vipc_objects)
if GetOption('test'):
env.Program('messaging/test_runner', ['messaging/test_runner.cc', 'messaging/msgq_tests.cc'], LIBS=[messaging_lib])
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
env.Program('visionipc/test_runner', ['visionipc/test_runner.cc', 'visionipc/visionipc_tests.cc'], LIBS=[vipc, messaging_lib, 'zmq', 'pthread', 'OpenCL'])