OSX: Add support for building on macports

This commit is contained in:
Povilas Kanapickas 2018-07-01 15:14:55 +03:00
parent 2ddc81d927
commit f928c81afc
2 changed files with 48 additions and 13 deletions

View File

@ -302,13 +302,28 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
${OPENSSL_ROOT}/lib/ssleay32.lib ${OPENSSL_ROOT}/lib/ssleay32.lib
) )
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (OPENSSL_ROOT /usr/local/opt/openssl)
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include) if (IS_DIRECTORY /usr/local/opt/openssl)
set (OPENSSL_LIBS # brew
${OPENSSL_ROOT}/lib/libssl.a set (OPENSSL_ROOT /usr/local/opt/openssl)
${OPENSSL_ROOT}/lib/libcrypto.a
) include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
set (OPENSSL_LIBS
${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") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (OPENSSL_LIBS ssl crypto) set (OPENSSL_LIBS ssl crypto)
else() else()

View File

@ -1,16 +1,36 @@
#!/bin/sh #!/bin/bash
if [ ! $BARRIER_BUILD_ENV ]; then if [ ! $BARRIER_BUILD_ENV ]; then
printf "Modifying environment for Barrier build..." printf "Modifying environment for Barrier build..."
QT_PATH=$(brew --prefix qt) if command -v brew; then
OPENSSL_PATH=$(brew --prefix openssl) printf "Detected Homebrew"
QT_PATH=$(brew --prefix qt)
OPENSSL_PATH=$(brew --prefix openssl)
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
fi
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 export BARRIER_BUILD_ENV=1
printf "done\n" printf "done\n"