Using the build_examples.py helper script - clevelandmusicco/HothouseExamples GitHub Wiki

In the root of the HothouseExamples repository there is a helper script named build_examples.py. You can use it to build all of the examples in the src directory, and, optionally, publish all binaries to a single directory.

Prerequisites

  • Python 3.x - The the helper script and the commands on this page have been tested with Python 3.10.14 and Python 3.12.3. It's assumed you've aliased one of these versions to the local python command, but adjust the commands as needed. (For example, python3.12 build_examples.py might work on your system.)

Build all examples

To build all of the effects in the src dir:

cd HothouseExamples
python build_examples.py

By default, the compiled *.bin files will be in the build subdirectory of each example.

[!IMPORTANT] The helper script doesn't read the list of projects to build from a Makefile or any configurable source; it simply iterates through each subdirectory in src/. So, it's fairly dumb in this way. If it encounters subdirectories that won't build or don't have a Makefile, the script doesn't care, tries to run a make command, reports the outcome, and finally moves on to the next subdirectory.

Publishing all binaries to a single location

This might be useful if you prefer all your binaries in one directory to, for example, make them easier to find while flashing the Daisy Seed. If you want to publish the resulting *.bin files to a common location after compiling, pass the --publish_dir argument. For example, to publish all the *.bin files to /development/hothouse/bin:

python build_examples.py --publish_dir /development/hothouse/bin

This performs a simple copy operation after the make command. The original *.bin files will remain in the build subdirectory of each example. Only the *.bin files are copied; the *.elf, *.hex, etc. files are uncopied and untouched.

The --publish_dir argument can also be a relative path. In this case, specify a path relative to each example's subdirectory. For example, the following would publish all resulting *.bin files 2 directories up from each example's subdirectory (in /HothouseExamples/bin/):

python build_examples.py --publish_dir ../../bin

[!WARNING] This feature should be OS independent, but it hasn't been tested on Windows or Mac. Any issues will likely be caused by unexpected filepath delimiters. (6 Aug 2024)