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 51dbcd5
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions fill/setup_mock_wiringpi.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#!/bin/bash

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 51dbcd5

Please sign in to comment.