[feature] New logging system in preparation for an intended stlink library approach#1437
Conversation
Allows download build and include libraries for not-found libusb libraries on *nix and windows, using `libusb-cmake` repo
- searching for both `usb-1.0` or `libusb-1.0` on windows - Removed code-independed flag from libusb building - set the header path to the main generated `include` dir, so the header will remain prefixed with `libusb-1.0/` instead of directly accessed - fixed libusb dll path typo - marked `LIBUSB_INCLUDE_DIR` and `LIBUSB_LIBRARY` as advanced, upon manual build and inclusion.
- Moved all header files to appropriate subfolders to be context-isolated - Used `target_include_directories` instead of `include_directories` to better manage which library connects to where, and make this project include-able as a sub-project to bigger projects - Made all `#include` statements system-level and correctly prefixed
|
There are a few header dependencies that have not been converted to the new scheme. Thus, as it appears, this results in compilation errors. However I believe this can be easily fixed. I'll continue reviewing afterwards. Yet there are quite a few attempts and improvements I consider very useful. |
|
I'd prefer to keep source and header files together in the same directory respectively, unless there are superior header files without a matching source file, but this should be rather a stylistic issue than a technical one... |
I tend to divide the big projects into separate, smaller, target-centric sub-projects, included into the root Additionally, I usually separate headers and source files (despite being harder to manage) because it makes it easier to prefix different versions differently if ever needed, or avoid name conflicts, like with Windows and existing That said, the project's structure is already in place and I'm in no position to enforce such changes, unless they're wanted -in which case I can pay closer attention on what goes where, how and why. :) Seems like separating sources and headers makes it harder for static analyzers such as |
|
Fixing the non-prefixed That said, I also added windows (MSVC) on the workflow and that passed as well! |
No, it won't mess up the project in any kind, as long as the merge of a test-failing PR does not take place. Indeed it is even better to have them here to detect possible issues before merging into the |
|
Further I've converted this PR into a draft as long as proposed changes are still in discussion. |
|
Any update here? |
|
Hello again, Unfortunatelly IRL is being crazy for the past month. Let's formulate a plan as to what needs to be implemented and at which order, so I can allocate time implementing, instead of theorizing about potential features! To my experience, making libstlink a standalone library requires:
About these points: (1) even though we have a provider for Windows/MSVC LIBSTLINK, it seems to require some manual labor which we shall take into account:
(2) To add to this single-responsibility fashion, I'd suggest each tool to be contained within its own subproject for better maintainability and proper linking. (3) This is also related to note (1), and requires some research and further testing on how this library is supposed to be used. If portability is on the table, the methodology must also contain the discovery logic (such as All these said, I can only lay down some ideas and contribute to their implementation to the best of my ability! I wish you find this textwall usefull and it allows you to cherrypick the next actions! Cheers, |
I can't spot a problem here, as
A separate subdirectory structure should do. As this solely applies to Windows anyway, things should go to
The latter seems to be the most sufficient approach.
I consider it a good approach to start with the PR you recently opened, tailoring it down to Windows-specific changes in the context of the given comments from the review today. After that it may turn out to useful to strip this Draft-PR down to the remaining changes in order to continue the review. Kind regards |
|
Hello again, it's been a while... Since my wedding is approaches i have less and less time to give to myself (and, thus, the project). I promise to start actively working on it after after the commotion ends (starting early July) and keeping you posted with frequent updates. In general I'm interested in maintaining the project more holistically and not just provide "satelite features". That said, I do believe that some structural changes must take place first to allow for modularity and possibly better maintainability. The hardest issue so far is understanding the inner code workings, so, proper (probably in-code) documentation of the implemented functions would be helpfull... When the time comes (aka. when the wedding is done), If you could give me a tour to the codebase it would be godsent! Cheers, |
|
I'm officially married! Starting from the following weekend, I'm planning to start diving into the codebase and write some notes about how it works! Quick questions:
Cheers! |
|
@a-michelis: Hi. Good to hear from you. Regarding the topic above there has been no further action yet as I could not find any spare time in the recent weeks and months to invest in this project. 😞 Regarding you questions:
I hope this draws a first idea in which direction one may proceed step by step. Regards |
|
I've started my logging approach from scratch - since I've done some reading on spdlog - to properly solidify the situation. Some key factors are:
I suppose that, since I re-iterated the logging system, there now is a new branch which requires a new PR. If i'm wrong, please advice on how to proceed! If you want to see the current state of logging, I'm about to push the first changes into my forked repo. Cheers, |
|
Side note: I'd gladly convert the whole codebase in C++17 or C++11, but that'll take time. |
|
C++ 17 and C 17 are preferred. GCC 8.1 or later should be for compilation in terms of upcoming system requirements. |
|
The above discussion is going to be continued in issue #1474. |
This PR attempts to give STLink project a proper logging system in preparation for a library approach, to enable users incorporate stlink-lib into their projects.
Proposal: Main changes (in a nutshell)
stlinksub-folders that are included into the project as system includes, to allow for system-like includes. This change required the change of all inclusions in the project to change from#include "%HEADER%.h"to#include <stlink/%HEADER%.h>extern "C"blocks.Much needed prior additions that are missing (this PR):
libusbfollowed by exhaustive testingA.M.
(updated by Nightwalker-87)