From 5467b90982228db5ba3c70050f6590a5a9affffb Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 2 Jul 2018 20:50:28 +0300 Subject: [PATCH] OSX: Prefer Macports over Homebrew if available --- CMakeLists.txt | 20 ++++++++++---------- osx_environment.sh | 27 ++++++++++++++------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 912d4354..5bc2cfaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,7 +303,16 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if (IS_DIRECTORY /usr/local/opt/openssl) + if (IS_DIRECTORY /opt/local) + # macports + set (OPENSSL_ROOT /opt/local) + + set (OPENSSL_LIBS + ${OPENSSL_ROOT}/lib/libssl.a + ${OPENSSL_ROOT}/lib/libcrypto.a + z + ) + elseif (IS_DIRECTORY /usr/local/opt/openssl) # brew set (OPENSSL_ROOT /usr/local/opt/openssl) @@ -313,15 +322,6 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ${OPENSSL_ROOT}/lib/libssl.a ${OPENSSL_ROOT}/lib/libcrypto.a ) - else(IS_DIRECTORY /opt/local) - # macports - set (OPENSSL_ROOT /opt/local) - - set (OPENSSL_LIBS - ${OPENSSL_ROOT}/lib/libssl.a - ${OPENSSL_ROOT}/lib/libcrypto.a - z - ) endif() elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") diff --git a/osx_environment.sh b/osx_environment.sh index 82b40f17..e30a0c00 100644 --- a/osx_environment.sh +++ b/osx_environment.sh @@ -4,28 +4,29 @@ if [ ! $BARRIER_BUILD_ENV ]; then printf "Modifying environment for Barrier build..." - if command -v brew; then + if command -v port; then + printf "Detected Macports" + + if [ ! -d /opt/local/lib/cmake/Qt5 ]; then + printf "Please install qt5-qtbase port" + fi + export BARRIER_BUILD_MACPORTS=1 + export CMAKE_PREFIX_PATH="/opt/local/lib/cmake/Qt5:$CMAKE_PREFIX_PATH" + export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH" + export CPATH="/opt/local/include:$CPATH" + export PKG_CONFIG_PATH="/opt/local/libexec/qt5/lib/pkgconfig:$PKG_CONFIG_PATH" + + elif command -v brew; then printf "Detected Homebrew" QT_PATH=$(brew --prefix qt) OPENSSL_PATH=$(brew --prefix openssl) - export BARRIER_BUILD_BREW=1 + export BARRIER_BUILD_BREW=1 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" - elif command -v port; then - printf "Detected Macports" - - if [ ! -d /opt/local/lib/cmake/Qt5 ]; then - printf "Please install qt5-qtbase port" - fi - export BARRIER_BUILD_MACPORTS=1 - export CMAKE_PREFIX_PATH="/opt/local/lib/cmake/Qt5:$CMAKE_PREFIX_PATH" - export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH" - export CPATH="/opt/local/include:$CPATH" - export PKG_CONFIG_PATH="/opt/local/libexec/qt5/lib/pkgconfig:$PKG_CONFIG_PATH" else printf "Neither Homebrew nor Macports is installed. Can't get dependency paths" exit 1