LoRaMac-node
LoRaMac-node copied to clipboard
Add option to build LoRaMac sources as a static library
Intention of this PR is to allow developers to build the LoRaMac sources as a static library for inclusion in their own projects.
A separate directory is added to the project called as-lib which contains a set of CMakeLists.txt files that shadow the directory structure under src. A backwards compatible change is made to the project root CMakeLists.txt which, when provided with the option LORAMAC_AS_LIB, will direct CMake to reference the as-lib directory instead of src. The option default is OFF so that the past build behaviour is preserved as the default.
A README.md is provided in the as-lib directory with an outline of options/settings that can be applied to the build. A standard LORAMAC_ prefix is applied to all options to aid interoperatibility with other project sources.
This is a rough draft and is currently working within my own project. I will add usage instructions to the README shortly.
I'm currently loading the repo into the project via CMake's FetchContent, as this allows the inclusion of the project root via add_subdirectory whilst specifying other options, such as building regional specific variants (my own projects tend to have different builds for each desired LoRaWAN region, rather than a single multi-region build (although this is also intended to be supported by this facility).
Feedback, enhancements and criticism welcome.
Would be useful.
Thanks for the proposition. We will consider it for a future major release.
There is an argument with this that its used to rework the examples (using the parallel directory structure to leave the legacty as-is) so that they are built using the static library targets. In time, this can then be worked back into the src tree.
I don't see that as being a change of interface (respect your choice as to when to integrate of course).
I can't really do the range of examples due to lack of hardware/toolchain. In fact I only have our custom boards which are only MCU/radio similar to the B-L027-LRWAN-1 example, but it's at least the same toolchain. I could do an example based off that if you're interested. Do you think that should be another PR, or add to this?
Rebased onto current master, v4.7.0 (plus comment fix)
Watching this closely.