From f07070f7f91a5dafd45c8a31abcd502d509fd029 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Tue, 13 Feb 2018 14:49:39 -0500 Subject: [PATCH] fix OSX build --- clean_build.sh | 15 ++++++++++++--- osx_environment.sh | 17 +++++++++++++++++ src/gui/CMakeLists.txt | 3 +++ 3 files changed, 32 insertions(+), 3 deletions(-) mode change 100644 => 100755 clean_build.sh create mode 100644 osx_environment.sh diff --git a/clean_build.sh b/clean_build.sh old mode 100644 new mode 100755 index c6510340..f5a99807 --- a/clean_build.sh +++ b/clean_build.sh @@ -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" diff --git a/osx_environment.sh b/osx_environment.sh new file mode 100644 index 00000000..f05ba585 --- /dev/null +++ b/osx_environment.sh @@ -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 diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index fdc29ec5..869ef47a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -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()