2020-07-16 13:36:28 -07:00
|
|
|
Import('env', 'cereal', 'cython_dependencies')
|
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-03 12:06:52 -08:00
|
|
|
for x in sorted(os.listdir('../')):
|
2019-12-01 13:39:10 -08:00
|
|
|
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
|
|
|
|
2020-07-08 14:05:16 -07:00
|
|
|
# Build packer and parser
|
2020-07-16 13:36:28 -07:00
|
|
|
env.Command(['packer_pyx.so', 'packer_pyx.cpp', 'parser_pyx.so', 'parser_pyx.cpp'],
|
2020-08-01 23:47:57 -07:00
|
|
|
cython_dependencies + [libdbc, cereal, 'common_pyx_setup.py', 'common.pxd', 'packer_pyx.pyx', 'parser_pyx.pyx', 'packer.cc', 'parser.cc'],
|
2020-07-16 13:36:28 -07:00
|
|
|
"cd opendbc/can && python3 common_pyx_setup.py build_ext --inplace")
|