cereal/SConscript

77 lines
2.5 KiB
Python
Raw Normal View History

Import('env', 'envCython', 'arch', 'common')
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
schema_files = ['log.capnp', 'car.capnp', 'legacy.capnp', 'custom.capnp']
2021-09-22 05:48:35 +08:00
env.Command(["gen/c/include/c++.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS")
env.Command([f'gen/cpp/{s}.c++' for s in schema_files] + [f'gen/cpp/{s}.h' for s in schema_files],
schema_files,
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 09:48:01 +08:00
# TODO: remove non shared cereal and messaging
cereal_objects = env.SharedObject([f'gen/cpp/{s}.c++' for s in schema_files])
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
services_h = env.Command(['services.h'], ['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/event.cc',
2019-11-21 01:44:47 +08:00
'messaging/impl_zmq.cc',
'messaging/impl_msgq.cc',
'messaging/impl_fake.cc',
2019-11-21 01:44:47 +08:00
'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
env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq', common])
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", common])
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',
]
2022-04-20 01:58:17 +08:00
if arch == "larch64":
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
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)
2021-02-10 00:39:33 +08:00
2022-03-06 06:56:15 +08:00
vipc_frameworks = []
2022-03-07 18:50:17 +08:00
vipc_libs = envCython["LIBS"] + [vipc, messaging_lib, common, "zmq"]
2021-02-10 00:39:33 +08:00
if arch == "Darwin":
2022-03-06 06:56:15 +08:00
vipc_frameworks.append('OpenCL')
else:
vipc_libs.append('OpenCL')
envCython.Program('visionipc/visionipc_pyx.so', 'visionipc/visionipc_pyx.pyx',
LIBS=vipc_libs, FRAMEWORKS=vipc_frameworks)
if GetOption('test'):
env.Program('messaging/test_runner', ['messaging/test_runner.cc', 'messaging/msgq_tests.cc'], LIBS=[messaging_lib, common])
2022-03-06 06:56:15 +08:00
env.Program('visionipc/test_runner', ['visionipc/test_runner.cc', 'visionipc/visionipc_tests.cc'],
LIBS=['pthread'] + vipc_libs, FRAMEWORKS=vipc_frameworks)