crownstone / bluenet

Bluenet is the in-house firmware on Crownstone hardware. Functions: switching, dimming, energy monitoring, presence detection, indoor localization, switchcraft.
https://crownstone.rocks
91 stars 62 forks source link

Make build system report missing dependencies, do not install dependencies #150

Closed mrquincle closed 2 years ago

mrquincle commented 2 years ago

Currently the build system tries to do too much. It should be left to the user on how to install things. It's fine to report that there are things missing, but that's it. This will remove the need for sudo in the scripts. It is also fine to report errors with versions or to even stop compiling on a version mismatch.

The exception are tools that are actually easily downloadable, such as the cross-compiler. These can be placed indeed in tools and a path can be set so they are picked up by cmake.

In both cases we can (1) check for the version of e.g. nrfutil, (2) abort the build if we consider a version mismatch to be major, (3) inform the user on how to update to a proper version.

In the information to the user we can even display different things depending on the operating system they are running.

If we do this, fixing https://github.com/crownstone/bluenet/issues/122 will be easier as well.

Note that if we need a particular way to install dependencies for automatic build tools, we can do this nevertheless. For example, in https://github.com/crownstone/bluenet/blob/master/.github/workflows/bluenet-continuous-integration.yml it is fine to run apt install python3-pip and install a few pip packages before running cmake. No need to do it within cmake.

mrquincle commented 2 years ago

To do this properly, we would need the following scripts:

We already have scripts for srecord, pass, and udev (as well as python, wget, and git, which are existing default scripts).

mrquincle commented 2 years ago

The branch https://github.com/crownstone/bluenet/tree/maintain/build-system-refactor has implemented most of the work described in this commit.