Skip to content

Commit

Permalink
scons builds the python lib now
Browse files Browse the repository at this point in the history
  • Loading branch information
Comma Device committed Nov 20, 2019
1 parent 2f81135 commit fe9fe2a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ __pycache__
.*.swp
.*.swo
libcereal*.a
libmessaging.a
libmessaging.*
services.h

30 changes: 21 additions & 9 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,29 @@ env.Library('cereal', [
'gen/cpp/log.capnp.c++',
])

env.Library('messaging', [
'messaging/messaging.cc',
'messaging/impl_zmq.cc',
'messaging/impl_msgq.cc',
'messaging/msgq.cc',
])

env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=['messaging', 'zmq'])

env.Command(
['services.h'],
['service_list.yaml', 'services.py'],
'python3 cereal/services.py > $TARGET')

messaging_deps = [
'messaging/messaging.cc',
'messaging/impl_zmq.cc',
'messaging/impl_msgq.cc',
'messaging/msgq.cc',
]

messaging_lib = env.Library('messaging', messaging_deps)

# note, this rebuilds the deps shared
env.SharedLibrary('messaging', messaging_deps)

env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=['messaging', 'zmq'])

# different target?
#env.Program('messaging/demo', ['messaging/demo.cc'], LIBS=['messaging', 'zmq'])

env.Command(['messaging/messaging_pyx.so'],
[messaging_lib, 'messaging/messaging_pyx_setup.py', 'messaging/messaging_pyx.pyx', 'messaging/messaging.pxd'],
"cd cereal/messaging && python3 messaging_pyx_setup.py build_ext --inplace")

2 changes: 2 additions & 0 deletions messaging/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ demo
bridge
test_runner
*.o
*.os
*.d
*.a
*.so
messaging_pyx.cpp
3 changes: 1 addition & 2 deletions messaging/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
import subprocess

can_dir = os.path.dirname(os.path.abspath(__file__))
subprocess.check_call(["make", "-j3"], cwd=can_dir)
# must be build with scons
from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error

from cereal import log
Expand Down

0 comments on commit fe9fe2a

Please sign in to comment.