Skip to content

Commit

Permalink
Add hints for SDKROOT, MACOSX_DEPLOYMENT_TARGET
Browse files Browse the repository at this point in the history
Closes #120
  • Loading branch information
tresf committed Aug 11, 2021
1 parent 408420c commit e40bdfe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions build-hidapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# windows - build all Windows variants
# linux - build all Linux variants
# osx - build all OS X variants
# darwin - OS X 64-bit
# darwin-x86-64 - OS X 64-bit
# darwin-aarch64 - OS X 64-bit ARM
# linux-aarch64 - Linux ARMv8 64-bit
# linux-amd64 - Linux AMD 64-bit
Expand Down Expand Up @@ -136,8 +136,8 @@ git pull

function git-clean {
echo -e "Resetting Cpp/hidapi"
git clean -ffdx > /dev/null 2>&1 || exit # remove all untracked files
git reset --hard > /dev/null 2>&1 || exit # reset all tracked files
git clean -ffdx > /dev/null 2>&1 || exit # remove all untracked files
git reset --hard > /dev/null 2>&1 || exit # reset all tracked files
}


Expand Down Expand Up @@ -327,6 +327,11 @@ echo -e "${green}---------------------------------------------------------------
if [[ "$1" == "all" ]] || [[ "$1" == "osx" ]] || [[ "$1" == "darwin" ]] || [[ "$1" == "darwin-x86-64" ]]
then
echo -e "${green}Building OS X Darwin${plain}" && git-clean
if [ -z "$SDKROOT" ] || [ -z "$MACOSX_DEPLOYMENT_TARGET" ];
then
echo -e "${yellow}WARNING: For production builds, please set \$SDKROOT and \$MACOSX_DEPLOYMENT_TARGET before building${plain}"
echo -e "${yellow} See also https://github.com/gary-rowe/hid4java/issues/120${plain}"
fi
./bootstrap
./configure
make CFLAGS="-arch x86_64"
Expand All @@ -347,9 +352,14 @@ fi
echo -e "${green}------------------------------------------------------------------------${plain}"

# Darwin ARM64
if [[ "$1" == "all" ]] || [[ "$1" == "osx" ]] || [[ "$1" == "darwin-aarch64" ]]
if [[ "$1" == "all" ]] || [[ "$1" == "osx" ]] || [[ "$1" == "darwin" ]] || [[ "$1" == "darwin-aarch64" ]]
then
echo -e "${green}Building OS X Darwin ARM64${plain}" && git-clean
if [ -z "$SDKROOT" ] || [ -z "$MACOSX_DEPLOYMENT_TARGET" ];
then
echo -e "${yellow}WARNING: For production builds, please set \$SDKROOT and \$MACOSX_DEPLOYMENT_TARGET before building${plain}"
echo -e "${yellow} See also https://github.com/gary-rowe/hid4java/issues/120${plain}"
fi
./bootstrap
./configure
make CFLAGS="-arch arm64"
Expand Down Expand Up @@ -427,9 +437,17 @@ echo -e "${green}OS X${plain}"

echo -e "${green}darwin${plain}"
file -b ../../Java/Personal/hid4java/src/main/resources/darwin-x86-64/libhidapi.dylib
if command -v otool &> /dev/null
then
otool -l ../../Java/Personal/hid4java/src/main/resources/darwin-x86-64/libhidapi.dylib |grep -E 'LC_VERSION_MIN_MACOSX|LC_BUILD_VERSION' -A4
fi

echo -e "${green}darwin-aarch64${plain}"
file -b ../../Java/Personal/hid4java/src/main/resources/darwin-aarch64/libhidapi.dylib
if command -v otool &> /dev/null
then
otool -l ../../Java/Personal/hid4java/src/main/resources/darwin-aarch64/libhidapi.dylib |grep -E 'LC_VERSION_MIN_MACOSX|LC_BUILD_VERSION' -A4
fi

echo -e "${green}------------------------------------------------------------------------${plain}"

Expand Down
Binary file removed src/main/resources/darwin/libhidapi.dylib
Binary file not shown.

0 comments on commit e40bdfe

Please sign in to comment.