Leave circular dependency hell (adopt source/header model)#2175
Leave circular dependency hell (adopt source/header model)#2175aubsw wants to merge 22 commits intocommaai:masterfrom
Conversation
|
@robbederks I think for this work, we will need source-and-header-ify https://github.com/commaai/opendbc/tree/master/opendbc/safety, since we would need to #include those headers here. I got build working locally by patching safety.h & co. I'm also happy to try to break this work up in to several smaller PRs, tho that may take some time because it's difficult to break out individual headers without generating conflicts at the linking stage. |
|
Thanks. For now, the bounty is locked to #2172, if that attempt stalls it'll be unlocked again. |
|
Aw crud my bad. I started working on this before it was locked–didn't realize what was going on 😞 . |
|
@aubsw the bounty is unlocked if you want to continue! |
|
I'm in! I will draft a more detailed plan for breaking the change into smaller PRs today. I did the hard part already which is getting the code to compile. Now just need to make the diff a bit more digestible + supporting PR in the opendbc repo. |
|
@robbederks I'm prototyping my merge plan and am a bit behind. I will follow-up on the merge plan with a clear head tomorrow morning. |
9a9247e to
7bb8c64
Compare
04de5bb to
49cd5d7
Compare
49cd5d7 to
a8ac929
Compare
| f"{panda_root}/../opendbc/safety/", | ||
| f"{panda_root}/../opendbc", | ||
| f"{panda_root}/../opendbc/safety", | ||
| f"{panda_root}/include/", |
There was a problem hiding this comment.
is it possible to use something like f"{panda_root}/include/**" to avoid having to list every folder?
There was a problem hiding this comment.
Suprisingly, niether GCC nor SCons provides recursive directory include search. We have a few options:
- leave it how it is
- write a helper function to recursively get search paths
- add only top-level directories to the search path, adjust all header includes to use the full path. I.e.
#include "registers.h"would become#include "drivers/registers.h"everywhere.
I kind of prefer option 3 because it clarifies the directory structure of included headers in the source code.
07f29ed to
6132b5e
Compare
This is to address #2171
Unfortunately, for this to work in the end, I think we need to do the same to opendbc, since that library being header-only breaks our build.
For local testing, I patched opendbc, and it was a fairly small patch.