raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.94k stars 844 forks source link

Universal examples ignore `picotool_DIR` setting #531

Open lurch opened 2 months ago

lurch commented 2 months ago

If I try and build all of pico-examples with something like this:

cd pico-examples
mkdir build
cd build
cmake .. -DPICO_SDK_PATH=../../pico-sdk -DPICO_RISCV_TOOLCHAIN_PATH=$(realpath ../../corev-openhw-gcc-ubuntu2204-20240530) -DPICO_ARM_TOOLCHAIN_PATH=/usr -Dpicotool_DIR=$(realpath ../../picotool.install/picotool)

(where ../../picotool.install is the location that I've done a "flat install" of picotool into), then when it gets as far as building the universal examples, it says "No installed picotool with version 2.0.0 found - building from source", and then downloads and builds a fresh copy of picotool! :facepalm: By looking at https://github.com/raspberrypi/pico-examples/blob/develop/universal/CMakeLists.txt#L55 I was able to get this working with:

cmake .. -DPICO_SDK_PATH=../../pico-sdk -DPICO_RISCV_TOOLCHAIN_PATH=$(realpath ../../corev-openhw-gcc-ubuntu2204-20240530) -DPICO_ARM_TOOLCHAIN_PATH=/usr -Dpicotool_DIR=$(realpath ../../picotool.install/picotool) -Dpicotool_INSTALL_DIR=$(realpath ../../picotool.install)

i.e. by supplying both -Dpicotool_DIR=$(realpath ../../picotool.install/picotool) and -Dpicotool_INSTALL_DIR=$(realpath ../../picotool.install), but that's obviously a bit awkward / unexpected.

(And as an aside, I have to use realpath in a few places, because some parts of the build don't work properly with relative paths?)