Commit 4b7ea6ed authored by Isuru Fernando's avatar Isuru Fernando
Browse files

support native builds and disable universal2 builds on arm64

parent 66199c73
......@@ -424,8 +424,8 @@ function activate_ccache {
echo "Using C compiler: $(which clang)"
}
function macos_intel_build_setup {
# Setup build for single arch x86_64 wheels
function macos_intel_native_build_setup {
# Setup cross build for single arch x86_64 wheels
export PLAT="x86_64"
export _PYTHON_HOST_PLATFORM="macosx-${MB_PYTHON_OSX_VER}-x86_64"
export CFLAGS+=" -arch x86_64"
......@@ -435,8 +435,13 @@ function macos_intel_build_setup {
export LDFLAGS+=" -arch x86_64"
}
function macos_arm64_build_setup {
# Setup build for single arch arm_64 wheels
function macos_intel_cross_build_setup {
echo "universal2 builds on arm64 is not supported yet."
exit 1
}
function macos_arm64_cross_build_setup {
# Setup cross build for single arch arm_64 wheels
export PLAT="arm64"
export BUILD_PREFIX=/opt/arm64-builds
sudo mkdir -p $BUILD_PREFIX
......@@ -456,6 +461,13 @@ function macos_arm64_build_setup {
export host_alias="aarch64-apple-darwin20.0.0"
}
function macos_arm64_native_build_setup {
# Setup native build for single arch arm_64 wheels
export PLAT="arm64"
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
$@
}
function fuse_macos_intel_arm64 {
local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse})
local py_osx_ver=$(echo ${MB_PYTHON_OSX_VER} | sed "s/\./_/g")
......@@ -477,12 +489,23 @@ function fuse_macos_intel_arm64 {
function wrap_wheel_builder {
if [[ "${PLAT:-}" == "universal2" ]]; then
(macos_intel_build_setup && $@)
if [[ "$(uname -m)" == "arm64" ]]; then
(macos_intel_cross_build_setup && $@)
rm -rf *-stamp
(macos_arm64_native_build_setup && $@)
fuse_macos_intel_arm64
else
(macos_intel_native_build_setup && $@)
rm -rf *-stamp
(macos_arm64_build_setup && $@)
(macos_arm64_cross_build_setup && $@)
fuse_macos_intel_arm64
elif [[ "${PLAT:-}" == "arm64" && "(uname -m)" != "arm64" ]]; then
(macos_arm64_build_setup && $@)
fi
elif [[ "${PLAT:-}" == "arm64" ]]; then
if [[ "$(uname -m)" == "arm64" ]]; then
(macos_arm64_native_build_setup && $@)
else
(macos_arm64_cross_build_setup && $@)
fi
else
$@
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment