Skip to content

Commit

Permalink
Update mock wiringpi script for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-goddard committed Jan 18, 2025
1 parent b8173fc commit 4e0e8a8
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions fill/setup_mock_wiringpi.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/bin/bash
# Move the mock_wiringpi library to the standard linking path on your system

if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
LIBRARY_PATH="/usr/local/lib"
LIBRARY_NAME="libwiringPi.dylib"
else
# Assume Linux otherwise
LIBRARY_PATH="/usr/lib"
LIBRARY_NAME="libwiringPi.so"
fi

BINPATH=$(bazel cquery --output=files //fill/lib/MockWiringPi:mock_wiringpi $1)
sudo rm /usr/lib/libwiringPi.so
sudo cp $BINPATH /usr/lib/libwiringPi.so
export LD_LIBRARY_PATH=/usr/lib

sudo rm -f "$LIBRARY_PATH/$LIBRARY_NAME"
sudo cp "$BINPATH" "$LIBRARY_PATH/$LIBRARY_NAME"

export LD_LIBRARY_PATH="$LIBRARY_PATH"

echo "Library updated and set at $LIBRARY_PATH/$LIBRARY_NAME"

0 comments on commit 4e0e8a8

Please sign in to comment.