travis_osx_steps.sh 1.58 KB
Newer Older
1
#!/bin/bash
2
# Wheel build, install, run test steps on OSX
3
4
set -e

5
6
if [ "$PLAT" == "arm64" ] || [ "$PLAT" == "universal2" ]; then
  if [[ "$(xcrun -show-sdk-version)" == 10.*  ]]; then
Andrew Murray's avatar
Andrew Murray committed
7
8
    if ([ "$GITHUB_WORKFLOW" != "" ] || [ "$PIPELINE_WORKSPACE" != "" ]) && [ $(ls /Applications | grep Xcode_12.*\.app) ]; then
      sudo xcode-select -switch /Applications/Xcode_12.*.app
9
10
11
12
13
14
    else
      echo "Need SDK>=11 for arm64 builds. Please run xcode-select to select a newer SDK"
      exit 1
    fi
  fi
  export SDKROOT=${SDKROOT:-$(xcrun -show-sdk-path)}
15
16
fi

17
# Get needed utilities
18
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
19
MB_PYTHON_VERSION=${MB_PYTHON_VERSION:-$TRAVIS_PYTHON_VERSION}
20
21
22

ENV_VARS_PATH=${ENV_VARS_PATH:-env_vars.sh}

23
# These load common_utils.sh
Matthew Brett's avatar
Matthew Brett committed
24
source $MULTIBUILD_DIR/osx_utils.sh
25
26
MB_PYTHON_OSX_VER=${MB_PYTHON_OSX_VER:-$(macpython_sdk_for_version $MB_PYTHON_VERSION)}

27
if [ -r "$ENV_VARS_PATH" ]; then source "$ENV_VARS_PATH"; fi
28
source $MULTIBUILD_DIR/configure_build.sh
29
source $MULTIBUILD_DIR/library_builders.sh
30

31
32
# NB - config.sh sourced at end of this function.
# config.sh can override any function defined here.
33
34
35
36

function before_install {
    export CC=clang
    export CXX=clang++
37

38
    get_macpython_environment $MB_PYTHON_VERSION venv
39
40
41
42
    source venv/bin/activate
    pip install --upgrade pip wheel
}

43
# build_wheel function defined in common_utils (via osx_utils)
44
# install_run function defined in common_utils
45
46

# Local configuration may define custom pre-build, source patching.
47
# It can also overwrite the functions above.
48
49
CONFIG_PATH=${CONFIG_PATH:-config.sh}
source "$CONFIG_PATH"