ffenix113 / zigbee_home

Project to provide functionality similar to ESPHome but for Zigbee instead of WiFi for nRF52
https://ffenix113.github.io/zigbee_home/
GNU General Public License v3.0
528 stars 10 forks source link

Add support for building on Windows and specifying custom boards #72

Closed felipejfc closed 3 months ago

felipejfc commented 3 months ago

(Draft PR for us to discuss the changes)

Adjusted paths so that the building will work on Windows/powershell. Also changed the default ncs version to 2.6.1 and fixed Zigbee with changes related to it. I've included BOARD_ROOT pointing to workdir on the generated CMakeLists so that one can use custom boards by creating a boards dir alongside zigbee.yaml file, I can create example related to it but it's a great way for us to achieve broader compatibility and adoption. I used this capability it to compile the binary to a nice!nano board and it worked great.

felipejfc commented 3 months ago

The explanation for filepath.Dir to path.Dir in some parts of template can be found in this issue https://github.com/golang/go/issues/44305#issuecomment-780111748

ffenix113 commented 3 months ago

Hello @felipejfc,

Thank you for the PR! I looked through it and it does look good to me. It is interesting that you didn't need to edit this function, as it provides some environment variables as well.

I will do some tests locally as well and post comments, if any, but generally have no objections for this PR.

BOARD_ROOT change is especially nice, as I also have a custom board to develop for, so this will help!

felipejfc commented 3 months ago

It is interesting that you didn't need to edit this function, as it provides some environment variables as well.

Thank you very much for reviewing! Regarding this:

It is interesting that you didn't need to edit this function, as it provides some environment variables as well.

The reason I didn't have problems is probably that whenever I'm running zigbee_home binary, I'm doing it from inside a nrf shell environment with: nrfutil toolchain-manager launch --shell It would probably be better if we also fix this method for windows so that running from inside the shell is not a requirement. But I'm not sure what the best approach would be, maybe make zb home source all env vars on the file $NCS_TOOLCHAIN_BASE/toolchains/$SELECTED_TOOLCHAIN/environment.json? What do you think?

felipejfc commented 3 months ago

Update: pushed a new commit fixing the file you pointed out and some more path separators. Now I can compile a firmware successfully even directly in powershell without needing to enter an ncs terminal first

ffenix113 commented 3 months ago

Could you please remove this, and I am ready to approve & merge this, unless you have anything else to discuss.

Great work!

felipejfc commented 3 months ago

Could you please remove this, and I am ready to approve & merge this, unless you have anything else to discuss.

Great work!

done!