Fix compilation on M1 macOS

This commit is contained in:
aspen 2021-05-13 11:41:29 -04:00
parent 12024b9a5d
commit 615762d7b3
No known key found for this signature in database
GPG Key ID: 9CCE5F51B2F8C465
4 changed files with 31 additions and 13 deletions

View File

@ -317,10 +317,21 @@ 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")
find_program(APT_PROGRAM "apt")
find_program(BREW_PROGRAM "brew") find_program(BREW_PROGRAM "brew")
find_program(PORT_PROGRAM "port") find_program(PORT_PROGRAM "port")
if (IS_DIRECTORY /opt/local AND PORT_PROGRAM) if (IS_DIRECTORY /opt/procursus AND APT_PROGRAM)
# procursus/apt
set (OPENSSL_ROOT /opt/procursus)
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
set (OPENSSL_LIBS
${OPENSSL_ROOT}/lib/libssl.a
${OPENSSL_ROOT}/lib/libcrypto.a
)
elseif (IS_DIRECTORY /opt/local AND PORT_PROGRAM)
# macports # macports
set (OPENSSL_ROOT /opt/local) set (OPENSSL_ROOT /opt/local)
@ -335,6 +346,16 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include) include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
set (OPENSSL_LIBS
${OPENSSL_ROOT}/lib/libssl.a
${OPENSSL_ROOT}/lib/libcrypto.a
)
elseif (IS_DIRECTORY /opt/homebrew/opt/openssl AND BREW_PROGRAM)
# brew
set (OPENSSL_ROOT /opt/homebrew/opt/openssl)
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
set (OPENSSL_LIBS set (OPENSSL_LIBS
${OPENSSL_ROOT}/lib/libssl.a ${OPENSSL_ROOT}/lib/libssl.a
${OPENSSL_ROOT}/lib/libcrypto.a ${OPENSSL_ROOT}/lib/libcrypto.a

View File

@ -14,7 +14,7 @@ if [ "$(uname)" = "Darwin" ]; then
# OSX needs a lot of extra help, poor thing # OSX needs a lot of extra help, poor thing
# run the osx_environment.sh script to fix paths # run the osx_environment.sh script to fix paths
. ./osx_environment.sh . ./osx_environment.sh
B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $B_CMAKE_FLAGS"
fi fi
# allow local customizations to build environment # allow local customizations to build environment
[ -r ./build_env.sh ] && . ./build_env.sh [ -r ./build_env.sh ] && . ./build_env.sh

View File

@ -48,7 +48,7 @@ fi
# Check for macdeployqt on Homebrew # Check for macdeployqt on Homebrew
if which -s brew ; then if which -s brew ; then
info "Homebrew found, searching for macdeployqt" info "Homebrew found, searching for macdeployqt"
DEPLOYQT="$(brew list qt | grep --only '/.*macdeployqt' | head -1)" DEPLOYQT="$(brew list qt5 | grep --only '/.*macdeployqt' | head -1)"
if [ ! -x "$DEPLOYQT" ]; then if [ ! -x "$DEPLOYQT" ]; then
error Please install package qt error Please install package qt
exit 1 exit 1

View File

@ -29,18 +29,15 @@ if [ ! $BARRIER_BUILD_ENV ]; then
elif command -v brew; then elif command -v brew; then
printf "Detected Homebrew\n" printf "Detected Homebrew\n"
QT_PATH=$(brew --prefix qt) QT_PATH=$(brew --prefix qt5)
OPENSSL_PATH=$(brew --prefix openssl)
check_dir_exists "$QT_PATH" 'qt' check_dir_exists "$QT_PATH" 'qt5'
check_dir_exists "$OPENSSL_PATH" 'openssl'
export BARRIER_BUILD_BREW=1 export BARRIER_BUILD_BREW=1
export CMAKE_PREFIX_PATH="$QT_PATH:$CMAKE_PREFIX_PATH" export CMAKE_PREFIX_PATH="/opt/procursus:$QT_PATH:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="$OPENSSL_PATH/lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="/opt/procursus/lib:$LD_LIBRARY_PATH"
export CPATH="$OPENSSL_PATH/include:$CPATH" export CPATH="/opt/procursus/include:$CPATH"
export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH" export PKG_CONFIG_PATH="/opt/procursus/lib/pkgconfig:$PKG_CONFIG_PATH"
else else
printf "Neither Homebrew nor Macports is installed. Can't get dependency paths\n" printf "Neither Homebrew nor Macports is installed. Can't get dependency paths\n"
exit 1 exit 1