mirror of
https://github.com/commaai/msgq.git
synced 2026-06-11 23:44:58 +08:00
* add class SubMaster&PubMaster * add socketmaster.cc * move to cereal_objects * modify SubMaster * modify SubMaster * Code streamlining * m createSocket remove dup SubMessage * Streamline code Streamline code Streamline code alive if delay with LogMonoTime x reduce code lines add underscore to class variable,dont check getValid() in poll add static function get_service(), assert if pub name is not in service list remove paramater alive from recieve() rename services to endpoints is alive is freq_ <= (1e-5) referer use sockets_.find() in pushMaster::send to avoid create an empty entry submaster only do poller, rm PubMaster,add PubMessage add MessageContext make SubMaster api same as python version add class PubMessage add empty line fix type fix typo remove service_list_ Streamline code use cached heaparry to build&send msg reduce lines rename sockets_ to messages_ initialize member variable in class don't use std::find fix typo * use global context,remove class PubMessage remove SubMessage interface from header,add operator[] undo format source add new line at end of file add missing header fiel reve std::find add empty line better drain
66 lines
2.4 KiB
Python
66 lines
2.4 KiB
Python
Import('env', 'arch', 'zmq')
|
|
|
|
gen_dir = Dir('gen')
|
|
messaging_dir = Dir('messaging')
|
|
|
|
# TODO: remove src-prefix and cereal from command string. can we set working directory?
|
|
env.Command(["gen/c/include/c++.capnp.h", "gen/c/include/java.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS")
|
|
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'],
|
|
'capnpc $SOURCES --src-prefix=cereal -o c++:' + gen_dir.path + '/cpp/')
|
|
import shutil
|
|
if shutil.which('capnpc-java'):
|
|
env.Command(
|
|
['gen/java/Car.java', 'gen/java/Log.java'],
|
|
['car.capnp', 'log.capnp'],
|
|
'capnpc $SOURCES --src-prefix=cereal -o java:' + gen_dir.path + '/java/')
|
|
|
|
# TODO: remove non shared cereal and messaging
|
|
cereal_objects = env.SharedObject([
|
|
'gen/cpp/car.capnp.c++',
|
|
'gen/cpp/log.capnp.c++',
|
|
'messaging/socketmaster.cc',
|
|
])
|
|
|
|
env.Library('cereal', cereal_objects)
|
|
env.SharedLibrary('cereal_shared', cereal_objects)
|
|
|
|
cereal_dir = Dir('.')
|
|
services_h = env.Command(
|
|
['services.h'],
|
|
['service_list.yaml', 'services.py'],
|
|
'python3 ' + cereal_dir.path + '/services.py > $TARGET')
|
|
|
|
messaging_objects = env.SharedObject([
|
|
'messaging/messaging.cc',
|
|
'messaging/impl_zmq.cc',
|
|
'messaging/impl_msgq.cc',
|
|
'messaging/msgq.cc',
|
|
])
|
|
|
|
messaging_lib = env.Library('messaging', messaging_objects)
|
|
Depends('messaging/impl_zmq.cc', services_h)
|
|
|
|
# note, this rebuilds the deps shared, zmq is statically linked to make APK happy
|
|
# TODO: get APK to load system zmq to remove the static link
|
|
if arch == "aarch64":
|
|
zmq_static = FindFile("libzmq.a", "/usr/lib")
|
|
shared_lib_shared_lib = [zmq_static, 'm', 'stdc++', "gnustl_shared"]
|
|
env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib)
|
|
|
|
env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq'])
|
|
Depends('messaging/bridge.cc', services_h)
|
|
|
|
# different target?
|
|
#env.Program('messaging/demo', ['messaging/demo.cc'], LIBS=[messaging_lib, 'zmq'])
|
|
|
|
|
|
env.Command(['messaging/messaging_pyx.so'],
|
|
[messaging_lib, 'messaging/messaging_pyx_setup.py', 'messaging/messaging_pyx.pyx', 'messaging/messaging.pxd'],
|
|
"cd " + messaging_dir.path + " && python3 messaging_pyx_setup.py build_ext --inplace")
|
|
|
|
|
|
if GetOption('test'):
|
|
env.Program('messaging/test_runner', ['messaging/test_runner.cc', 'messaging/msgq_tests.cc'], LIBS=[messaging_lib])
|