Mac build: deal with libdivecomputer and pkg-config

libdivecomputer asks pkg-config for the include paths for libusb-1.0 and
hidapi, but then uses #include <libusb-1.0/libusb.h> and <hidapi/hidapi.h>
which fails as those directories are part of the include path. So we
manually add include paths without that last directory as well as a work
around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-07-15 14:18:33 -07:00
parent 5656509f61
commit d943a843e5

View file

@ -211,6 +211,13 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF ..
make -j4
make install
else
# we are getting libusb and hidapi from pkg-config and that goes wrong
# or more specifically, the way libdivecomputer references
# the include files goes wrong
LIBDC_CFLAGS=-I$(dirname $(pkg-config --cflags libusb-1.0 | sed -e 's/^-I//'))
LIBDC_CFLAGS="${LIBDC_CFLAGS} -I$(dirname $(pkg-config --cflags hidapi | sed -e 's/^-I//'))"
echo $LIBDC_CFLAGS
fi
LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
@ -276,7 +283,7 @@ if [ ! -f ../configure ] ; then
autoreconf --install ..
autoreconf --install ..
fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include" ../configure --prefix=$INSTALL_ROOT --disable-examples
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
make -j4
make install