fix OSX build

This commit is contained in:
walker0643 2018-02-13 14:49:39 -05:00
parent 5bd7e6bfe8
commit f07070f7f9
3 changed files with 32 additions and 3 deletions

15
clean_build.sh Normal file → Executable file
View File

@ -5,8 +5,17 @@ mkdir build || exit 1
cd build || exit 1
# some environments have cmake v2 as 'cmake' and v3 as 'cmake3'
# check for cmake3 first then fallback to just cmake
CMAKE=`which cmake3 2>/dev/null`
[ $? -ne 0 -o "x$CMAKE" = "x" ] && CMAKE=cmake
$CMAKE -D CMAKE_BUILD_TYPE=Debug .. || exit 1
B_CMAKE=`which cmake3 2>/dev/null`
[ $? -ne 0 -o "x$B_CMAKE" = "x" ] && B_CMAKE=cmake
# default build configuration
B_BUILD_TYPE=${B_BUILD_TYPE:-Debug}
if [ "$(uname)" = "Darwin" ]; then
# OSX needs a lot of extra help, poor thing
# run the osx_environment.sh script to fix paths
[ -r ../osx_environment.sh ] && source ../osx_environment.sh
B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk $B_CMAKE_FLAGS"
fi
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS"
$B_CMAKE $B_CMAKE_FLAGS .. || exit 1
make || exit 1
echo "Build completed successfully"

17
osx_environment.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
if [ ! $BARRIER_BUILD_ENV ]; then
printf "Modifying environment for Barrier build..."
QT_PATH=$(brew --prefix qt)
OPENSSL_PATH=$(brew --prefix openssl)
export CMAKE_PREFIX_PATH="$QT_PATH:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="$OPENSSL_PATH/lib:$LD_LIBRARY_PATH"
export CPATH="$OPENSSL_PATH/include:$CPATH"
export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
export BARRIER_BUILD_ENV=1
printf "done\n"
fi

View File

@ -33,6 +33,9 @@ if (WIN32)
PATH_SUFFIXES "Lib/x64")
set_target_properties (barrier PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
target_link_libraries (barrier ${DNSSD_LIB})
elseif (APPLE)
find_library(APPSERVICES_LIB ApplicationServices)
target_link_libraries(barrier ${APPSERVICES_LIB})
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (barrier dns_sd)
else()