-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mock wiringpi script for macOS
- Loading branch information
1 parent
b8173fc
commit 4e0e8a8
Showing
1 changed file
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |