opendbc/can/SConscript

28 lines
882 B
Python
Raw Normal View History

2019-12-01 16:05:17 -08:00
Import('env', 'cereal')
2019-12-01 13:39:10 -08:00
import os
from opendbc.can.process_dbc import process
2019-12-01 14:17:15 -08:00
dbcs = []
2019-12-01 13:39:10 -08:00
for x in os.listdir('../'):
if x.endswith(".dbc"):
2019-12-01 14:17:15 -08:00
def compile_dbc(target, source, env):
2019-12-01 13:39:10 -08:00
process(source[0].path, target[0].path)
2019-12-01 14:38:43 -08:00
in_fn = [os.path.join('../', x), 'dbc_template.cc']
2019-12-01 13:39:10 -08:00
out_fn = os.path.join('dbc_out', x.replace(".dbc", ".cc"))
2019-12-01 14:17:15 -08:00
dbc = env.Command(out_fn, in_fn, compile_dbc)
dbcs.append(dbc)
2019-12-01 13:39:10 -08:00
2019-12-01 14:38:43 -08:00
libdbc = env.SharedLibrary('libdbc', ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]+dbcs, LIBS=["capnp", "kj"])
2019-12-01 14:17:15 -08:00
# packer
2019-12-03 08:22:16 -08:00
env.Command(['packer_pyx.so'],
['packer_pyx.pyx', 'packer_pyx_setup.py'],
"cd opendbc/can && python3 packer_pyx_setup.py build_ext --inplace")
2019-12-01 14:17:15 -08:00
# parser
env.Command(['parser_pyx.so'],
2019-12-01 16:05:17 -08:00
[libdbc, cereal, 'parser_pyx_setup.py', 'parser_pyx.pyx', 'common.pxd'],
2019-12-01 14:17:15 -08:00
"cd opendbc/can && python3 parser_pyx_setup.py build_ext --inplace")