Skip to content

Commit 6df8909

Browse files
author
Goran Jelic-Cizmek
committed
Fix cross wheel-building on ARM-based MacOS
* Add special case when building Linux NEURON wheels on ARM MacOS host * Fix #3535 * Pass `NRN_ENABLE_INTERVIEWS` env var to container
1 parent 3b1cd44 commit 6df8909

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

packaging/python/build_wheels.bash

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ set_cibw_environment() {
9494
[NRN_ENABLE_CORENEURON]="ON"
9595
[NRN_BINARY_DIST_BUILD]="ON"
9696
[NRN_RX3D_OPT_LEVEL]="0"
97+
[NRN_ENABLE_INTERVIEWS]="ON"
9798
# 10.14 is required for full C++17 support according to
9899
# https://cibuildwheel.readthedocs.io/en/stable/cpp_standards, but it
99100
# seems that 10.15 is actually needed for std::filesystem::path.
@@ -110,6 +111,7 @@ set_cibw_environment() {
110111
[CORENRN_ENABLE_OPENMP]="ON"
111112
[NRN_BINARY_DIST_BUILD]="ON"
112113
[NRN_RX3D_OPT_LEVEL]="0"
114+
[NRN_ENABLE_INTERVIEWS]="ON"
113115
)
114116
fi
115117

@@ -138,7 +140,14 @@ build_wheel_portable() {
138140
rm -rf "${build_dir}"
139141

140142
if [ "${platform}" = 'linux' ]; then
141-
NRN_MPI_DYNAMIC="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m)"
143+
# detect whether we are cross compiling, see:
144+
# https://github.com/neuronsimulator/nrn/issues/3535
145+
if [ "$(uname -s)" = 'Darwin' ] && [ "$(uname -m)" = 'arm64' ]; then
146+
NRN_MPI_DYNAMIC="${NRN_MPI_DYNAMIC:-/usr/include/openmpi-aarch64;/usr/include/mpich-aarch64}"
147+
else
148+
NRN_MPI_DYNAMIC="${NRN_MPI_DYNAMIC:-/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m)}"
149+
fi
150+
142151
# if we are building on Azure, we can use the MPT headers as well
143152
if [ -n "${TF_BUILD:-}" ]; then
144153
NRN_MPI_DYNAMIC="${NRN_MPI_DYNAMIC};/host/opt/nrnwheel/mpt/include"
@@ -148,7 +157,7 @@ build_wheel_portable() {
148157

149158
if [ "${platform}" = 'macos' ]; then
150159
if [ "$(uname -m)" = 'arm64' ]; then
151-
export MACOSX_DEPLOYMENT_TARGET='11.0'
160+
export MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET:-11.0}"
152161
fi
153162
fi
154163

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ environment-pass = [
143143
"CORENRN_ENABLE_OPENMP",
144144
"NRN_BINARY_DIST_BUILD",
145145
"NRN_RX3D_OPT_LEVEL",
146+
"NRN_ENABLE_INTERVIEWS",
146147
# when making a release, we need to override the version
147148
"SETUPTOOLS_SCM_PRETEND_VERSION",
148149
# in case the user wants to use less resources

0 commit comments

Comments
 (0)