2021-07-29 16:32:29 +08:00
|
|
|
Import('env', 'envCython', 'arch', 'common')
|
2019-11-12 08:49:08 +08:00
|
|
|
|
2020-07-30 04:38:36 +08:00
|
|
|
|
2024-06-10 08:17:12 +08:00
|
|
|
visionipc_dir = Dir('msgq/visionipc')
|
2019-11-21 08:32:42 +08:00
|
|
|
gen_dir = Dir('gen')
|
|
|
|
|
|
|
|
|
2024-06-10 08:17:12 +08:00
|
|
|
# Build msgq
|
|
|
|
msgq_objects = env.SharedObject([
|
|
|
|
'msgq/ipc.cc',
|
|
|
|
'msgq/event.cc',
|
|
|
|
'msgq/impl_zmq.cc',
|
|
|
|
'msgq/impl_msgq.cc',
|
|
|
|
'msgq/impl_fake.cc',
|
|
|
|
'msgq/msgq.cc',
|
2019-11-22 23:09:46 +08:00
|
|
|
])
|
2024-06-10 08:17:12 +08:00
|
|
|
msgq = env.Library('msgq', msgq_objects)
|
|
|
|
msgq_python = envCython.Program('msgq/ipc_pyx.so', 'msgq/ipc_pyx.pyx', LIBS=envCython["LIBS"]+[msgq, "zmq", common])
|
2021-01-08 21:54:41 +08:00
|
|
|
|
|
|
|
# Build Vision IPC
|
2024-06-10 08:17:12 +08:00
|
|
|
vipc_files = ['visionipc.cc', 'visionipc_server.cc', 'visionipc_client.cc', 'visionbuf.cc']
|
2024-06-07 04:58:15 +08:00
|
|
|
vipc_sources = [f'{visionipc_dir.abspath}/{f}' for f in vipc_files]
|
2021-01-08 21:54:41 +08:00
|
|
|
|
2022-04-20 01:58:17 +08:00
|
|
|
if arch == "larch64":
|
2024-06-07 04:58:15 +08:00
|
|
|
vipc_sources += [f'{visionipc_dir.abspath}/visionbuf_ion.cc']
|
2021-01-08 21:54:41 +08:00
|
|
|
else:
|
2024-06-07 04:58:15 +08:00
|
|
|
vipc_sources += [f'{visionipc_dir.abspath}/visionbuf_cl.cc']
|
2021-01-08 21:54:41 +08:00
|
|
|
|
|
|
|
vipc_objects = env.SharedObject(vipc_sources)
|
2024-02-28 05:15:22 +08:00
|
|
|
visionipc = env.Library('visionipc', vipc_objects)
|
2021-01-08 21:54:41 +08:00
|
|
|
|
2021-02-10 00:39:33 +08:00
|
|
|
|
2022-03-06 06:56:15 +08:00
|
|
|
vipc_frameworks = []
|
2024-06-10 08:17:12 +08:00
|
|
|
vipc_libs = envCython["LIBS"] + [visionipc, msgq, 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')
|
2024-06-07 04:58:15 +08:00
|
|
|
envCython.Program(f'{visionipc_dir.abspath}/visionipc_pyx.so', f'{visionipc_dir.abspath}/visionipc_pyx.pyx',
|
2022-03-06 06:56:15 +08:00
|
|
|
LIBS=vipc_libs, FRAMEWORKS=vipc_frameworks)
|
2021-02-10 00:15:18 +08:00
|
|
|
|
2023-08-25 05:00:32 +08:00
|
|
|
if GetOption('extras'):
|
2024-06-10 08:17:12 +08:00
|
|
|
env.Program('msgq/test_runner', ['msgq/test_runner.cc', 'msgq/msgq_tests.cc'], LIBS=[msgq, common])
|
|
|
|
env.Program(f'{visionipc_dir.abspath}/test_runner',
|
|
|
|
[f'{visionipc_dir.abspath}/test_runner.cc', f'{visionipc_dir.abspath}/visionipc_tests.cc'],
|
2022-03-06 06:56:15 +08:00
|
|
|
LIBS=['pthread'] + vipc_libs, FRAMEWORKS=vipc_frameworks)
|
2024-02-28 05:15:22 +08:00
|
|
|
|
2024-06-10 08:17:12 +08:00
|
|
|
Export('visionipc', 'msgq', 'msgq_python')
|