-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved CMake configuration #156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This is again back to the discussion on how much we want to depend on CMake. If we want to support other build tools then we need to reimplement this logic. Using the preprocessor avoids this, we still have to make the compile definitions though. But what are the examples of other build systems. @petervdonovan do you have a comment? Was it based on the nRF52 thing? |
Part of the reason why I need to convert it back is based on how federated files having includes of .c files which messes with arduino compilation since things get compiled multiple times. I recall discussing with peter about having sole reliance on CMake, but in instances where cmake is not possible, still enforce the C standard of including headers and never including .c files under any circumstance within files. I could keep threaded includes the same since its a single file, but it seems rather weird to break from c norms for the sake of diversifying build systems. |
We could still use the preprocessor, just have Btw, it is not in the C standard that you should not include source files from other source files, it is not recommended, but if you know what you are doing then it can be a useful tool. |
100% agree
I have said that, but that was based on an (apparently naive) hope that CMake would be cross-platform enough for all our needs. Since then my opinion has shifted based on discussion with you and Erling and Martin. I am now fully on board with the idea of using the preprocessor (instead of CMake) to handle conditional code inclusion. (Edit: To clarify, I never really preferred CMake over the preprocessor per se. I preferred CMake over an ad hoc Java-based build system the implementation of which was spread through several parts of our monolithic code base.)
I still do not like #including
Agreed! I like this solution. It factors logic into the C preprocessor, which is the most cross-platform build tool that I could imagine, and it avoids #inclusion of |
Yeah the C Standard itself doesn't preclude the use of includes, but it does seem extremely hacky. I agree as well that the preprocessor definitions inside the .c files will solve the majority of our issues |
I just remembered now that |
@erlingrj and @petervdonovan is this good to go or are you still requesting changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Currently, there are still files that require includes of .c files, which is not ideal since we already use CMake. This pull request addresses this issue.