Skip to content
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

Add option to build LoRaMac sources as a static library #1368

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

dmeehan1968
Copy link

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.

@MedadRufus
Copy link

Would be useful.

@mluis1 mluis1 requested a review from djaeckle October 20, 2022 08:55
@mluis1
Copy link
Contributor

mluis1 commented Oct 20, 2022

Thanks for the proposition.
We will consider it for a future major release.

@dmeehan1968
Copy link
Author

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?

@dmeehan1968
Copy link
Author

Rebased onto current master, v4.7.0 (plus comment fix)

@danak6jq
Copy link

Watching this closely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants